diff options
author | CVS Import User <samba-bugs@samba.org> | 2004-04-04 11:51:10 +0000 |
---|---|---|
committer | CVS Import User <samba-bugs@samba.org> | 2004-04-04 11:51:10 +0000 |
commit | e3d2dbdff6711b0bc768fb6b08f41240f21d5fba (patch) | |
tree | 159ef54b59b18e9b950f5c6af105915214244912 /source/include | |
parent | 139b1658ca30692835c1a7203c7cd003e587ac12 (diff) | |
download | samba-e3d2dbdff6711b0bc768fb6b08f41240f21d5fba.tar.gz samba-e3d2dbdff6711b0bc768fb6b08f41240f21d5fba.tar.xz samba-e3d2dbdff6711b0bc768fb6b08f41240f21d5fba.zip |
r6: merge in the samba4 HEAD branch from cvs
to checkout try:
svn co svn+ssh://svn.samba.org/home/svn/samba/branches/SAMBA_4_0
metze
Diffstat (limited to 'source/include')
85 files changed, 4066 insertions, 18743 deletions
diff --git a/source/include/.cvsignore b/source/include/.cvsignore index 7dff121f143..f27200350c7 100644 --- a/source/include/.cvsignore +++ b/source/include/.cvsignore @@ -1,7 +1,9 @@ build_env.h config.h -stamp-h +config.h.in +includes.h.gch proto.h +stamp-h +tdbsam2_parse_info.h wrepld_proto.h -config.h.in version.h diff --git a/source/include/ads.h b/source/include/ads.h index 4daa65e796d..410395a71ba 100644 --- a/source/include/ads.h +++ b/source/include/ads.h @@ -1,17 +1,34 @@ -/* - header for ads (active directory) library routines - - basically this is a wrapper around ldap +/* + Unix SMB/CIFS implementation. + header for ads (active directory) library routines + basically this is a wrapper around ldap + + Copyright (C) Andrew Tridgell 2001-2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef _ADS_H +#define _ADS_H + typedef struct { void *ld; /* the active ldap structure */ struct in_addr ldap_ip; /* the ip of the active connection, if any */ time_t last_attempt; /* last attempt to reconnect */ int ldap_port; - int is_mine; /* do I own this structure's memory? */ - /* info needed to find the server */ struct { char *realm; @@ -29,7 +46,6 @@ typedef struct { char *kdc_server; unsigned flags; int time_offset; - time_t expire; } auth; /* info derived from the servers config */ @@ -210,6 +226,9 @@ typedef void **ADS_MODLIST; #define ADS_AUTH_SIMPLE_BIND 0x08 #define ADS_AUTH_ALLOW_NTLMSSP 0x10 +/*************************************** + Some krb5 compat stuff +***************************************/ /* Kerberos environment variable names */ #define KRB5_ENV_CCNAME "KRB5CCNAME" @@ -224,3 +243,29 @@ typedef void **ADS_MODLIST; #ifndef HAVE_AP_OPTS_USE_SUBKEY #define AP_OPTS_USE_SUBKEY 0 #endif +#if defined(HAVE_KRB5) + +#ifndef HAVE_KRB5_SET_REAL_TIME +krb5_error_code krb5_set_real_time(krb5_context context, int32_t seconds, int32_t microseconds); +#endif + +#ifndef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES +krb5_error_code krb5_set_default_tgs_ktypes(krb5_context ctx, const krb5_enctype *enc); +#endif + +#if defined(HAVE_KRB5_AUTH_CON_SETKEY) && !defined(HAVE_KRB5_AUTH_CON_SETUSERUSERKEY) +krb5_error_code krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock); +#endif + +/* Samba wrapper function for krb5 functionality. */ +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); +void get_auth_data_from_tkt(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); +void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); +BOOL get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, DATA_BLOB *session_key, BOOL remote); +#endif /* HAVE_KRB5 */ + +#endif /* _ADS_H */ diff --git a/source/include/adt_tree.h b/source/include/adt_tree.h deleted file mode 100644 index 12e2ea5cc53..00000000000 --- a/source/include/adt_tree.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Generic Abstract Data Types - * Copyright (C) Gerald Carter 2002. - * - * 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 ADT_TREE_H -#define ADT_TREE_H - -typedef struct _tree_node { - struct _tree_node *parent; - struct _tree_node **children; - int num_children; - char *key; - void *data_p; -} TREE_NODE; - -typedef struct _tree_root { - TREE_NODE *root; - int (*compare)(void* x, void *y); - void (*free_func)(void *p); -} SORTED_TREE; - -#endif diff --git a/source/include/asn_1.h b/source/include/asn_1.h index 796c8bb7404..7d4da0db0c8 100644 --- a/source/include/asn_1.h +++ b/source/include/asn_1.h @@ -60,10 +60,10 @@ typedef struct { #define SPNEGO_NEG_RESULT_REJECT 2 /* not really ASN.1, but RFC 1964 */ -#define TOK_ID_KRB_AP_REQ (uchar*)"\x01\x00" -#define TOK_ID_KRB_AP_REP (uchar*)"\x02\x00" -#define TOK_ID_KRB_ERROR (uchar*)"\x03\x00" -#define TOK_ID_GSS_GETMIC (uchar*)"\x01\x01" -#define TOK_ID_GSS_WRAP (uchar*)"\x02\x01" +#define TOK_ID_KRB_AP_REQ "\x01\x00" +#define TOK_ID_KRB_AP_REP "\x02\x00" +#define TOK_ID_KRB_ERROR "\x03\x00" +#define TOK_ID_GSS_GETMIC "\x01\x01" +#define TOK_ID_GSS_WRAP "\x02\x01" #endif /* _ASN_1_H */ diff --git a/source/include/auth.h b/source/include/auth.h deleted file mode 100644 index 27cdc1e3f5f..00000000000 --- a/source/include/auth.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef _SMBAUTH_H_ -#define _SMBAUTH_H_ -/* - Unix SMB/CIFS implementation. - Standardised Authentication types - Copyright (C) Andrew Bartlett 2001 - - 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. -*/ - -/* AUTH_STR - string */ -typedef struct normal_string -{ - int len; - char *str; -} AUTH_STR; - -/* AUTH_UNISTR - unicode string or buffer */ -typedef struct unicode_string -{ - int len; - uchar *unistr; -} AUTH_UNISTR; - -typedef struct interactive_password -{ - OWF_INFO lm_owf; /* LM OWF Password */ - OWF_INFO nt_owf; /* NT OWF Password */ -} auth_interactive_password; - -#define AUTH_FLAG_NONE 0x000000 -#define AUTH_FLAG_PLAINTEXT 0x000001 -#define AUTH_FLAG_LM_RESP 0x000002 -#define AUTH_FLAG_NTLM_RESP 0x000004 -#define AUTH_FLAG_NTLMv2_RESP 0x000008 - -typedef struct auth_usersupplied_info -{ - - DATA_BLOB lm_resp; - DATA_BLOB nt_resp; - auth_interactive_password * interactive_password; - DATA_BLOB plaintext_password; - - BOOL encrypted; - - uint32 auth_flags; - - AUTH_STR client_domain; /* domain name string */ - AUTH_STR domain; /* domain name after mapping */ - AUTH_STR internal_username; /* username after mapping */ - AUTH_STR smb_name; /* username before mapping */ - AUTH_STR wksta_name; /* workstation name (netbios calling name) unicode string */ - -} auth_usersupplied_info; - -#define SAM_FILL_NAME 0x01 -#define SAM_FILL_INFO3 0x02 -#define SAM_FILL_SAM 0x04 -#define SAM_FILL_UNIX 0x08 -#define SAM_FILL_ALL (SAM_FILL_NAME | SAM_FILL_INFO3 | SAM_FILL_SAM | SAM_FILL_UNIX) - -typedef struct auth_serversupplied_info -{ - BOOL guest; - - uid_t uid; - gid_t gid; - - /* This groups info is needed for when we become_user() for this uid */ - int n_groups; - gid_t *groups; - - /* NT group information taken from the info3 structure */ - - NT_USER_TOKEN *ptok; - PRIVILEGE_SET *privs; - - DATA_BLOB nt_session_key; - DATA_BLOB lm_session_key; - - uint32 sam_fill_level; /* How far is this structure filled? */ - - SAM_ACCOUNT *sam_account; - - void *pam_handle; - - char *unix_name; - -} auth_serversupplied_info; - -struct auth_context { - DATA_BLOB challenge; - - /* Who set this up in the first place? */ - const char *challenge_set_by; - - BOOL challenge_may_be_modified; - - struct auth_methods *challenge_set_method; - /* What order are the various methods in? Try to stop it changing under us */ - struct auth_methods *auth_method_list; - - TALLOC_CTX *mem_ctx; - const uint8 *(*get_ntlm_challenge)(struct auth_context *auth_context); - NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context, - const struct auth_usersupplied_info *user_info, - struct auth_serversupplied_info **server_info); - NTSTATUS (*nt_status_squash)(NTSTATUS nt_status); - void (*free)(struct auth_context **auth_context); -}; - -typedef struct auth_methods -{ - struct auth_methods *prev, *next; - const char *name; /* What name got this module */ - - NTSTATUS (*auth)(const struct auth_context *auth_context, - void *my_private_data, - TALLOC_CTX *mem_ctx, - const struct auth_usersupplied_info *user_info, - auth_serversupplied_info **server_info); - - DATA_BLOB (*get_chal)(const struct auth_context *auth_context, - void **my_private_data, - TALLOC_CTX *mem_ctx); - - /* Used to keep tabs on things like the cli for SMB server authentication */ - void *private_data; - - /* Function to clean up the above arbitary structure */ - void (*free_private_data)(void **private_data); - - /* Function to send a keepalive message on the above structure */ - void (*send_keepalive)(void **private_data); - -} auth_methods; - -typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **); - -struct auth_init_function_entry { - const char *name; - /* Function to create a member of the authmethods list */ - - auth_init_function init; - - struct auth_init_function_entry *prev, *next; -}; - -typedef struct auth_ntlmssp_state -{ - TALLOC_CTX *mem_ctx; - struct auth_context *auth_context; - struct auth_serversupplied_info *server_info; - struct ntlmssp_state *ntlmssp_state; -} AUTH_NTLMSSP_STATE; - -#define AUTH_INTERFACE_VERSION 1 - -#endif /* _SMBAUTH_H_ */ diff --git a/source/include/authdata.h b/source/include/authdata.h deleted file mode 100644 index 9d80745fb06..00000000000 --- a/source/include/authdata.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Kerberos authorization data - Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _AUTHDATA_H -#define _AUTHDATA_H - -#include "rpc_misc.h" - -#define PAC_TYPE_LOGON_INFO 1 -#define PAC_TYPE_SERVER_CHECKSUM 6 -#define PAC_TYPE_PRIVSVR_CHECKSUM 7 -#define PAC_TYPE_UNKNOWN_10 10 - -typedef struct unknown_type_10 { - NTTIME unknown_time; - uint16 len; - uint16 *username; /* might not be null terminated, so not UNISTR */ -} UNKNOWN_TYPE_10; - -typedef struct pac_signature_data { - uint32 type; - uint8 *signature; -} PAC_SIGNATURE_DATA; - -typedef struct group_membership { - uint32 rid; - uint32 attrs; -} GROUP_MEMBERSHIP; - -typedef struct group_membership_array { - uint32 count; - GROUP_MEMBERSHIP *group_membership; -} GROUP_MEMBERSHIP_ARRAY; - -typedef struct krb_sid_and_attrs { - uint32 sid_ptr; - uint32 attrs; - DOM_SID2 *sid; -} KRB_SID_AND_ATTRS; - -typedef struct krb_sid_and_attr_array { - uint32 count; - KRB_SID_AND_ATTRS *krb_sid_and_attrs; -} KRB_SID_AND_ATTR_ARRAY; - - -/* This is awfully similar to a samr_user_info_23, but not identical. - Many of the field names have been swiped from there, because it is - so similar that they are likely the same, but many have been verified. - Some are in a different order, though... */ -typedef struct pac_logon_info { - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - UNIHDR hdr_user_name; /* user name unicode string header */ - UNIHDR hdr_full_name; /* user's full name unicode string header */ - UNIHDR hdr_logon_script; /* these last 4 appear to be in a different */ - UNIHDR hdr_profile_path; /* order than in the info23 */ - UNIHDR hdr_home_dir; - UNIHDR hdr_dir_drive; - - uint16 logon_count; /* number of times user has logged onto domain */ - uint16 reserved12; - - uint32 user_rid; - uint32 group_rid; - uint32 group_count; - uint32 group_membership_ptr; - uint32 user_flags; - - uint32 reserved13[4]; - 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]; - - uint32 sid_count; - uint32 ptr_extra_sids; - - uint32 ptr_res_group_dom_sid; - uint32 res_group_count; - uint32 ptr_res_groups; - - UNISTR2 uni_user_name; /* user name unicode string header */ - UNISTR2 uni_full_name; /* user's full name unicode string header */ - UNISTR2 uni_logon_script; /* these last 4 appear to be in a different*/ - UNISTR2 uni_profile_path; /* order than in the info23 */ - UNISTR2 uni_home_dir; - UNISTR2 uni_dir_drive; - UNISTR2 uni_dom_controller; - UNISTR2 uni_dom_name; - DOM_SID2 dom_sid; - GROUP_MEMBERSHIP_ARRAY groups; - KRB_SID_AND_ATTR_ARRAY extra_sids; - DOM_SID2 res_group_dom_sid; - GROUP_MEMBERSHIP_ARRAY res_groups; - -} PAC_LOGON_INFO; - -typedef struct pac_info_ctr -{ - union - { - PAC_LOGON_INFO *logon_info; - PAC_SIGNATURE_DATA *srv_cksum; - PAC_SIGNATURE_DATA *privsrv_cksum; - UNKNOWN_TYPE_10 *type_10; - } pac; -} PAC_INFO_CTR; - -typedef struct pac_info_hdr { - uint32 type; - uint32 size; - uint32 offset; - uint32 offsethi; - PAC_INFO_CTR *ctr; -} PAC_INFO_HDR; - -typedef struct pac_data { - uint32 num_buffers; - uint32 version; - PAC_INFO_HDR *pac_info_hdr_ptr; -} PAC_DATA; - - -#endif diff --git a/source/include/byteorder.h b/source/include/byteorder.h index 0eef5573066..94a346f89d9 100644 --- a/source/include/byteorder.h +++ b/source/include/byteorder.h @@ -168,4 +168,8 @@ it also defines lots of intermediate macros, just ignore those :-) #define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3)) #define ALIGN2(p,base) ((p) + ((2 - (PTR_DIFF((p), (base)) & 1)) & 1)) + +/* macros for accessing SMB protocol elements */ +#define VWV(vwv) ((vwv)*2) + #endif /* _BYTEORDER_H */ diff --git a/source/include/charset.h b/source/include/charset.h index 7a9b12ef55d..daf10e23c13 100644 --- a/source/include/charset.h +++ b/source/include/charset.h @@ -20,108 +20,21 @@ */ /* this defines the charset types used in samba */ -typedef enum {CH_UCS2=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4} charset_t; +typedef enum {CH_UCS2=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4, CH_UCS2BE=5} charset_t; -#define NUM_CHARSETS 5 +#define NUM_CHARSETS 6 -/* - * for each charset we have a function that pushes from that charset to a ucs2 - * buffer, and a function that pulls from ucs2 buffer to that charset. +/* + * for each charset we have a function that pulls from that charset to + * a ucs2 buffer, and a function that pushes to a ucs2 buffer * */ struct charset_functions { const char *name; - size_t (*pull)(void *, char **inbuf, size_t *inbytesleft, + size_t (*pull)(void *, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); - size_t (*push)(void *, char **inbuf, size_t *inbytesleft, + size_t (*push)(void *, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); struct charset_functions *prev, *next; }; -/* - * This is auxiliary struct used by source/script/gen-8-bit-gap.sh script - * during generation of an encoding table for charset module - * */ - -struct charset_gap_table { - uint16 start; - uint16 end; - int32 idx; -}; - -/* - * Define stub for charset module which implements 8-bit encoding with gaps. - * Encoding tables for such module should be produced from glibc's CHARMAPs - * using script source/script/gen-8bit-gap.sh - * CHARSETNAME is CAPITALIZED charset name - * - * */ -#define SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP(CHARSETNAME) \ -static size_t CHARSETNAME ## _push(void *cd, char **inbuf, size_t *inbytesleft, \ - char **outbuf, size_t *outbytesleft) \ -{ \ - while (*inbytesleft >= 2 && *outbytesleft >= 1) { \ - int i; \ - int done = 0; \ - \ - uint16 ch = SVAL(*inbuf,0); \ - \ - for (i=0; from_idx[i].start != 0xffff; i++) { \ - if ((from_idx[i].start <= ch) && (from_idx[i].end >= ch)) { \ - ((unsigned char*)(*outbuf))[0] = from_ucs2[from_idx[i].idx+ch]; \ - (*inbytesleft) -= 2; \ - (*outbytesleft) -= 1; \ - (*inbuf) += 2; \ - (*outbuf) += 1; \ - done = 1; \ - break; \ - } \ - } \ - if (!done) { \ - errno = EINVAL; \ - return -1; \ - } \ - \ - } \ - \ - if (*inbytesleft == 1) { \ - errno = EINVAL; \ - return -1; \ - } \ - \ - if (*inbytesleft > 1) { \ - errno = E2BIG; \ - return -1; \ - } \ - \ - return 0; \ -} \ - \ -static size_t CHARSETNAME ## _pull(void *cd, char **inbuf, size_t *inbytesleft, \ - char **outbuf, size_t *outbytesleft) \ -{ \ - while (*inbytesleft >= 1 && *outbytesleft >= 2) { \ - *(uint16*)(*outbuf) = to_ucs2[((unsigned char*)(*inbuf))[0]]; \ - (*inbytesleft) -= 1; \ - (*outbytesleft) -= 2; \ - (*inbuf) += 1; \ - (*outbuf) += 2; \ - } \ - \ - if (*inbytesleft > 0) { \ - errno = E2BIG; \ - return -1; \ - } \ - \ - return 0; \ -} \ - \ -struct charset_functions CHARSETNAME ## _functions = \ - {#CHARSETNAME, CHARSETNAME ## _pull, CHARSETNAME ## _push}; \ - \ -NTSTATUS charset_ ## CHARSETNAME ## _init(void) \ -{ \ - return smb_register_charset(& CHARSETNAME ## _functions); \ -} \ - - diff --git a/source/include/cli_context.h b/source/include/cli_context.h new file mode 100644 index 00000000000..bffb6c9f6a5 --- /dev/null +++ b/source/include/cli_context.h @@ -0,0 +1,312 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Luke Kenneth Casson Leighton 1996-1998 + Copyright (C) Jeremy Allison 1998 + Copyright (C) James Myers 2003 <myersjj@samba.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 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 _CLI_CONTEXT_H +#define _CLI_CONTEXT_H + +struct cli_tree; /* forward declare */ +struct cli_request; /* forward declare */ +struct cli_session; /* forward declare */ +struct cli_transport; /* forward declare */ + +typedef struct smb_sign_info { + void (*sign_outgoing_message)(struct cli_request *req); + BOOL (*check_incoming_message)(struct cli_request *req); + void (*free_signing_context)(struct cli_transport *transport); + void *signing_context; + + BOOL doing_signing; +} smb_sign_info; + +/* context that will be and has been negotiated between the client and server */ +struct cli_negotiate { + /* + * negotiated maximum transmit size - this is given to us by the server + */ + unsigned max_xmit; + + /* maximum number of requests that can be multiplexed */ + uint16 max_mux; + + /* the negotiatiated protocol */ + enum protocol_types protocol; + + int sec_mode; /* security mode returned by negprot */ + DATA_BLOB secblob; /* cryptkey or negTokenInit blob */ + uint32 sesskey; + + smb_sign_info sign_info; + + /* capabilities that the server reported */ + uint32 capabilities; + + int server_zone; + time_t server_time; + unsigned int readbraw_supported:1; + unsigned int writebraw_supported:1; + + const char *server_domain; +}; + +/* this is the context for a SMB socket associated with the socket itself */ +struct cli_socket { + TALLOC_CTX *mem_ctx; /* life of socket pool */ + + /* when the reference count reaches zero then the socket is destroyed */ + int reference_count; + + struct in_addr dest_ip; + + /* the port used */ + int port; + + /* the open file descriptor */ + int fd; + + /* a count of the number of packets we have received. We + * actually only care about zero/non-zero at this stage */ + unsigned pkt_count; + + /* the network address of the client */ + char *client_addr; + + /* timeout for socket operations in milliseconds. */ + int timeout; +}; + +/* + this structure allows applications to control the behaviour of the + client library +*/ +struct cli_options { + unsigned int use_oplocks:1; + unsigned int use_level2_oplocks:1; + unsigned int use_spnego:1; +}; + +/* this is the context for the client transport layer */ +struct cli_transport { + TALLOC_CTX *mem_ctx; + + /* when the reference count reaches zero then the transport is destroyed */ + int reference_count; + + /* socket level info */ + struct cli_socket *socket; + + /* the next mid to be allocated - needed for signing and + request matching */ + uint16 next_mid; + + /* negotiated protocol information */ + struct cli_negotiate negotiate; + + /* options to control the behaviour of the client code */ + struct cli_options options; + + /* is a readbraw pending? we need to handle that case + specially on receiving packets */ + unsigned int readbraw_pending:1; + + /* an idle function - if this is defined then it will be + called once every period milliseconds while we are waiting + for a packet */ + struct { + void (*func)(struct cli_transport *, void *); + void *private; + uint_t period; + } idle; + + /* the error fields from the last message */ + struct { + enum {ETYPE_NONE, ETYPE_DOS, ETYPE_NT, ETYPE_SOCKET, ETYPE_NBT} etype; + union { + struct { + uint8 eclass; + uint16 ecode; + } dos; + NTSTATUS nt_status; + enum socket_error socket_error; + unsigned nbt_error; + } e; + } error; + + struct { + /* a oplock break request handler */ + BOOL (*handler)(struct cli_transport *transport, + uint16 tid, uint16 fnum, uint8 level, void *private); + /* private data passed to the oplock handler */ + void *private; + } oplock; + + /* a list of async requests that are pending on this connection */ + struct cli_request *pending_requests; + + /* remember the called name - some sub-protocols require us to + know the server name */ + struct nmb_name called; +}; + +/* this is the context for the user */ + +/* this is the context for the session layer */ +struct cli_session { + TALLOC_CTX *mem_ctx; /* life of session */ + + /* when the reference count reaches zero then the session is destroyed */ + int reference_count; + + /* transport layer info */ + struct cli_transport *transport; + + /* after a session setup the server provides us with + a vuid identifying the security context */ + uint16 vuid; + + /* default pid for this session */ + uint32 pid; +}; + +/* + cli_tree context: internal state for a tree connection. + */ +struct cli_tree { + /* life of tree tree */ + TALLOC_CTX *mem_ctx; + + /* when the reference count reaches zero then the tree is destroyed */ + int reference_count; + + /* session layer info */ + struct cli_session *session; + + uint16 tid; /* tree id, aka cnum */ + char *device; + char *fs_type; +}; + +/* the context for a single SMB request. This is passed to any request-context + * functions (similar to context.h, the server version). + * This will allow requests to be multi-threaded. */ +struct cli_request { + /* allow a request to be part of a list of requests */ + struct cli_request *next, *prev; + + /* a talloc context for the lifetime of this request */ + TALLOC_CTX *mem_ctx; + + /* a request always has a transport context, nearly always has + a session context and usually has a tree context */ + struct cli_transport *transport; + struct cli_session *session; + struct cli_tree *tree; + + /* the flags2 from the SMB request, in raw form (host byte + order). Used to parse strings */ + uint16 flags2; + + /* the NT status for this request. Set by packet receive code + or code detecting error. */ + NTSTATUS status; + + /* the sequence number of this packet - used for signing */ + unsigned seq_num; + + /* set if this is a one-way request, meaning we are not + expecting a reply from the server. */ + unsigned int one_way_request:1; + + /* the mid of this packet - used to match replies */ + uint16 mid; + + struct { + /* the raw SMB buffer, including the 4 byte length header */ + char *buffer; + + /* the size of the raw buffer, including 4 byte header */ + unsigned size; + + /* how much has been allocated - on reply the buffer is over-allocated to + prevent too many realloc() calls + */ + unsigned allocated; + + /* the start of the SMB header - this is always buffer+4 */ + char *hdr; + + /* the command words and command word count. vwv points + into the raw buffer */ + char *vwv; + unsigned wct; + + /* the data buffer and size. data points into the raw buffer */ + char *data; + unsigned data_size; + + /* ptr is used as a moving pointer into the data area + * of the packet. The reason its here and not a local + * variable in each function is that when a realloc of + * a send packet is done we need to move this + * pointer */ + char *ptr; + } in, out; + + /* information on what to do with a reply when it is received + asyncronously. If this is not setup when a reply is received then + the reply is discarded + + The private pointer is private to the caller of the client + library (the application), not private to the library + */ + struct { + void (*fn)(struct cli_request *); + void *private; + } async; +}; + +/* + cli_state: internal state used in libcli library for single-threaded callers, + i.e. a single session on a single socket. + */ +struct cli_state { + TALLOC_CTX *mem_ctx; /* life of client pool */ + struct cli_transport *transport; + struct cli_session *session; + struct cli_tree *tree; + struct substitute_context substitute; +}; + +/* useful way of catching wct errors with file and line number */ +#define CLI_CHECK_MIN_WCT(req, wcount) if ((req)->in.wct < (wcount)) { \ + DEBUG(1,("Unexpected WCT %d at %s(%d) - expected min %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \ + req->status = NT_STATUS_INVALID_PARAMETER; \ + goto failed; \ +} + +#define CLI_CHECK_WCT(req, wcount) if ((req)->in.wct != (wcount)) { \ + DEBUG(1,("Unexpected WCT %d at %s(%d) - expected %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \ + req->status = NT_STATUS_INVALID_PARAMETER; \ + goto failed; \ +} + +#endif /* _CLI_CONTEXT_H */ diff --git a/source/include/client.h b/source/include/client.h index 968b73f0b41..8b0aedd48cc 100644 --- a/source/include/client.h +++ b/source/include/client.h @@ -4,6 +4,7 @@ Copyright (C) Andrew Tridgell 1992-1998 Copyright (C) Luke Kenneth Casson Leighton 1996-1998 Copyright (C) Jeremy Allison 1998 + Copyright (C) James Myers 2003 <myersjj@samba.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,6 +28,10 @@ overlap on the wire. This size gives us a nice read/write size, which will be a multiple of the page size on almost any system */ #define CLI_BUFFER_SIZE (0xFFFF) +#define CLI_DFS_MAX_REFERRAL_LEVEL 3 + +#define SAFETY_MARGIN 1024 +#define LARGE_WRITEX_HDR_SIZE 65 /* @@ -43,7 +48,7 @@ typedef struct file_info time_t mtime; time_t atime; time_t ctime; - pstring name; + const char *name; char short_name[13*3]; /* the *3 is to cope with multi-byte */ } file_info; @@ -57,113 +62,56 @@ struct print_job_info time_t t; }; -struct cli_state { - int port; - int fd; - int smb_rw_error; /* Copy of last read or write error. */ - uint16 cnum; - uint16 pid; - uint16 mid; - uint16 vuid; - int protocol; - int sec_mode; - int rap_error; - int privileges; - - fstring desthost; - fstring user_name; - fstring domain; - - /* - * The following strings are the - * ones returned by the server if - * the protocol > NT1. - */ - fstring server_type; - fstring server_os; - fstring server_domain; - - fstring share; - fstring dev; - struct nmb_name called; - struct nmb_name calling; - fstring full_dest_host_name; - struct in_addr dest_ip; - - struct pwd_info pwd; - DATA_BLOB secblob; /* cryptkey or negTokenInit */ - uint32 sesskey; - int serverzone; - uint32 servertime; - int readbraw_supported; - int writebraw_supported; - int timeout; /* in milliseconds. */ - size_t max_xmit; - size_t max_mux; - char *outbuf; - char *inbuf; - unsigned int bufsize; - int initialised; - int win95; - uint32 capabilities; - +typedef struct referral_info +{ + int server_type; + int referral_flags; + int proximity; + int ttl; + int pathOffset; + int altPathOffset; + int nodeOffset; + char *path; + char *altPath; + char *node; + char *host; + char *share; +} referral_info; + +typedef struct dfs_info +{ + int path_consumed; + int referral_flags; + int selected_referral; + int number_referrals; + referral_info referrals[10]; +} dfs_info; + +/* Internal client error codes for cli_request_context.internal_error_code */ +#define CLI_ERR_INVALID_TRANS_RESPONSE 100 + +#define DFS_MAX_CLUSTER_SIZE 8 +/* client_context: used by cliraw callers to maintain Dfs + * state across multiple Dfs servers + */ +struct cli_client +{ + const char* sockops; + char* username; + char* password; + char* workgroup; TALLOC_CTX *mem_ctx; - - smb_sign_info sign_info; - - /* the session key for this CLI, outside - 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 */ - - uint16 nt_pipe_fnum; /* Pipe handle. */ - - /* Secure pipe parameters */ - int pipe_auth_flags; - - uint16 saved_netlogon_pipe_fnum; /* The "first" pipe to get - the session key for the - schannel. */ - struct netsec_auth_struct auth_info; - - NTLMSSP_STATE *ntlmssp_pipe_state; - - 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. */ + int number_members; + BOOL use_dfs; /* True if client should support Dfs */ + int connection_flags; /* see CLI_FULL_CONN.. below */ uint16 max_xmit_frag; uint16 max_recv_frag; - - BOOL use_kerberos; - BOOL use_spnego; - - BOOL use_oplocks; /* should we use oplocks? */ - BOOL use_level_II_oplocks; /* should we use level II oplocks? */ - - /* a oplock break request handler */ - BOOL (*oplock_handler)(struct cli_state *cli, int fnum, unsigned char level); - - BOOL force_dos_errors; - - /* 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; + struct cli_state *cli[DFS_MAX_CLUSTER_SIZE]; }; #define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001 #define CLI_FULL_CONNECTION_USE_KERBEROS 0x0002 #define CLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK 0x0004 +#define CLI_FULL_CONNECTION_USE_DFS 0x0008 #endif /* _CLIENT_H */ diff --git a/source/include/context.h b/source/include/context.h new file mode 100644 index 00000000000..5c7d117050a --- /dev/null +++ b/source/include/context.h @@ -0,0 +1,365 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Andrew Tridgell 2003 + Copyright (C) James J Myers 2003 <myersjj@samba.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 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. +*/ + +/* + this header declares the core context structures associated with smb + sockets, tree connects, requests etc + + the idea is that we will eventually get rid of all our global + variables and instead store our stang from structures hanging off + these basic elements +*/ + +/* the current user context for a request */ +struct user_context { + /* the vuid is used to specify the security context for this + request. Note that this may not be the same vuid as we + received on the wire (for example, for share mode or guest + access) */ + uint16 vuid; + + /* the domain name, user name etc - mostly used in % substitutions */ + struct userdom_struct *user; + + struct user_struct *vuser; +}; + + +/* each backend has to be one one of the following 3 basic types. In + * earlier versions of Samba backends needed to handle all types, now + * we implement them separately. */ +enum ntvfs_type {NTVFS_DISK, NTVFS_PRINT, NTVFS_IPC}; + +/* we need a forward declaration of the ntvfs_ops strucutre to prevent + include recursion */ +struct ntvfs_ops; + +struct tcon_context { + struct tcon_context *next, *prev; + + /* the server context that this was created on */ + struct server_context *smb; + + /* a talloc context for all data in this structure */ + TALLOC_CTX *mem_ctx; + + /* a private structure used by the active NTVFS backend */ + void *ntvfs_private; + + uint16 cnum; /* an index passed over the wire (the TID) */ + int service; + enum ntvfs_type type; + BOOL read_only; + BOOL admin_user; + + /* the NTVFS operations - see source/ntvfs/ and include/ntvfs.h for details */ + const struct ntvfs_ops *ntvfs_ops; + + /* the reported filesystem type */ + char *fs_type; + + /* the reported device type */ + char *dev_type; +}; + +/* the context for a single SMB request. This is passed to any request-context + functions */ +struct request_context { + /* the server_context contains all context specific to this SMB socket */ + struct server_context *smb; + + /* conn is only set for operations that have a valid TID */ + struct tcon_context *conn; + + /* the user context is derived from the vuid plus smb.conf options */ + struct user_context *user_ctx; + + /* a talloc context for the lifetime of this request */ + TALLOC_CTX *mem_ctx; + + /* a set of flags to control usage of the request. See REQ_CONTROL_* */ + unsigned control_flags; + + /* the smb pid is needed for locking contexts */ + uint16 smbpid; + + /* the flags from the SMB request, in raw form (host byte order) */ + uint16 flags, flags2; + + /* the system time when the request arrived */ + struct timeval request_time; + + /* this can contain a fnum from an earlier part of a chained + * message (such as an SMBOpenX), or -1 */ + int chained_fnum; + + /* how far through the chain of SMB commands have we gone? */ + unsigned chain_count; + + /* the async structure allows backend functions to delay + replying to requests. To use this, the front end must set + async.send_fn to a function to be called by the backend + when the reply is finally ready to be sent. The backend + must set async.status to the status it wants in the + reply. The backend must set the REQ_CONTROL_ASYNC + control_flag on the request to indicate that it wishes to + delay the reply + + If async.send_fn is NULL then the backend cannot ask for a + delayed reply for this request + + note that the async.private pointer is private to the front + end not the backend. The backend must not change it. + */ + struct { + void (*send_fn)(struct request_context *); + void *private; + NTSTATUS status; + } async; + + struct { + /* the raw SMB buffer, including the 4 byte length header */ + char *buffer; + + /* the size of the raw buffer, including 4 byte header */ + unsigned size; + + /* how much has been allocated - on reply the buffer is over-allocated to + prevent too many realloc() calls + */ + unsigned allocated; + + /* the start of the SMB header - this is always buffer+4 */ + char *hdr; + + /* the command words and command word count. vwv points + into the raw buffer */ + char *vwv; + unsigned wct; + + /* the data buffer and size. data points into the raw buffer */ + char *data; + unsigned data_size; + + /* ptr is used as a moving pointer into the data area + * of the packet. The reason its here and not a local + * variable in each function is that when a realloc of + * a reply packet is done we need to move this + * pointer */ + char *ptr; + } in, out; +}; + + + +/* the context associated with open files on an smb socket */ +struct files_context { + struct files_struct *files; /* open files */ + struct bitmap *file_bmap; /* bitmap used to allocate file handles */ + + /* a fsp to use when chaining */ + struct files_struct *chain_fsp; + + /* a fsp to use to save when breaking an oplock. */ + struct files_struct *oplock_save_chain_fsp; + + /* how many files are open */ + int files_used; + + /* limit for maximum open files */ + int real_max_open_files; +}; + + +/* the context associated with open tree connects on a smb socket */ +struct tree_context { + struct tcon_context *connections; + + /* number of open connections */ + struct bitmap *bmap; + int num_open; +}; + +/* context associated with currently valid session setups */ +struct users_context { + /* users from session setup */ + char *session_users; /* was a pstring */ + + /* this holds info on user ids that are already validated for this VC */ + struct user_struct *validated_users; + int next_vuid; /* initialise to VUID_OFFSET */ + int num_validated_vuids; +}; + + +/* this contains variables that should be used in % substitutions for + * smb.conf parameters */ +struct substitute_context { + char *remote_arch; + + /* our local netbios name, as give to us by the client */ + char *local_machine; + + /* the remote netbios name, as give to us by the client */ + char *remote_machine; + + /* the select remote protocol */ + char *remote_proto; + + /* the name of the client as should be displayed in + * smbstatus. Can be an IP or a netbios name */ + char *client_name; + + /* the username for %U */ + char *user_name; +}; + +/* context that has been negotiated between the client and server */ +struct negotiate_context { + /* have we already done the NBT session establishment? */ + BOOL done_nbt_session; + + /* only one negprot per connection is allowed */ + BOOL done_negprot; + + /* multiple session setups are allowed, but some parameters are + ignored in any but the first */ + BOOL done_sesssetup; + + /* + * Size of data we can send to client. Set + * by the client for all protocols above CORE. + * Set by us for CORE protocol. + */ + unsigned max_send; /* init to BUFFER_SIZE */ + + /* + * Size of the data we can receive. Set by us. + * Can be modified by the max xmit parameter. + */ + unsigned max_recv; /* init to BUFFER_SIZE */ + + /* a guess at the remote architecture. Try not to rely on this - in almost + all cases using these values is the wrong thing to do */ + enum remote_arch_types ra_type; + + /* the negotiatiated protocol */ + enum protocol_types protocol; + + /* authentication context for multi-part negprot */ + struct auth_context *auth_context; + + /* state of NTLMSSP auth */ + struct auth_ntlmssp_state *ntlmssp_state; + + /* did we tell the client we support encrypted passwords? */ + BOOL encrypted_passwords; + + /* did we send an extended security negprot reply? */ + BOOL spnego_negotiated; + + /* client capabilities */ + uint32 client_caps; +}; + +/* this is the context for a SMB socket associated with the socket itself */ +struct socket_context { + /* the open file descriptor */ + int fd; + + /* the last read error on the socket, if any (replaces smb_read_error global) */ + int read_error; + + /* a count of the number of packets we have received. We + * actually only care about zero/non-zero at this stage */ + unsigned pkt_count; + + /* the network address of the client */ + char *client_addr; +}; + + +/* this holds long term state specific to the printing subsystem */ +struct printing_context { + struct notify_queue *notify_queue_head; +}; + + +/* the server_context holds a linked list of pending requests, + * this is used for blocking locks and requests blocked due to oplock + * break requests */ +struct pending_request { + struct pending_request *next, *prev; + + /* the request itself - needs to be freed */ + struct request_context *request; +}; + +/* the timers context contains info on when we last did various + * functions */ +struct timers_context { + /* when did we last do timeout processing? */ + time_t last_timeout_processing; + + /* when did we last sent a keepalive */ + time_t last_keepalive_sent; + + /* when we last checked the smb.conf for auto-reload */ + time_t last_smb_conf_reload; +}; + +#include "smbd/process_model.h" + +/* smb context structure. This should contain all the state + * information associated with a SMB server */ +struct server_context { + /* a talloc context for all data in this structure */ + TALLOC_CTX *mem_ctx; + + struct negotiate_context negotiate; + + struct substitute_context substitute; + + struct socket_context socket; + + struct files_context file; + + struct tree_context tree; + + struct users_context users; + + struct printing_context print; + + struct timers_context timers; + + struct dcesrv_context dcesrv; + + /* the pid of the process handling this session */ + pid_t pid; + + /* pointer to list of events that we are waiting on */ + struct event_context *events; + + /* process model specific operations */ + const struct model_ops *model_ops; +}; + + diff --git a/source/include/debug.h b/source/include/debug.h index 55f07d8a18e..8c82c735579 100644 --- a/source/include/debug.h +++ b/source/include/debug.h @@ -1,11 +1,8 @@ /* Unix SMB/CIFS implementation. - SMB debug stuff - Copyright (C) Andrew Tridgell 1992-1998 - Copyright (C) John H Terpstra 1996-1998 - Copyright (C) Luke Kenneth Casson Leighton 1996-1998 - Copyright (C) Paul Ashton 1998 - + Samba debug defines + Copyright (C) Andrew Tridgell 2003 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -21,181 +18,35 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _DEBUG_H -#define _DEBUG_H - -/* -------------------------------------------------------------------------- ** - * Debugging code. See also debug.c - */ - -/* mkproto.awk has trouble with ifdef'd function definitions (it ignores - * the #ifdef directive and will read both definitions, thus creating two - * diffferent prototype declarations), so we must do these by hand. - */ -/* I know the __attribute__ stuff is ugly, but it does ensure we get the - arguemnts to DEBUG() right. We have got them wrong too often in the - past. - The PRINTFLIKE comment does the equivalent for SGI MIPSPro. - */ -/* PRINTFLIKE1 */ -int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2); -/* PRINTFLIKE1 */ -BOOL dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); -BOOL dbghdr( int level, const char *file, const char *func, int line ); - -extern XFILE *dbf; -extern pstring debugf; +/* the debug operations structure - contains function pointers to + various debug implementations of each operation */ +struct debug_ops { + /* function to log (using DEBUG) suspicious usage of data structure */ + void (*log_suspicious_usage)(const char* from, const char* info); + + /* function to log (using printf) suspicious usage of data structure. + * To be used in circumstances when using DEBUG would cause loop. */ + void (*print_suspicious_usage)(const char* from, const char* info); + + /* function to return process/thread id */ + uint32 (*get_task_id)(void); + + /* function to log process/thread id */ + void (*log_task_id)(int fd); +}; + +void do_debug(const char *, ...) PRINTF_ATTRIBUTE(1,2); -/* If we have these macros, we can add additional info to the header. */ - -#ifdef HAVE_FUNCTION_MACRO -#define FUNCTION_MACRO (__FUNCTION__) -#else -#define FUNCTION_MACRO ("") -#endif - -/* - * Redefine DEBUGLEVEL because so we don't have to change every source file - * that *unnecessarily* references it. Source files neeed not extern reference - * DEBUGLEVEL, as it's extern in includes.h (which all source files include). - * Eventually, all these references should be removed, and all references to - * DEBUGLEVEL should be references to DEBUGLEVEL_CLASS[DBGC_ALL]. This could - * still be through a macro still called DEBUGLEVEL. This cannot be done now - * because some references would expand incorrectly. - */ -#define DEBUGLEVEL *debug_level extern int DEBUGLEVEL; -/* - * Define all new debug classes here. A class is represented by an entry in - * the DEBUGLEVEL_CLASS array. Index zero of this arrray is equivalent to the - * old DEBUGLEVEL. Any source file that does NOT add the following lines: - * - * #undef DBGC_CLASS - * #define DBGC_CLASS DBGC_<your class name here> - * - * at the start of the file (after #include "includes.h") will default to - * using index zero, so it will behaive just like it always has. - */ -#define DBGC_ALL 0 /* index equivalent to DEBUGLEVEL */ - -#define DBGC_TDB 1 -#define DBGC_PRINTDRIVERS 2 -#define DBGC_LANMAN 3 -#define DBGC_SMB 4 -#define DBGC_RPC_PARSE 5 -#define DBGC_RPC_SRV 6 -#define DBGC_RPC_CLI 7 -#define DBGC_PASSDB 8 -#define DBGC_SAM 9 -#define DBGC_AUTH 10 -#define DBGC_WINBIND 11 -#define DBGC_VFS 12 -#define DBGC_IDMAP 13 -#define DBGC_QUOTA 14 - -/* So you can define DBGC_CLASS before including debug.h */ -#ifndef DBGC_CLASS -#define DBGC_CLASS 0 /* override as shown above */ -#endif - -extern int *DEBUGLEVEL_CLASS; -extern BOOL *DEBUGLEVEL_CLASS_ISSET; - -/* Debugging macros - * - * DEBUGLVL() - * If the 'file specific' debug class level >= level OR the system-wide - * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then - * generate a header using the default macros for file, line, and - * function name. Returns True if the debug level was <= DEBUGLEVEL. - * - * Example: if( DEBUGLVL( 2 ) ) dbgtext( "Some text.\n" ); - * - * DEBUGLVLC() - * If the 'macro specified' debug class level >= level OR the system-wide - * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then - * generate a header using the default macros for file, line, and - * function name. Returns True if the debug level was <= DEBUGLEVEL. - * - * Example: if( DEBUGLVLC( DBGC_TDB, 2 ) ) dbgtext( "Some text.\n" ); - * - * DEBUG() - * If the 'file specific' debug class level >= level OR the system-wide - * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then - * generate a header using the default macros for file, line, and - * function name. Each call to DEBUG() generates a new header *unless* the - * previous debug output was unterminated (i.e. no '\n'). - * See debug.c:dbghdr() for more info. - * - * Example: DEBUG( 2, ("Some text and a value %d.\n", value) ); - * - * DEBUGC() - * If the 'macro specified' debug class level >= level OR the system-wide - * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then - * generate a header using the default macros for file, line, and - * function name. Each call to DEBUG() generates a new header *unless* the - * previous debug output was unterminated (i.e. no '\n'). - * See debug.c:dbghdr() for more info. - * - * Example: DEBUGC( DBGC_TDB, 2, ("Some text and a value %d.\n", value) ); - * - * DEBUGADD(), DEBUGADDC() - * Same as DEBUG() and DEBUGC() except the text is appended to the previous - * DEBUG(), DEBUGC(), DEBUGADD(), DEBUGADDC() with out another interviening - * header. - * - * Example: DEBUGADD( 2, ("Some text and a value %d.\n", value) ); - * DEBUGADDC( DBGC_TDB, 2, ("Some text and a value %d.\n", value) ); - * - * Note: If the debug class has not be redeined (see above) then the optimizer - * will remove the extra conditional test. - */ - -#define DEBUGLVL( level ) \ - ( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ - DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) - - -#define DEBUGLVLC( dbgc_class, level ) \ - ( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ - (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ - DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) - - -#define DEBUG( level, body ) \ - (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ - DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ - && (dbgtext body) ) - -#define DEBUGC( dbgc_class, level, body ) \ - (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ - (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ - DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ - && (dbgtext body) ) - -#define DEBUGADD( level, body ) \ - (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ - DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbgtext body) ) +#define DEBUGLVL(level) ((level) <= DEBUGLEVEL) +#define DEBUG(level, body) do { if (DEBUGLVL(level)) do_debug body; } while (0) +#define DEBUGADD(level, body) DEBUG(level, body) +#define DEBUGC(class, level, body) DEBUG(level, body) +#define DEBUGADDC(class, level, body) DEBUG(level, body) +#define DEBUGTAB(n) do_debug_tab(n) -#define DEBUGADDC( dbgc_class, level, body ) \ - (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ - (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ - DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbgtext body) ) +enum debug_logtype {DEBUG_FILE, DEBUG_STDOUT, DEBUG_STDERR}; -#endif +/* keep some debug class defines for now to avoid changing old code too much */ +#define DBGC_AUTH 0 diff --git a/source/include/dlinklist.h b/source/include/dlinklist.h index 794aea75766..61912993842 100644 --- a/source/include/dlinklist.h +++ b/source/include/dlinklist.h @@ -24,7 +24,7 @@ /* hook into the front of the list */ #define DLIST_ADD(list, p) \ -{ \ +do { \ if (!(list)) { \ (list) = (p); \ (p)->next = (p)->prev = NULL; \ @@ -34,11 +34,11 @@ (p)->prev = NULL; \ (list) = (p); \ }\ -} +} while (0) /* remove an element from a list - element doesn't have to be in list. */ #define DLIST_REMOVE(list, p) \ -{ \ +do { \ if ((p) == (list)) { \ (list) = (p)->next; \ if (list) (list)->prev = NULL; \ @@ -47,32 +47,33 @@ if ((p)->next) (p)->next->prev = (p)->prev; \ } \ if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \ -} +} while (0) /* promote an element to the top of the list */ #define DLIST_PROMOTE(list, p) \ -{ \ - DLIST_REMOVE(list, p) \ - DLIST_ADD(list, p) \ -} +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD(list, p); \ +} while (0) /* hook into the end of the list - needs a tmp pointer */ -#define DLIST_ADD_END(list, p, tmp) \ -{ \ +#define DLIST_ADD_END(list, p, type) \ +do { \ if (!(list)) { \ (list) = (p); \ (p)->next = (p)->prev = NULL; \ } else { \ - for ((tmp) = (list); (tmp)->next; (tmp) = (tmp)->next) ; \ - (tmp)->next = (p); \ + type tmp; \ + for (tmp = (list); tmp->next; tmp = tmp->next) ; \ + tmp->next = (p); \ (p)->next = NULL; \ - (p)->prev = (tmp); \ + (p)->prev = tmp; \ } \ -} +} while (0) -/* demote an element to the top of the list, needs a tmp pointer */ +/* demote an element to the end of the list, needs a tmp pointer */ #define DLIST_DEMOTE(list, p, tmp) \ -{ \ - DLIST_REMOVE(list, p) \ - DLIST_ADD_END(list, p, tmp) \ -} +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD_END(list, p, tmp); \ +} while (0) diff --git a/source/include/doserr.h b/source/include/doserr.h index 576aeda2bf7..114366ff6e9 100644 --- a/source/include/doserr.h +++ b/source/include/doserr.h @@ -170,6 +170,7 @@ #define WERR_NOMEM W_ERROR(8) #define WERR_GENERAL_FAILURE W_ERROR(31) #define WERR_NOT_SUPPORTED W_ERROR(50) +#define WERR_BAD_NETPATH W_ERROR(53) #define WERR_PRINTQ_FULL W_ERROR(61) #define WERR_NO_SPOOL_SPACE W_ERROR(62) #define WERR_NO_SUCH_SHARE W_ERROR(67) diff --git a/source/include/dynconfig.h b/source/include/dynconfig.h index a74d77e41f7..b2fd7a29a2e 100644 --- a/source/include/dynconfig.h +++ b/source/include/dynconfig.h @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. Copyright (C) 2001 by Martin Pool <mbp@samba.org> - Copyright (C) 2003 by Jim McDonough <jmcd@us.ibm.com> + Copyright (C) 2003 by Anthony Liguori <aliguor@us.ibm.com> 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 @@ -25,11 +25,11 @@ **/ extern char const *dyn_SBINDIR, - *dyn_BINDIR, - *dyn_SWATDIR; + *dyn_BINDIR; extern pstring dyn_CONFIGFILE; -extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE; +extern const char *dyn_LOGFILEBASE; +extern pstring dyn_LMHOSTSFILE; extern pstring dyn_LIBDIR; extern const fstring dyn_SHLIBEXT; extern const pstring dyn_LOCKDIR; diff --git a/source/include/enums.h b/source/include/enums.h new file mode 100644 index 00000000000..5be158840f3 --- /dev/null +++ b/source/include/enums.h @@ -0,0 +1,64 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Andrew Tridgell 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* + this header declares basic enumerated types +*/ + +/* protocol types. It assumes that higher protocols include lower protocols + as subsets */ +enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; + +/* security levels */ +enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN,SEC_ADS}; + +/* server roles */ +enum server_types +{ + ROLE_STANDALONE, + ROLE_DOMAIN_MEMBER, + ROLE_DOMAIN_BDC, + ROLE_DOMAIN_PDC +}; + +/* printing types */ +enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, + PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ, + PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2 +#ifdef DEVELOPER +,PRINT_TEST,PRINT_VLP +#endif /* DEVELOPER */ +}; + +/* LDAP schema types */ +enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA}; + +/* LDAP SSL options */ +enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS}; + +/* LDAP PASSWD SYNC methods */ +enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY}; + +/* Remote architectures we know about. */ +enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_SAMBA}; + +/* case handling */ +enum case_handling {CASE_LOWER,CASE_UPPER}; + diff --git a/source/include/events.h b/source/include/events.h new file mode 100644 index 00000000000..7d04a38a051 --- /dev/null +++ b/source/include/events.h @@ -0,0 +1,75 @@ +/* + Unix SMB/CIFS implementation. + main select loop and event handling + Copyright (C) Andrew Tridgell 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* + please read the comments in events.c before modifying +*/ + +struct event_context { + /* list of filedescriptor events */ + struct fd_event { + struct fd_event *next, *prev; + int fd; + uint16 flags; /* see EVENT_FD_* flags */ + void (*handler)(struct event_context *ev, struct fd_event *fde, time_t t, uint16 flags); + void *private; + int ref_count; + } *fd_events; + + /* list of timed events */ + struct timed_event { + struct timed_event *next, *prev; + time_t next_event; + void (*handler)(struct event_context *ev, struct timed_event *te, time_t t); + void *private; + int ref_count; + } *timed_events; + + /* list of loop events - called on each select() */ + struct loop_event { + struct loop_event *next, *prev; + void (*handler)(struct event_context *ev, struct loop_event *le, time_t t); + void *private; + int ref_count; + } *loop_events; + + /* list of signal events */ + struct signal_event { + struct signal_event *next, *prev; + int signum; + void (*handler)(struct event_context *ev, struct signal_event *se, int signum, void *sigarg); + void *private; + int ref_count; + } *signal_events; + + /* the maximum file descriptor number in fd_events */ + int maxfd; + + /* information for exiting from the event loop */ + struct { + BOOL exit_now; + int code; + } exit; +}; + + +/* bits for fd_event.flags */ +#define EVENT_FD_READ 1 +#define EVENT_FD_WRITE 2 diff --git a/source/include/fake_file.h b/source/include/fake_file.h deleted file mode 100644 index 3fe60072e9e..00000000000 --- a/source/include/fake_file.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Unix SMB/CIFS implementation. - FAKE FILE suppport, for faking up special files windows want access to - Copyright (C) Stefan (metze) Metzmacher 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _FAKE_FILE_H -#define _FAKE_FILE_H - -enum FAKE_FILE_TYPE { - FAKE_FILE_TYPE_NONE = 0, - FAKE_FILE_TYPE_QUOTA -}; - -#define FAKE_FILE_NAME_QUOTA "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION" - -typedef struct _FAKE_FILE_HANDLE { - enum FAKE_FILE_TYPE type; - TALLOC_CTX *mem_ctx; - void *pd; /* for private data */ - void (*free_pd)(void **pd); /* free private_data */ -} FAKE_FILE_HANDLE; - -typedef struct _FAKE_FILE { - const char *name; - enum FAKE_FILE_TYPE type; - void *(*init_pd)(TALLOC_CTX *men_ctx); - void (*free_pd)(void **pd); -} FAKE_FILE; - - -#endif /* _FAKE_FILE_H */ diff --git a/source/include/genparser.h b/source/include/genparser.h index f28cd78249d..a2ca227cab3 100644 --- a/source/include/genparser.h +++ b/source/include/genparser.h @@ -16,6 +16,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#error SAMBA4 clean up +#error this file should be (re)moved +#error and all unused stuff should go + #ifndef _GENPARSER_H #define _GENPARSER_H diff --git a/source/include/genparser_samba.h b/source/include/genparser_samba.h index 213d51da876..1f5aeb582fe 100644 --- a/source/include/genparser_samba.h +++ b/source/include/genparser_samba.h @@ -16,6 +16,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#error SAMBA4 clean up +#error this file should be (re)moved +#error and all unused stuff should go + #ifndef _GENPARSER_SAMBA_H #define _GENPARSER_SAMBA_H @@ -55,9 +59,4 @@ const struct parse_struct pinfo_luid_attr_info[] = { {"luid", 1, sizeof(LUID), offsetof(struct LUID_ATTR, luid), 0, NULL, 0, gen_dump_LUID, gen_parse_LUID}, {NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL}}; -const struct parse_struct pinfo_data_blob_info[] = { -{"length", 0, sizeof(int), offsetof(DATA_BLOB, length), 0, NULL, 0, gen_dump_int, gen_parse_int}, -{"data", 1, sizeof(char), offsetof(DATA_BLOB, data), 0, "length", 0, gen_dump_char, gen_parse_char}, -{NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL}}; - #endif /* _GENPARSER_SAMBA_H */ diff --git a/source/include/gums.h b/source/include/gums.h deleted file mode 100644 index d16a839bc4b..00000000000 --- a/source/include/gums.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - Unix SMB/CIFS implementation. - GUMS structures - Copyright (C) Simo Sorce 2002 - - 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 _GUMS_H -#define _GUMS_H - -#define GUMS_VERSION_MAJOR 0 -#define GUMS_VERSION_MINOR 1 -#define GUMS_OBJECT_VERSION 1 -#define GUMS_PRIVILEGE_VERSION 1 -#define GUMS_INTERFACE_VERSION 1 - -#define GUMS_OBJ_DOMAIN 0x10 -#define GUMS_OBJ_NORMAL_USER 0x20 -#define GUMS_OBJ_GROUP 0x30 -#define GUMS_OBJ_ALIAS 0x31 - -/* define value types */ -#define GUMS_SET_PRIMARY_GROUP 0x1 -#define GUMS_SET_SEC_DESC 0x2 - -#define GUMS_SET_NAME 0x10 -#define GUMS_SET_DESCRIPTION 0x11 -#define GUMS_SET_FULL_NAME 0x12 - -/* user specific type values */ -#define GUMS_SET_LOGON_TIME 0x20 -#define GUMS_SET_LOGOFF_TIME 0x21 -#define GUMS_SET_KICKOFF_TIME 0x23 -#define GUMS_SET_PASS_LAST_SET_TIME 0x24 -#define GUMS_SET_PASS_CAN_CHANGE_TIME 0x25 -#define GUMS_SET_PASS_MUST_CHANGE_TIME 0x26 - - -#define GUMS_SET_HOME_DIRECTORY 0x31 -#define GUMS_SET_DRIVE 0x32 -#define GUMS_SET_LOGON_SCRIPT 0x33 -#define GUMS_SET_PROFILE_PATH 0x34 -#define GUMS_SET_WORKSTATIONS 0x35 -#define GUMS_SET_UNKNOWN_STRING 0x36 -#define GUMS_SET_MUNGED_DIAL 0x37 - -#define GUMS_SET_LM_PASSWORD 0x40 -#define GUMS_SET_NT_PASSWORD 0x41 -#define GUMS_SET_PLAINTEXT_PASSWORD 0x42 -#define GUMS_SET_UNKNOWN_3 0x43 -#define GUMS_SET_LOGON_DIVS 0x44 -#define GUMS_SET_HOURS_LEN 0x45 -#define GUMS_SET_HOURS 0x46 -#define GUMS_SET_BAD_PASSWORD_COUNT 0x47 -#define GUMS_SET_LOGON_COUNT 0x48 -#define GUMS_SET_UNKNOWN_6 0x49 - -#define GUMS_SET_MUST_CHANGE_PASS 0x50 -#define GUMS_SET_CANNOT_CHANGE_PASS 0x51 -#define GUMS_SET_PASS_NEVER_EXPIRE 0x52 -#define GUMS_SET_ACCOUNT_DISABLED 0x53 -#define GUMS_SET_ACCOUNT_LOCKOUT 0x54 - -/*group specific type values */ -#define GUMS_ADD_SID_LIST 0x60 -#define GUMS_DEL_SID_LIST 0x61 -#define GUMS_SET_SID_LIST 0x62 - -GENSTRUCT struct gums_user -{ - DOM_SID *group_sid; /* Primary Group SID */ - - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - char *full_name; _NULLTERM /* user's full name string */ - char *home_dir; _NULLTERM /* home directory string */ - char *dir_drive; _NULLTERM /* home directory drive string */ - char *logon_script; _NULLTERM /* logon script string */ - char *profile_path; _NULLTERM /* profile path string */ - char *workstations; _NULLTERM /* login from workstations string */ - char *unknown_str; _NULLTERM /* don't know what this is, yet. */ - char *munged_dial; _NULLTERM /* munged path name and dial-back tel number */ - - DATA_BLOB lm_pw; /* .data is Null if no password */ - DATA_BLOB nt_pw; /* .data is Null if no password */ - - uint16 acct_ctrl; /* account type & status flags */ - uint16 logon_divs; /* 168 - number of hours in a week */ - uint32 hours_len; /* normally 21 bytes */ - uint8 *hours; _LEN(hours_len) /* normally 21 bytes (depends on hours_len) */ - - uint16 bad_password_count; /* 0 */ - uint16 logon_count; /* 0 */ - uint32 unknown_3; /* 0x00ff ffff */ - uint32 unknown_6; /* 0x0000 04ec */ - -}; - -GENSTRUCT struct gums_group -{ - uint32 count; /* Number of SIDs */ - DOM_SID *members; _LEN(count) /* SID array */ - -}; - -GENSTRUCT struct gums_domain -{ - uint32 next_rid; - -}; - -GENSTRUCT struct gums_object -{ - TALLOC_CTX *mem_ctx; - - uint32 type; /* Object Type */ - uint32 version; /* Object Version */ - uint32 seq_num; /* Object Sequence Number */ - - SEC_DESC *sec_desc; /* Security Descriptor */ - - DOM_SID *sid; /* Object Sid */ - char *name; _NULLTERM /* Object Name - it should be in DOMAIN\NAME format */ - char *description; _NULLTERM /* Object Description */ - - struct gums_user *user; - struct gums_group *group; - struct gums_domain *domain; - -}; - -GENSTRUCT struct gums_privilege -{ - TALLOC_CTX *mem_ctx; - - uint32 version; /* Object Version */ - uint32 seq_num; /* Object Sequence Number */ - - char *name; _NULLTERM /* Object Name */ - char *description; _NULLTERM /* Object Description */ - - LUID_ATTR *privilege; /* Privilege Type */ - - uint32 count; - DOM_SID *members; _LEN(count) - -}; - -typedef struct gums_user GUMS_USER; -typedef struct gums_group GUMS_GROUP; -typedef struct gums_domain GUMS_DOMAIN; -typedef struct gums_object GUMS_OBJECT; -typedef struct gums_privilege GUMS_PRIVILEGE; - -typedef struct gums_data_set -{ - int type; /* GUMS_SET_xxx */ - void *data; - -} GUMS_DATA_SET; - -typedef struct gums_commit_set -{ - TALLOC_CTX *mem_ctx; - - uint32 type; /* Object type */ - DOM_SID sid; /* Object Sid */ - uint32 count; /* number of changes */ - GUMS_DATA_SET *data; - -} GUMS_COMMIT_SET; - -typedef struct gums_priv_commit_set -{ - TALLOC_CTX *mem_ctx; - - uint32 type; /* Object type */ - char *name; /* Object Sid */ - uint32 count; /* number of changes */ - GUMS_DATA_SET *data; - -} GUMS_PRIV_COMMIT_SET; - - -typedef struct gums_functions -{ - /* module data */ - TALLOC_CTX *mem_ctx; - char *name; - void *private_data; - void (*free_private_data)(void **); - - /* Generic object functions */ - - NTSTATUS (*get_domain_sid) (DOM_SID *sid, const char* name); - NTSTATUS (*set_domain_sid) (const DOM_SID *sid); - - NTSTATUS (*get_sequence_number) (void); - - NTSTATUS (*new_object) (DOM_SID *sid, const char *name, const int obj_type); - NTSTATUS (*delete_object) (const DOM_SID *sid); - - NTSTATUS (*get_object_from_sid) (GUMS_OBJECT **object, const DOM_SID *sid, const int obj_type); - NTSTATUS (*get_object_from_name) (GUMS_OBJECT **object, const char *domain, const char *name, const int obj_type); - /* This function is used to get the list of all objects changed since b_time, it is - used to support PDC<->BDC synchronization */ - NTSTATUS (*get_updated_objects) (GUMS_OBJECT **objects, const NTTIME base_time); - - NTSTATUS (*enumerate_objects_start) (void **handle, const DOM_SID *sid, const int obj_type); - NTSTATUS (*enumerate_objects_get_next) (GUMS_OBJECT **object, void *handle); - NTSTATUS (*enumerate_objects_stop) (void *handle); - - /* This function MUST be used ONLY by PDC<->BDC replication code or recovery tools. - Never use this function to update an object in the database, use set_object_values() */ - NTSTATUS (*set_object) (GUMS_OBJECT *object); - - /* set object values function */ - NTSTATUS (*set_object_values) (DOM_SID *sid, uint32 count, GUMS_DATA_SET *data_set); - - /* Group related functions */ - NTSTATUS (*add_members_to_group) (const DOM_SID *group, const DOM_SID **members); - NTSTATUS (*delete_members_from_group) (const DOM_SID *group, const DOM_SID **members); - NTSTATUS (*enumerate_group_members) (DOM_SID **members, const DOM_SID *sid, const int type); - - NTSTATUS (*get_sid_groups) (DOM_SID **groups, const DOM_SID *sid); - - NTSTATUS (*lock_sid) (const DOM_SID *sid); - NTSTATUS (*unlock_sid) (const DOM_SID *sid); - - /* privileges related functions */ - - NTSTATUS (*get_privilege) (GUMS_OBJECT **object, const char *name); - NTSTATUS (*add_members_to_privilege) (const char *name, const DOM_SID **members); - NTSTATUS (*delete_members_from_privilege) (const char *name, const DOM_SID **members); - NTSTATUS (*enumerate_privilege_members) (const char *name, DOM_SID **members); - NTSTATUS (*get_sid_privileges) (const DOM_SID *sid, const char **privs); - - /* warning!: set_privilege will overwrite a prior existing privilege if such exist */ - NTSTATUS (*set_privilege) (GUMS_PRIVILEGE *priv); - -} GUMS_FUNCTIONS; - -typedef NTSTATUS (*gums_init_function)( - struct gums_functions *, - const char *); - -struct gums_init_function_entry { - - const char *name; - gums_init_function init_fn; - struct gums_init_function_entry *prev, *next; -}; - -#endif /* _GUMS_H */ diff --git a/source/include/hash.h b/source/include/hash.h deleted file mode 100644 index 40cc8b7cab3..00000000000 --- a/source/include/hash.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Copyright (C) Ying Chen 2000. - - 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 _HASH_H_ -#define _HASH_H_ - -#define MAX_HASH_TABLE_SIZE 16384 -#define HASH_TABLE_INCREMENT 2 - -typedef int (*compare_function)(char *, char *); -typedef int (*hash_function)(int, char *); - -/* - * lru_link: links the node to the LRU list. - * hash_elem: the pointer to the element that is tied onto the link. - */ -typedef struct lru_node { - ubi_dlNode lru_link; - void *hash_elem; -} lru_node; - -/* - * bucket_link: link the hash element to the bucket chain that it belongs to. - * lru_link: this element ties the hash element to the lru list. - * bucket: a pointer to the hash bucket that this element belongs to. - * value: a pointer to the hash element content. It can be anything. - * key: stores the string key. The hash_element is always allocated with - * more memory space than the structure shown below to accomodate the space - * used for the whole string. But the memory is always appended at the - * end of the structure, so keep "key" at the end of the structure. - * Don't move it. - */ -typedef struct hash_element { - ubi_dlNode bucket_link; - lru_node lru_link; - ubi_dlList *bucket; - void *value; - char key[1]; -} hash_element; - -/* - * buckets: a list of buckets, implemented as a dLinkList. - * lru_chain: the lru list of all the hash elements. - * num_elements: the # of elements in the hash table. - * size: the hash table size. - * comp_func: the compare function used during hash key comparisons. - */ - -typedef struct hash_table { - ubi_dlList *buckets; - ubi_dlList lru_chain; - unsigned num_elements; - unsigned size; - compare_function comp_func; -} hash_table; - -#endif /* _HASH_H_ */ diff --git a/source/include/idmap.h b/source/include/idmap.h deleted file mode 100644 index 20b1015285e..00000000000 --- a/source/include/idmap.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _IDMAP_H_ -#define _IDMAP_H_ -/* - Unix SMB/CIFS implementation. - - Idmap headers - - Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 - Copyright (C) Simo Sorce 2003 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#define SMB_IDMAP_INTERFACE_VERSION 2 - - -#define ID_EMPTY 0x00 -#define ID_USERID 0x01 -#define ID_GROUPID 0x02 -#define ID_OTHER 0x04 - -#define ID_TYPEMASK 0x0f - -#define ID_QUERY_ONLY 0x10 - -/* Filled out by IDMAP backends */ -struct idmap_methods { - - /* Called when backend is first loaded */ - NTSTATUS (*init)( char *params ); - - NTSTATUS (*allocate_rid)(uint32 *rid, int rid_type); - NTSTATUS (*allocate_id)(unid_t *id, int id_type); - NTSTATUS (*get_sid_from_id)(DOM_SID *sid, unid_t id, int id_type); - NTSTATUS (*get_id_from_sid)(unid_t *id, int *id_type, const DOM_SID *sid); - NTSTATUS (*set_mapping)(const DOM_SID *sid, unid_t id, int id_type); - - /* Called when backend is unloaded */ - NTSTATUS (*close)(void); - - /* Called to dump backend status */ - void (*status)(void); -}; -#endif /* _IDMAP_H_ */ diff --git a/source/include/includes.h b/source/include/includes.h index dd93c813d3d..22414253231 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -45,6 +45,13 @@ #undef HAVE_TERMIOS_H #endif +#ifndef DEFAULT_PRINTING +#define DEFAULT_PRINTING PRINT_BSD +#endif +#ifndef PRINTCAP_NAME +#define PRINTCAP_NAME "/etc/printcap" +#endif + #ifdef __GNUC__ /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first @@ -324,23 +331,18 @@ #define PASSWORD_LENGTH 16 #endif /* HAVE_SYS_SECURITY_H */ -#ifdef HAVE_STROPTS_H -#include <stropts.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> #endif -#ifdef HAVE_POLL_H -#include <poll.h> -#endif - -#ifdef HAVE_EXECINFO_H -#include <execinfo.h> +#ifdef HAVE_STROPTS_H +#include <stropts.h> #endif #ifdef HAVE_SYS_CAPABILITY_H -#if defined(BROKEN_REDHAT_7_SYSTEM_HEADERS) && !defined(_I386_STATFS_H) && !defined(_PPC_STATFS_H) +#if defined(BROKEN_REDHAT_7_SYSTEM_HEADERS) && !defined(_I386_STATFS_H) #define _I386_STATFS_H -#define _PPC_STATFS_H #define BROKEN_REDHAT_7_STATFS_WORKAROUND #endif @@ -348,35 +350,11 @@ #ifdef BROKEN_REDHAT_7_STATFS_WORKAROUND #undef _I386_STATFS_H -#undef _PPC_STATFS_H #undef BROKEN_REDHAT_7_STATFS_WORKAROUND #endif #endif -#if defined(HAVE_RPC_RPC_H) -/* - * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h. - */ -#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT) -#undef AUTH_ERROR -#endif -#include <rpc/rpc.h> -#endif - -#if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT) -#define HAVE_NETGROUP 1 -#endif - -#if defined (HAVE_NETGROUP) -#if defined(HAVE_RPCSVC_YP_PROT_H) -#include <rpcsvc/yp_prot.h> -#endif -#if defined(HAVE_RPCSVC_YPCLNT_H) -#include <rpcsvc/ypclnt.h> -#endif -#endif /* HAVE_NETGROUP */ - #if defined(HAVE_SYS_IPC_H) #include <sys/ipc.h> #endif /* HAVE_SYS_IPC_H */ @@ -392,9 +370,6 @@ #ifdef HAVE_GICONV #include <giconv.h> #endif -#ifdef HAVE_BICONV -#include <biconv.h> -#endif #endif #if HAVE_KRB5_H @@ -429,42 +404,6 @@ #include <com_err.h> #endif -#if HAVE_SYS_ATTRIBUTES_H -#include <sys/attributes.h> -#endif - -/* mutually exclusive (SuSE 8.2) */ -#if HAVE_ATTR_XATTR_H -#include <attr/xattr.h> -#elif HAVE_SYS_XATTR_H -#include <sys/xattr.h> -#endif - -#if HAVE_LOCALE_H -#include <locale.h> -#endif - -#if HAVE_LANGINFO_H -#include <langinfo.h> -#endif - -/* Special macros that are no-ops except when run under Valgrind on - * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */ -#if HAVE_VALGRIND_MEMCHECK_H - /* memcheck.h includes valgrind.h */ -#include <valgrind/memcheck.h> -#elif HAVE_VALGRIND_H -#include <valgrind.h> -#endif - -/* If we have --enable-developer and the valgrind header is present, - * then we're OK to use it. Set a macro so this logic can be done only - * once. */ -#if defined(DEVELOPER) && (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H) -#define VALGRIND -#endif - - /* we support ADS if we want it and have krb5 and ldap libs */ #if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP) #define HAVE_ADS @@ -483,12 +422,8 @@ /* * Define additional missing types */ -#if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX) -typedef sig_atomic_t SIG_ATOMIC_T; -#elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX) -typedef sig_atomic_t VOLATILE SIG_ATOMIC_T; -#else -typedef int VOLATILE SIG_ATOMIC_T; +#ifndef HAVE_SIG_ATOMIC_T_TYPE +typedef int sig_atomic_t; #endif #ifndef HAVE_SOCKLEN_T_TYPE @@ -519,7 +454,7 @@ typedef int socklen_t; #define uint8 unsigned char #endif -#if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H) +#if !defined(int16) #if (SIZEOF_SHORT == 4) #define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16; #else /* SIZEOF_SHORT != 4 */ @@ -527,12 +462,8 @@ typedef int socklen_t; #endif /* SIZEOF_SHORT != 4 */ #endif -/* - * Note we duplicate the size tests in the unsigned - * case as int16 may be a typedef from rpc/rpc.h - */ -#if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H) +#if !defined(uint16) #if (SIZEOF_SHORT == 4) #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16; #else /* SIZEOF_SHORT != 4 */ @@ -540,7 +471,7 @@ typedef int socklen_t; #endif /* SIZEOF_SHORT != 4 */ #endif -#if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H) +#if !defined(int32) #if (SIZEOF_INT == 4) #define int32 int #elif (SIZEOF_LONG == 4) @@ -553,12 +484,8 @@ typedef int socklen_t; #endif #endif -/* - * Note we duplicate the size tests in the unsigned - * case as int32 may be a typedef from rpc/rpc.h - */ -#if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H) +#if !defined(uint32) #if (SIZEOF_INT == 4) #define uint32 unsigned int #elif (SIZEOF_LONG == 4) @@ -615,18 +542,6 @@ typedef int socklen_t; # endif #endif -#if defined(HAVE_LONGLONG) -#define SMB_BIG_UINT unsigned long long -#define SMB_BIG_INT long long -#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32)) -#else -#define SMB_BIG_UINT unsigned long -#define SMB_BIG_INT long -#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0)) -#endif - -#define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8) - /* this should really be a 64 bit type if possible */ #define br_off SMB_BIG_UINT @@ -675,9 +590,9 @@ typedef int socklen_t; #ifndef SMB_STRUCT_DIRENT # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64) -# define SMB_STRUCT_DIRENT struct dirent64 +# define smb_dirent dirent64 # else -# define SMB_STRUCT_DIRENT struct dirent +# define smb_dirent dirent # endif #endif @@ -717,6 +632,20 @@ typedef int socklen_t; # endif #endif +#if defined(HAVE_LONGLONG) +#define SMB_BIG_UINT unsigned long long +#define SMB_BIG_INT long long +#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32)) +#define BVAL(p, ofs) (IVAL(p,ofs) | (((SMB_BIG_UINT)IVAL(p,(ofs)+4)) << 32)) +#else +#define SMB_BIG_UINT unsigned long +#define SMB_BIG_INT long +#define SBVAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0)) +#define BVAL(p, ofs) IVAL(p,ofs) +#endif + +#define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8) + #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif @@ -749,84 +678,42 @@ extern int errno; /* Lists, trees, caching, database... */ #include "xfile.h" -#include "intl.h" -#include "ubi_sLinkList.h" -#include "ubi_dLinkList.h" #include "dlinklist.h" -#include "../tdb/tdb.h" -#include "../tdb/spinlock.h" -#include "../tdb/tdbutil.h" +#include "lib/tdb/tdb.h" +#include "lib/tdb/spinlock.h" +#include "lib/tdb/tdbutil.h" #include "talloc.h" #include "nt_status.h" -#include "ads.h" #include "interfaces.h" -#include "hash.h" #include "trans2.h" +#include "ioctl.h" #include "nterr.h" -#include "ntioctl.h" #include "messages.h" #include "charset.h" #include "dynconfig.h" -#include "adt_tree.h" #include "util_getent.h" -#ifndef UBI_BINTREE_H -#include "ubi_Cache.h" -#endif /* UBI_BINTREE_H */ - -#include "debugparse.h" - #include "version.h" - -#include "privileges.h" - #include "smb.h" - +#include "ads.h" #include "nameserv.h" - #include "secrets.h" #include "byteorder.h" -#include "rpc_creds.h" - -#include "mapping.h" - -#include "passdb.h" - -#include "ntdomain.h" - -#include "rpc_misc.h" - -#include "rpc_secdes.h" - -#include "genparser.h" - -#include "gums.h" - -#include "nt_printing.h" - #include "msdfs.h" -#include "smbprofile.h" - -#include "rap.h" - #include "md5.h" #include "hmacmd5.h" -#include "ntlmssp.h" - -#include "auth.h" +#include "libcli/auth/ntlmssp.h" +#include "libcli/auth/schannel.h" -#include "idmap.h" +#include "auth/auth.h" +#include "passdb/passdb.h" -#include "client.h" - -#include "smbw.h" - -#include "session.h" +#include "module.h" #include "asn_1.h" @@ -834,34 +721,17 @@ extern int errno; #include "mangle.h" -#include "module.h" - #include "nsswitch/winbind_client.h" -#include "spnego.h" +#include "mutex.h" -/* - * Type for wide character dirent structure. - * Only d_name is defined by POSIX. - */ +#include "librpc/rpc/dcerpc.h" -typedef struct smb_wdirent { - wpstring d_name; -} SMB_STRUCT_WDIRENT; - -/* - * Type for wide character passwd structure. - */ +#include "rpc_server/dcerpc_server.h" +#include "context.h" +#include "ntvfs/ntvfs.h" +#include "cli_context.h" -typedef struct smb_wpasswd { - wfstring pw_name; - char *pw_passwd; - uid_t pw_uid; - gid_t pw_gid; - wpstring pw_gecos; - wpstring pw_dir; - wpstring pw_shell; -} SMB_STRUCT_WPASSWD; /* used in net.c */ struct functable { @@ -870,35 +740,13 @@ struct functable { }; -/* Defines for wisXXX functions. */ -#define UNI_UPPER 0x1 -#define UNI_LOWER 0x2 -#define UNI_DIGIT 0x4 -#define UNI_XDIGIT 0x8 -#define UNI_SPACE 0x10 - -#include "nsswitch/winbind_nss.h" - -/* forward declaration from printing.h to get around - header file dependencies */ - -struct printjob; - -struct smb_ldap_privates; - -/* forward declarations from smbldap.c */ - -#include "smbldap.h" -#include "modconf.h" +#include "nsswitch/nss.h" /***** automatically generated prototypes *****/ -#ifndef NO_PROTO_H #include "proto.h" -#endif /* String routines */ -#include "srvstr.h" #include "safe_string.h" #ifdef __COMPAR_FN_T @@ -909,35 +757,18 @@ struct smb_ldap_privates; #define QSORT_CAST (int (*)(const void *, const void *)) #endif -#ifndef DEFAULT_PRINTING -#ifdef HAVE_CUPS -#define DEFAULT_PRINTING PRINT_CUPS -#define PRINTCAP_NAME "cups" -#elif defined(SYSV) -#define DEFAULT_PRINTING PRINT_SYSV -#define PRINTCAP_NAME "lpstat" -#else -#define DEFAULT_PRINTING PRINT_BSD -#define PRINTCAP_NAME "/etc/printcap" -#endif -#endif - -#ifndef PRINTCAP_NAME -#define PRINTCAP_NAME "/etc/printcap" -#endif - #ifndef SIGCLD #define SIGCLD SIGCHLD #endif -#ifndef SIGRTMIN -#define SIGRTMIN 32 -#endif - #ifndef MAP_FILE #define MAP_FILE 0 #endif +#if (!defined(WITH_LDAP) && !defined(WITH_TDB_SAM)) +#define USE_SMBPASS_DB 1 +#endif + #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS) #define OSF1_ENH_SEC 1 #endif @@ -962,6 +793,10 @@ struct smb_ldap_privates; #define SYNC_DNS 1 #endif +#ifndef MAXPATHLEN +#define MAXPATHLEN 256 +#endif + #ifndef SEEK_SET #define SEEK_SET 0 #endif @@ -990,10 +825,6 @@ struct smb_ldap_privates; char *strdup(const char *s); #endif -#ifndef HAVE_STRNDUP -char *strndup(const char *s, size_t size); -#endif - #ifndef HAVE_MEMMOVE void *memmove(void *dest,const void *src,int size); #endif @@ -1049,6 +880,10 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid); int vasprintf(char **ptr, const char *format, va_list ap); #endif +#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET) +#define bzero(a,b) memset((a),'\0',(b)) +#endif + #ifdef REPLACE_GETPASS #define getpass(prompt) getsmbpass((prompt)) #endif @@ -1238,14 +1073,6 @@ int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4); int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3); #endif -/* Fix prototype problem with non-C99 compliant snprintf implementations, esp - HPUX 11. Don't change the sense of this #if statement. Read the comments - in lib/snprint.c if you think you need to. See also bugzilla bug 174. */ - -#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF) -#define snprintf smb_snprintf -#endif - void sys_adminlog(int priority, const char *format_str, ...) PRINTF_ATTRIBUTE(2,3); int pstr_sprintf(pstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); @@ -1263,19 +1090,19 @@ int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE( /* we need to use __va_copy() on some platforms */ #ifdef HAVE_VA_COPY -#define VA_COPY(dest, src) va_copy(dest, src) -#else -#ifdef HAVE___VA_COPY #define VA_COPY(dest, src) __va_copy(dest, src) #else #define VA_COPY(dest, src) (dest) = (src) #endif -#endif #ifndef HAVE_TIMEGM time_t timegm(struct tm *tm); #endif +#if defined(VALGRIND) +#define strlen(x) valgrind_strlen(x) +#endif + /* * Veritas File System. Often in addition to native. * Quotas different. @@ -1284,50 +1111,5 @@ time_t timegm(struct tm *tm); #define VXFS_QUOTA #endif -#if defined(HAVE_KRB5) - -#ifndef HAVE_KRB5_SET_REAL_TIME -krb5_error_code krb5_set_real_time(krb5_context context, int32_t seconds, int32_t microseconds); -#endif - -#ifndef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES -krb5_error_code krb5_set_default_tgs_ktypes(krb5_context ctx, const krb5_enctype *enc); -#endif - -#if defined(HAVE_KRB5_AUTH_CON_SETKEY) && !defined(HAVE_KRB5_AUTH_CON_SETUSERUSERKEY) -krb5_error_code krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock); -#endif - -/* Samba wrapper function for krb5 functionality. */ -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); -void get_auth_data_from_tkt(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); -void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); -BOOL get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, DATA_BLOB *session_key, BOOL remote); -#endif /* HAVE_KRB5 */ - -/* TRUE and FALSE are part of the C99 standard and gcc, but - unfortunately many vendor compilers don't support them. Use True - and False instead. */ - -#ifdef TRUE -#undef TRUE -#endif -#define TRUE __ERROR__XX__DONT_USE_TRUE - -#ifdef FALSE -#undef FALSE -#endif -#define FALSE __ERROR__XX__DONT_USE_FALSE - -/* If we have blacklisted mmap() try to avoid using it accidentally by - undefining the HAVE_MMAP symbol. */ - -#ifdef MMAP_BLACKLIST -#undef HAVE_MMAP -#endif - #endif /* _INCLUDES_H */ + diff --git a/source/include/intl.h b/source/include/intl.h deleted file mode 100644 index 01fa3bad976..00000000000 --- a/source/include/intl.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Unix SMB/CIFS implementation. - internationalisation headers - Copyright (C) Andrew Tridgell 2001 - - 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. -*/ - - -/* ideally we would have a static mapping, but that precludes - dynamic loading. This is a reasonable compromise */ -#define _(x) lang_msg_rotate(x) -#define N_(x) (x) diff --git a/source/include/rpc_client.h b/source/include/ioctl.h index bce9ec7f273..272004d3dc9 100644 --- a/source/include/rpc_client.h +++ b/source/include/ioctl.h @@ -1,7 +1,8 @@ /* Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Elrond 2000 + ioctl and fsctl definitions + + Copyright (C) Andrew Tridgell 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,11 +19,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _RPC_CLIENT_H -#define _RPC_CLIENT_H -#if 0 /* JERRY */ -#include "rpc_client_proto.h" -#endif +/* ioctl codes */ +#define IOCTL_QUERY_JOB_INFO 0x530060 + + +/* filesystem control codes */ +#define FSCTL_FILESYSTEM 0x90000 +#define FSCTL_SET_SPARSE (FSCTL_FILESYSTEM | 0xc4) -#endif /* _RPC_CLIENT_H */ diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h deleted file mode 100644 index 21fe47d4b29..00000000000 --- a/source/include/libsmb_internal.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _LIBSMB_INTERNAL_H_ -#define _LIBSMB_INTERNAL_H_ - -#define SMBC_MAX_NAME 1023 -#define SMBC_FILE_MODE (S_IFREG | 0444) -#define SMBC_DIR_MODE (S_IFDIR | 0555) - - -#include "../include/libsmbclient.h" - - -struct _SMBCSRV { - struct cli_state cli; - dev_t dev; - BOOL no_pathinfo2; - int server_fd; - - SMBCSRV *next, *prev; - -}; - -/* - * Keep directory entries in a list - */ -struct smbc_dir_list { - struct smbc_dir_list *next; - struct smbc_dirent *dirent; -}; - - -/* - * Structure for open file management - */ -struct _SMBCFILE { - int cli_fd; - char *fname; - off_t offset; - struct _SMBCSRV *srv; - BOOL file; - struct smbc_dir_list *dir_list, *dir_end, *dir_next; - int dir_type, dir_error; - - SMBCFILE *next, *prev; -}; - - -struct smbc_internal_data { - - /** INTERNAL: is this handle initialized ? - */ - int _initialized; - - /** INTERNAL: dirent pointer location - */ - char _dirent[512]; - - /** INTERNAL: server connection list - */ - SMBCSRV * _servers; - - /** INTERNAL: open file/dir list - */ - SMBCFILE * _files; -}; - - -#endif diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h deleted file mode 100644 index 68c4a053d1b..00000000000 --- a/source/include/libsmbclient.h +++ /dev/null @@ -1,1947 +0,0 @@ -/*===================================================================== - Unix SMB/Netbios implementation. - SMB client library API definitions - Copyright (C) Andrew Tridgell 1998 - Copyright (C) Richard Sharpe 2000 - Copyright (C) John Terpsra 2000 - Copyright (C) Tom Jansen (Ninja ISD) 2002 - Copyright (C) Derrell Lipman 2003 - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - =====================================================================*/ - -#ifndef SMBCLIENT_H_INCLUDED -#define SMBCLIENT_H_INCLUDED - -/*-------------------------------------------------------------------*/ -/* The following are special comments to instruct DOXYGEN (automated - * documentation tool: -*/ -/** \defgroup libsmbclient -*/ -/** \defgroup structure Data Structures Type and Constants -* \ingroup libsmbclient -* Data structures, types, and constants -*/ -/** \defgroup callback Callback function types -* \ingroup libsmbclient -* Callback functions -*/ -/** \defgroup file File Functions -* \ingroup libsmbclient -* Functions used to access individual file contents -*/ -/** \defgroup directory Directory Functions -* \ingroup libsmbclient -* Functions used to access directory entries -*/ -/** \defgroup attribute Attributes Functions -* \ingroup libsmbclient -* Functions used to view or change file and directory attributes -*/ -/** \defgroup print Print Functions -* \ingroup libsmbclient -* Functions used to access printing functionality -*/ -/** \defgroup misc Miscellaneous Functions -* \ingroup libsmbclient -* Functions that don't fit in to other categories -*/ -/*-------------------------------------------------------------------*/ - -/* Make sure we have the following includes for now ... */ -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <utime.h> - -#define SMBC_BASE_FD 10000 /* smallest file descriptor returned */ - -#define SMBC_WORKGROUP 1 -#define SMBC_SERVER 2 -#define SMBC_FILE_SHARE 3 -#define SMBC_PRINTER_SHARE 4 -#define SMBC_COMMS_SHARE 5 -#define SMBC_IPC_SHARE 6 -#define SMBC_DIR 7 -#define SMBC_FILE 8 -#define SMBC_LINK 9 - -/**@ingroup structure - * Structure that represents a directory entry. - * - */ -struct smbc_dirent -{ - /** Type of entity. - SMBC_WORKGROUP=1, - SMBC_SERVER=2, - SMBC_FILE_SHARE=3, - SMBC_PRINTER_SHARE=4, - SMBC_COMMS_SHARE=5, - SMBC_IPC_SHARE=6, - SMBC_DIR=7, - SMBC_FILE=8, - SMBC_LINK=9,*/ - unsigned int smbc_type; - - /** Length of this smbc_dirent in bytes - */ - unsigned int dirlen; - /** The length of the comment string in bytes (includes null - * terminator) - */ - unsigned int commentlen; - /** Points to the null terminated comment string - */ - char *comment; - /** The length of the name string in bytes (includes null - * terminator) - */ - unsigned int namelen; - /** Points to the null terminated name string - */ - char name[1]; -}; - -/* - * Flags for smbc_setxattr() - * Specify a bitwise OR of these, or 0 to add or replace as necessary - */ -#define SMBC_XATTR_FLAG_CREATE 0x1 /* fail if attr already exists */ -#define SMBC_XATTR_FLAG_REPLACE 0x2 /* fail if attr does not exist */ - - -#ifndef ENOATTR -# define ENOATTR ENOENT /* No such attribute */ -#endif - - - - -/**@ingroup structure - * Structure that represents a print job. - * - */ -#ifndef _CLIENT_H -struct print_job_info -{ - /** numeric ID of the print job - */ - unsigned short id; - - /** represents print job priority (lower numbers mean higher priority) - */ - unsigned short priority; - - /** Size of the print job - */ - size_t size; - - /** Name of the user that owns the print job - */ - char user[128]; - - /** Name of the print job. This will have no name if an anonymous print - * file was opened. Ie smb://server/printer - */ - char name[128]; - - /** Time the print job was spooled - */ - time_t t; -}; -#endif /* _CLIENT_H */ - - -/**@ingroup structure - * Server handle - */ -typedef struct _SMBCSRV SMBCSRV; - -/**@ingroup structure - * File or directory handle - */ -typedef struct _SMBCFILE SMBCFILE; - -/**@ingroup structure - * File or directory handle - */ -typedef struct _SMBCCTX SMBCCTX; - - - - - -/**@ingroup callback - * Authentication callback function type. - * - * Type for the the authentication function called by the library to - * obtain authentication credentals - * - * @param srv Server being authenticated to - * - * @param shr Share being authenticated to - * - * @param wg Pointer to buffer containing a "hint" for the - * workgroup to be authenticated. Should be filled in - * with the correct workgroup if the hint is wrong. - * - * @param wglen The size of the workgroup buffer in bytes - * - * @param un Pointer to buffer containing a "hint" for the - * user name to be use for authentication. Should be - * filled in with the correct workgroup if the hint is - * wrong. - * - * @param unlen The size of the username buffer in bytes - * - * @param pw Pointer to buffer containing to which password - * copied - * - * @param pwlen The size of the password buffer in bytes - * - */ -typedef void (*smbc_get_auth_data_fn)(const char *srv, - const char *shr, - char *wg, int wglen, - char *un, int unlen, - char *pw, int pwlen); - - -/**@ingroup callback - * Print job info callback function type. - * - * @param i pointer to print job information structure - * - */ -typedef void (*smbc_list_print_job_fn)(struct print_job_info *i); - - -/**@ingroup callback - * Check if a server is still good - * - * @param c pointer to smb context - * - * @param srv pointer to server to check - * - * @return 0 when connection is good. 1 on error. - * - */ -typedef int (*smbc_check_server_fn)(SMBCCTX * c, SMBCSRV *srv); - -/**@ingroup callback - * Remove a server if unused - * - * @param c pointer to smb context - * - * @param srv pointer to server to remove - * - * @return 0 on success. 1 on failure. - * - */ -typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv); - - -/**@ingroup callback - * Add a server to the cache system - * - * @param c pointer to smb context - * - * @param srv pointer to server to add - * - * @param server server name - * - * @param share share name - * - * @param workgroup workgroup used to connect - * - * @param username username used to connect - * - * @return 0 on success. 1 on failure. - * - */ -typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv, - const char * server, const char * share, - const char * workgroup, const char * username); - -/**@ingroup callback - * Look up a server in the cache system - * - * @param c pointer to smb context - * - * @param server server name to match - * - * @param share share name to match - * - * @param workgroup workgroup to match - * - * @param username username to match - * - * @return pointer to SMBCSRV on success. NULL on failure. - * - */ -typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server, - const char * share, const char * workgroup, - const char * username); - -/**@ingroup callback - * Check if a server is still good - * - * @param c pointer to smb context - * - * @param srv pointer to server to remove - * - * @return 0 when found and removed. 1 on failure. - * - */ -typedef int (*smbc_remove_cached_srv_fn)(SMBCCTX * c, SMBCSRV *srv); - - -/**@ingroup callback - * Try to remove all servers from the cache system and disconnect - * - * @param c pointer to smb context - * - * @return 0 when found and removed. 1 on failure. - * - */ -typedef int (*smbc_purge_cached_fn) (SMBCCTX * c); - - - - -/**@ingroup structure - * Structure that contains a client context information - * This structure is know as SMBCCTX - */ -struct _SMBCCTX { - /** debug level - */ - int debug; - - /** netbios name used for making connections - */ - char * netbios_name; - - /** workgroup name used for making connections - */ - char * workgroup; - - /** username used for making connections - */ - char * user; - - /** timeout used for waiting on connections / response data (in milliseconds) - */ - int timeout; - - /** callable functions for files: - * For usage and return values see the smbc_* functions - */ - SMBCFILE * (*open) (SMBCCTX *c, const char *fname, int flags, mode_t mode); - SMBCFILE * (*creat) (SMBCCTX *c, const char *path, mode_t mode); - ssize_t (*read) (SMBCCTX *c, SMBCFILE *file, void *buf, size_t count); - ssize_t (*write) (SMBCCTX *c, SMBCFILE *file, void *buf, size_t count); - int (*unlink) (SMBCCTX *c, const char *fname); - int (*rename) (SMBCCTX *ocontext, const char *oname, - SMBCCTX *ncontext, const char *nname); - off_t (*lseek) (SMBCCTX *c, SMBCFILE * file, off_t offset, int whence); - int (*stat) (SMBCCTX *c, const char *fname, struct stat *st); - int (*fstat) (SMBCCTX *c, SMBCFILE *file, struct stat *st); - int (*close) (SMBCCTX *c, SMBCFILE *file); - - /** callable functions for dirs - */ - SMBCFILE * (*opendir) (SMBCCTX *c, const char *fname); - int (*closedir)(SMBCCTX *c, SMBCFILE *dir); - struct smbc_dirent * (*readdir)(SMBCCTX *c, SMBCFILE *dir); - int (*getdents)(SMBCCTX *c, SMBCFILE *dir, - struct smbc_dirent *dirp, int count); - int (*mkdir) (SMBCCTX *c, const char *fname, mode_t mode); - int (*rmdir) (SMBCCTX *c, const char *fname); - off_t (*telldir) (SMBCCTX *c, SMBCFILE *dir); - int (*lseekdir)(SMBCCTX *c, SMBCFILE *dir, off_t offset); - int (*fstatdir)(SMBCCTX *c, SMBCFILE *dir, struct stat *st); - int (*chmod)(SMBCCTX *c, const char *fname, mode_t mode); - int (*utimes)(SMBCCTX *c, - const char *fname, struct timeval *tbuf); - int (*setxattr)(SMBCCTX *context, - const char *fname, - const char *name, - const void *value, - size_t size, - int flags); - int (*getxattr)(SMBCCTX *context, - const char *fname, - const char *name, - const void *value, - size_t size); - int (*removexattr)(SMBCCTX *context, - const char *fname, - const char *name); - int (*listxattr)(SMBCCTX *context, - const char *fname, - char *list, - size_t size); - - /** callable functions for printing - */ - int (*print_file)(SMBCCTX *c_file, const char *fname, - SMBCCTX *c_print, const char *printq); - SMBCFILE * (*open_print_job)(SMBCCTX *c, const char *fname); - int (*list_print_jobs)(SMBCCTX *c, const char *fname, smbc_list_print_job_fn fn); - int (*unlink_print_job)(SMBCCTX *c, const char *fname, int id); - - - /** Callbacks - * These callbacks _always_ have to be initialized because they will not be checked - * at dereference for increased speed. - */ - struct _smbc_callbacks { - /** authentication function callback: called upon auth requests - */ - smbc_get_auth_data_fn auth_fn; - - /** check if a server is still good - */ - smbc_check_server_fn check_server_fn; - - /** remove a server if unused - */ - smbc_remove_unused_server_fn remove_unused_server_fn; - - /** Cache subsystem - * For an example cache system see samba/source/libsmb/libsmb_cache.c - * Cache subsystem functions follow. - */ - - /** server cache addition - */ - smbc_add_cached_srv_fn add_cached_srv_fn; - - /** server cache lookup - */ - smbc_get_cached_srv_fn get_cached_srv_fn; - - /** server cache removal - */ - smbc_remove_cached_srv_fn remove_cached_srv_fn; - - /** server cache purging, try to remove all cached servers (disconnect) - */ - smbc_purge_cached_fn purge_cached_fn; - } callbacks; - - - /** Space to store private data of the server cache. - */ - struct smbc_server_cache * server_cache; - - /** INTERNAL DATA - * do _NOT_ touch this from your program ! - */ - struct smbc_internal_data * internal; - -}; - - -/**@ingroup misc - * Create a new SBMCCTX (a context). - * - * Must be called before the context is passed to smbc_context_init() - * - * @return The given SMBCCTX pointer on success, NULL on error with errno set: - * - ENOMEM Out of memory - * - * @see smbc_free_context(), smbc_init_context() - * - * @note Do not forget to smbc_init_context() the returned SMBCCTX pointer ! - */ -SMBCCTX * smbc_new_context(void); - -/**@ingroup misc - * Delete a SBMCCTX (a context) acquired from smbc_new_context(). - * - * The context will be deleted if possible. - * - * @param context A pointer to a SMBCCTX obtained from smbc_new_context() - * - * @param shutdown_ctx If 1, all connections and files will be closed even if they are busy. - * - * - * @return Returns 0 on succes. Returns 1 on failure with errno set: - * - EBUSY Server connections are still used, Files are open or cache - * could not be purged - * - EBADF context == NULL - * - * @see smbc_new_context() - * - * @note It is advised to clean up all the contexts with shutdown_ctx set to 1 - * just before exit()'ing. When shutdown_ctx is 0, this function can be - * use in periodical cleanup functions for example. - */ -int smbc_free_context(SMBCCTX * context, int shutdown_ctx); - - -/**@ingroup misc - * Initialize a SBMCCTX (a context). - * - * Must be called before using any SMBCCTX API function - * - * @param context A pointer to a SMBCCTX obtained from smbc_new_context() - * - * @return A pointer to the given SMBCCTX on success, NULL on error with errno set: - * - EBADF NULL context given - * - ENOMEM Out of memory - * - ENOENT The smb.conf file would not load - * - * @see smbc_new_context() - * - * @note my_context = smbc_init_context(smbc_new_context()) is perfectly safe, - * but it might leak memory on smbc_context_init() failure. Avoid this. - * You'll have to call smbc_free_context() yourself on failure. - */ - -SMBCCTX * smbc_init_context(SMBCCTX * context); - -/**@ingroup misc - * Initialize the samba client library. - * - * Must be called before using any of the smbclient API function - * - * @param fn The function that will be called to obtaion - * authentication credentials. - * - * @param debug Allows caller to set the debug level. Can be - * changed in smb.conf file. Allows caller to set - * debugging if no smb.conf. - * - * @return 0 on success, < 0 on error with errno set: - * - ENOMEM Out of memory - * - ENOENT The smb.conf file would not load - * - */ - -int smbc_init(smbc_get_auth_data_fn fn, int debug); - -/**@ingroup misc - * Set or retrieve the compatibility library's context pointer - * - * @param context New context to use, or NULL. If a new context is provided, - * it must have allocated with smbc_new_context() and - * initialized with smbc_init_context(), followed, optionally, - * by some manual changes to some of the non-internal fields. - * - * @return The old context. - * - * @see smbc_new_context(), smbc_init_context(), smbc_init() - * - * @note This function may be called prior to smbc_init() to force - * use of the next context without any internal calls to - * smbc_new_context() or smbc_init_context(). It may also - * be called after smbc_init() has already called those two - * functions, to replace the existing context with a new one. - * Care should be taken, in this latter case, to ensure that - * the server cache and any data allocated by the - * authentication functions have been freed, if necessary. - */ - -SMBCCTX * smbc_set_context(SMBCCTX * new_context); - -/**@ingroup file - * Open a file on an SMB server. - * - * @param furl The smb url of the file to be opened. - * - * @param flags Is one of O_RDONLY, O_WRONLY or O_RDWR which - * request opening the file read-only,write-only - * or read/write. flags may also be bitwise-or'd with - * one or more of the following: - * O_CREAT - If the file does not exist it will be - * created. - * O_EXCL - When used with O_CREAT, if the file - * already exists it is an error and the open will - * fail. - * O_TRUNC - If the file already exists it will be - * truncated. - * O_APPEND The file is opened in append mode - * - * @param mode mode specifies the permissions to use if a new - * file is created. It is modified by the - * process's umask in the usual way: the permissions - * of the created file are (mode & ~umask) - * - * Not currently use, but there for future use. - * We will map this to SYSTEM, HIDDEN, etc bits - * that reverses the mapping that smbc_fstat does. - * - * @return Valid file handle, < 0 on error with errno set: - * - ENOMEM Out of memory - * - EINVAL if an invalid parameter passed, like no - * file, or smbc_init not called. - * - EEXIST pathname already exists and O_CREAT and - * O_EXCL were used. - * - EISDIR pathname refers to a directory and - * the access requested involved writing. - * - EACCES The requested access to the file is not - * allowed - * - ENODEV The requested share does not exist - * - ENOTDIR A file on the path is not a directory - * - ENOENT A directory component in pathname does - * not exist. - * - * @see smbc_creat() - * - * @note This call uses an underlying routine that may create - * a new connection to the server specified in the URL. - * If the credentials supplied in the URL, or via the - * auth_fn in the smbc_init call, fail, this call will - * try again with an empty username and password. This - * often gets mapped to the guest account on some machines. - */ - -int smbc_open(const char *furl, int flags, mode_t mode); - -/**@ingroup file - * Create a file on an SMB server. - * - * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC - * - * @param furl The smb url of the file to be created - * - * @param mode mode specifies the permissions to use if a new - * file is created. It is modified by the - * process's umask in the usual way: the permissions - * of the created file are (mode & ~umask) - * - * NOTE, the above is not true. We are dealing with - * an SMB server, which has no concept of a umask! - * - * @return Valid file handle, < 0 on error with errno set: - * - ENOMEM Out of memory - * - EINVAL if an invalid parameter passed, like no - * file, or smbc_init not called. - * - EEXIST pathname already exists and O_CREAT and - * O_EXCL were used. - * - EISDIR pathname refers to a directory and - * the access requested involved writing. - * - EACCES The requested access to the file is not - * allowed - * - ENOENT A directory component in pathname does - * not exist. - * - ENODEV The requested share does not exist. - * @see smbc_open() - * - */ - -int smbc_creat(const char *furl, mode_t mode); - -/**@ingroup file - * Read from a file using an opened file handle. - * - * @param fd Open file handle from smbc_open() or smbc_creat() - * - * @param buf Pointer to buffer to recieve read data - * - * @param bufsize Size of buf in bytes - * - * @return Number of bytes read, < 0 on error with errno set: - * - EISDIR fd refers to a directory - * - EBADF fd is not a valid file descriptor or - * is not open for reading. - * - EINVAL fd is attached to an object which is - * unsuitable for reading, or no buffer passed or - * smbc_init not called. - * - * @see smbc_open(), smbc_write() - * - */ -ssize_t smbc_read(int fd, void *buf, size_t bufsize); - - -/**@ingroup file - * Write to a file using an opened file handle. - * - * @param fd Open file handle from smbc_open() or smbc_creat() - * - * @param buf Pointer to buffer to recieve read data - * - * @param bufsize Size of buf in bytes - * - * @return Number of bytes written, < 0 on error with errno set: - * - EISDIR fd refers to a directory. - * - EBADF fd is not a valid file descriptor or - * is not open for reading. - * - EINVAL fd is attached to an object which is - * unsuitable for reading, or no buffer passed or - * smbc_init not called. - * - * @see smbc_open(), smbc_read() - * - */ -ssize_t smbc_write(int fd, void *buf, size_t bufsize); - - -/**@ingroup file - * Seek to a specific location in a file. - * - * @param fd Open file handle from smbc_open() or smbc_creat() - * - * @param offset Offset in bytes from whence - * - * @param whence A location in the file: - * - SEEK_SET The offset is set to offset bytes from - * the beginning of the file - * - SEEK_CUR The offset is set to current location - * plus offset bytes. - * - SEEK_END The offset is set to the size of the - * file plus offset bytes. - * - * @return Upon successful completion, lseek returns the - * resulting offset location as measured in bytes - * from the beginning of the file. Otherwise, a value - * of (off_t)-1 is returned and errno is set to - * indicate the error: - * - EBADF Fildes is not an open file descriptor. - * - EINVAL Whence is not a proper value or smbc_init - * not called. - * - * @todo Are all the whence values really supported? - * - * @todo Are errno values complete and correct? - */ -off_t smbc_lseek(int fd, off_t offset, int whence); - - -/**@ingroup file - * Close an open file handle. - * - * @param fd The file handle to close - * - * @return 0 on success, < 0 on error with errno set: - * - EBADF fd isn't a valid open file descriptor - * - EINVAL smbc_init() failed or has not been called - * - * @see smbc_open(), smbc_creat() - */ -int smbc_close(int fd); - - -/**@ingroup directory - * Unlink (delete) a file or directory. - * - * @param furl The smb url of the file to delete - * - * @return 0 on success, < 0 on error with errno set: - * - EACCES or EPERM Write access to the directory - * containing pathname is not allowed or one - * of the directories in pathname did not allow - * search (execute) permission - * - ENOENT A directory component in pathname does - * not exist - * - EINVAL NULL was passed in the file param or - * smbc_init not called. - * - EACCES You do not have access to the file - * - ENOMEM Insufficient kernel memory was available - * - * @see smbc_rmdir()s - * - * @todo Are errno values complete and correct? - */ -int smbc_unlink(const char *furl); - - -/**@ingroup directory - * Rename or move a file or directory. - * - * @param ourl The original smb url (source url) of file or - * directory to be moved - * - * @param nurl The new smb url (destination url) of the file - * or directory after the move. Currently nurl must - * be on the same share as ourl. - * - * @return 0 on success, < 0 on error with errno set: - * - EISDIR nurl is an existing directory, but ourl is - * not a directory. - * - EEXIST nurl is a non-empty directory, - * i.e., contains entries other than "." and ".." - * - EINVAL The new url contained a path prefix - * of the old, or, more generally, an attempt was - * made to make a directory a subdirectory of itself - * or smbc_init not called. - * - ENOTDIR A component used as a directory in ourl - * or nurl path is not, in fact, a directory. Or, - * ourl is a directory, and newpath exists but is not - * a directory. - * - EACCES or EPERM Write access to the directory - * containing ourl or nurl is not allowed for the - * process's effective uid, or one of the - * directories in ourl or nurl did not allow search - * (execute) permission, or ourl was a directory - * and did not allow write permission. - * - ENOENT A directory component in ourl or nurl - * does not exist. - * - EXDEV Rename across shares not supported. - * - ENOMEM Insufficient kernel memory was available. - * - EEXIST The target file, nurl, already exists. - * - * - * @todo Are we going to support copying when urls are not on the same - * share? I say no... NOTE. I agree for the moment. - * - */ -int smbc_rename(const char *ourl, const char *nurl); - - -/**@ingroup directory - * Open a directory used to obtain directory entries. - * - * @param durl The smb url of the directory to open - * - * @return Valid directory handle. < 0 on error with errno set: - * - EACCES Permission denied. - * - EINVAL A NULL file/URL was passed, or the URL would - * not parse, or was of incorrect form or smbc_init not - * called. - * - ENOENT durl does not exist, or name is an - * - ENOMEM Insufficient memory to complete the - * operation. - * - ENOTDIR name is not a directory. - * - EPERM the workgroup could not be found. - * - ENODEV the workgroup or server could not be found. - * - * @see smbc_getdents(), smbc_readdir(), smbc_closedir() - * - */ -int smbc_opendir(const char *durl); - - -/**@ingroup directory - * Close a directory handle opened by smbc_opendir(). - * - * @param dh Directory handle to close - * - * @return 0 on success, < 0 on error with errno set: - * - EBADF dh is an invalid directory handle - * - * @see smbc_opendir() - */ -int smbc_closedir(int dh); - - -/**@ingroup directory - * Get multiple directory entries. - * - * smbc_getdents() reads as many dirent structures from the an open - * directory handle into a specified memory area as will fit. - * - * @param dh Valid directory as returned by smbc_opendir() - * - * @param dirp pointer to buffer that will receive the directory - * entries. - * - * @param count The size of the dirp buffer in bytes - * - * @returns If any dirents returned, return will indicate the - * total size. If there were no more dirents available, - * 0 is returned. < 0 indicates an error. - * - EBADF Invalid directory handle - * - EINVAL Result buffer is too small or smbc_init - * not called. - * - ENOENT No such directory. - * @see , smbc_dirent, smbc_readdir(), smbc_open() - * - * @todo Are errno values complete and correct? - * - * @todo Add example code so people know how to parse buffers. - */ -int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count); - - -/**@ingroup directory - * Get a single directory entry. - * - * @param dh Valid directory as returned by smbc_opendir() - * - * @return A pointer to a smbc_dirent structure, or NULL if an - * error occurs or end-of-directory is reached: - * - EBADF Invalid directory handle - * - EINVAL smbc_init() failed or has not been called - * - * @see smbc_dirent, smbc_getdents(), smbc_open() - */ -struct smbc_dirent* smbc_readdir(unsigned int dh); - - -/**@ingroup directory - * Get the current directory offset. - * - * smbc_telldir() may be used in conjunction with smbc_readdir() and - * smbc_lseekdir(). - * - * @param dh Valid directory as returned by smbc_opendir() - * - * @return The current location in the directory stream or -1 - * if an error occur. The current location is not - * an offset. Becuase of the implementation, it is a - * handle that allows the library to find the entry - * later. - * - EBADF dh is not a valid directory handle - * - EINVAL smbc_init() failed or has not been called - * - ENOTDIR if dh is not a directory - * - * @see smbc_readdir() - * - */ -off_t smbc_telldir(int dh); - - -/**@ingroup directory - * lseek on directories. - * - * smbc_lseekdir() may be used in conjunction with smbc_readdir() and - * smbc_telldir(). (rewind by smbc_lseekdir(fd, NULL)) - * - * @param fd Valid directory as returned by smbc_opendir() - * - * @param offset The offset (as returned by smbc_telldir). Can be - * NULL, in which case we will rewind - * - * @return 0 on success, -1 on failure - * - EBADF dh is not a valid directory handle - * - ENOTDIR if dh is not a directory - * - EINVAL offset did not refer to a valid dirent or - * smbc_init not called. - * - * @see smbc_telldir() - * - * - * @todo In what does the reture and errno values mean? - */ -int smbc_lseekdir(int fd, off_t offset); - -/**@ingroup directory - * Create a directory. - * - * @param durl The url of the directory to create - * - * @param mode Specifies the permissions to use. It is modified - * by the process's umask in the usual way: the - * permissions of the created file are (mode & ~umask). - * - * @return 0 on success, < 0 on error with errno set: - * - EEXIST directory url already exists - * - EACCES The parent directory does not allow write - * permission to the process, or one of the directories - * - ENOENT A directory component in pathname does not - * exist. - * - EINVAL NULL durl passed or smbc_init not called. - * - ENOMEM Insufficient memory was available. - * - * @see smbc_rmdir() - * - */ -int smbc_mkdir(const char *durl, mode_t mode); - - -/**@ingroup directory - * Remove a directory. - * - * @param durl The smb url of the directory to remove - * - * @return 0 on success, < 0 on error with errno set: - * - EACCES or EPERM Write access to the directory - * containing pathname was not allowed. - * - EINVAL durl is NULL or smbc_init not called. - * - ENOENT A directory component in pathname does not - * exist. - * - ENOTEMPTY directory contains entries. - * - ENOMEM Insufficient kernel memory was available. - * - * @see smbc_mkdir(), smbc_unlink() - * - * @todo Are errno values complete and correct? - */ -int smbc_rmdir(const char *durl); - - -/**@ingroup attribute - * Get information about a file or directory. - * - * @param url The smb url to get information for - * - * @param st pointer to a buffer that will be filled with - * standard Unix struct stat information. - * - * @return 0 on success, < 0 on error with errno set: - * - ENOENT A component of the path file_name does not - * exist. - * - EINVAL a NULL url was passed or smbc_init not called. - * - EACCES Permission denied. - * - ENOMEM Out of memory - * - ENOTDIR The target dir, url, is not a directory. - * - * @see Unix stat() - * - */ -int smbc_stat(const char *url, struct stat *st); - - -/**@ingroup attribute - * Get file information via an file descriptor. - * - * @param fd Open file handle from smbc_open() or smbc_creat() - * - * @param st pointer to a buffer that will be filled with - * standard Unix struct stat information. - * - * @return EBADF filedes is bad. - * - EACCES Permission denied. - * - EBADF fd is not a valid file descriptor - * - EINVAL Problems occurred in the underlying routines - * or smbc_init not called. - * - ENOMEM Out of memory - * - * @see smbc_stat(), Unix stat() - * - */ -int smbc_fstat(int fd, struct stat *st); - - -/**@ingroup attribue - * Change the ownership of a file or directory. - * - * @param url The smb url of the file or directory to change - * ownership of. - * - * @param owner I have no idea? - * - * @param group I have not idea? - * - * @return 0 on success, < 0 on error with errno set: - * - EPERM The effective UID does not match the owner - * of the file, and is not zero; or the owner or group - * were specified incorrectly. - * - ENOENT The file does not exist. - * - ENOMEM Insufficient was available. - * - ENOENT file or directory does not exist - * - * @todo Are we actually going to be able to implement this function - * - * @todo How do we abstract owner and group uid and gid? - * - */ -int smbc_chown(const char *url, uid_t owner, gid_t group); - - -/**@ingroup attribute - * Change the permissions of a file. - * - * @param url The smb url of the file or directory to change - * permissions of - * - * @param mode The permissions to set: - * - Put good explaination of permissions here! - * - * @return 0 on success, < 0 on error with errno set: - * - EPERM The effective UID does not match the owner - * of the file, and is not zero - * - ENOENT The file does not exist. - * - ENOMEM Insufficient was available. - * - ENOENT file or directory does not exist - * - * @todo Actually implement this fuction? - * - * @todo Are errno values complete and correct? - */ -int smbc_chmod(const char *url, mode_t mode); - -/**@ingroup attribute - * Change the last modification time on a file - * - * @param url The smb url of the file or directory to change - * the modification time of - * - * @param tbuf A timeval structure which contains the desired - * modification time. NOTE: Only the tv_sec field is - * used. The tv_usec (microseconds) portion is ignored. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - EPERM Permission was denied. - * - */ -int smbc_utimes(const char *url, struct timeval *tbuf); - -#ifdef HAVE_UTIME_H -/**@ingroup attribute - * Change the last modification time on a file - * - * @param url The smb url of the file or directory to change - * the modification time of - * - * @param utbuf A utimebuf structure which contains the desired - * modification time. NOTE: Although the structure contains - * an access time as well, the access time value is ignored. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - ENOMEM No memory was available for internal needs - * - EPERM Permission was denied. - * - */ -int smbc_utime(const char *fname, struct utimbuf *utbuf); -#endif - -/**@ingroup attribute - * Set extended attributes for a file. This is used for modifying a file's - * security descriptor (i.e. owner, group, and access control list) - * - * @param url The smb url of the file or directory to set extended - * attributes for. - * - * @param name The name of an attribute to be changed. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter should contain a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @param value The value to be assigned to the specified attribute name. - * This buffer should contain only the attribute value if the - * name was of the "system.nt_sec_desc.<attribute_name>" - * form. If the name was of the "system.nt_sec_desc.*" form - * then a complete security descriptor, with name:value pairs - * separated by tabs, commas, or newlines (not spaces!), - * should be provided in this value buffer. A complete - * security descriptor will contain one or more entries - * selected from the following: - * - * REVISION:<revision number> - * OWNER:<sid or name> - * GROUP:<sid or name> - * ACL:<sid or name>:<type>/<flags>/<mask> - * - * The revision of the ACL specifies the internal Windows NT - * ACL revision for the security descriptor. If not specified - * it defaults to 1. Using values other than 1 may cause - * strange behaviour. - * - * The owner and group specify the owner and group sids for - * the object. If the attribute name (either '*+' with a - * complete security descriptor, or individual 'owner+' or - * 'group+' attribute names) ended with a plus sign, the - * specified name is resolved to a SID value, using the - * server on which the file or directory resides. Otherwise, - * the value should be provided in SID-printable format as - * S-1-x-y-z, and is used directly. The <sid or name> - * associated with the ACL: attribute should be provided - * similarly. - * - * @param size The number of the bytes of data in the value buffer - * - * @param flags A bit-wise OR of zero or more of the following: - * SMBC_XATTR_FLAG_CREATE - - * fail if the named attribute already exists - * SMBC_XATTR_FLAG_REPLACE - - * fail if the attribute does not already exist - * - * If neither flag is specified, the specified attributes - * will be added or replace existing attributes of the same - * name, as necessary. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * or one of the parameters is not of a correct - * form - * - ENOMEM No memory was available for internal needs - * - EEXIST If the attribute already exists and the flag - * SMBC_XATTR_FLAG_CREAT was specified - * - ENOATTR If the attribute does not exist and the flag - * SMBC_XATTR_FLAG_REPLACE was specified - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - * @note Attribute names are compared in a case-insensitive - * fashion. All of the following are equivalent, although - * the all-lower-case name is the preferred format: - * system.nt_sec_desc.owner - * SYSTEM.NT_SEC_DESC.OWNER - * sYsTeM.nt_sEc_desc.owNER - * - */ -int smbc_setxattr(const char *url, - const char *name, - const void *value, - size_t size, - int flags); - - -/**@ingroup attribute - * Set extended attributes for a file. This is used for modifying a file's - * security descriptor (i.e. owner, group, and access control list). The - * POSIX function which this maps to would act on a symbolic link rather than - * acting on what the symbolic link points to, but with no symbolic links in - * SMB file systems, this function is functionally identical to - * smbc_setxattr(). - * - * @param url The smb url of the file or directory to set extended - * attributes for. - * - * @param name The name of an attribute to be changed. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter should contain a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @param value The value to be assigned to the specified attribute name. - * This buffer should contain only the attribute value if the - * name was of the "system.nt_sec_desc.<attribute_name>" - * form. If the name was of the "system.nt_sec_desc.*" form - * then a complete security descriptor, with name:value pairs - * separated by tabs, commas, or newlines (not spaces!), - * should be provided in this value buffer. A complete - * security descriptor will contain one or more entries - * selected from the following: - * - * REVISION:<revision number> - * OWNER:<sid or name> - * GROUP:<sid or name> - * ACL:<sid or name>:<type>/<flags>/<mask> - * - * The revision of the ACL specifies the internal Windows NT - * ACL revision for the security descriptor. If not specified - * it defaults to 1. Using values other than 1 may cause - * strange behaviour. - * - * The owner and group specify the owner and group sids for - * the object. If the attribute name (either '*+' with a - * complete security descriptor, or individual 'owner+' or - * 'group+' attribute names) ended with a plus sign, the - * specified name is resolved to a SID value, using the - * server on which the file or directory resides. Otherwise, - * the value should be provided in SID-printable format as - * S-1-x-y-z, and is used directly. The <sid or name> - * associated with the ACL: attribute should be provided - * similarly. - * - * @param size The number of the bytes of data in the value buffer - * - * @param flags A bit-wise OR of zero or more of the following: - * SMBC_XATTR_FLAG_CREATE - - * fail if the named attribute already exists - * SMBC_XATTR_FLAG_REPLACE - - * fail if the attribute does not already exist - * - * If neither flag is specified, the specified attributes - * will be added or replace existing attributes of the same - * name, as necessary. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * or one of the parameters is not of a correct - * form - * - ENOMEM No memory was available for internal needs - * - EEXIST If the attribute already exists and the flag - * SMBC_XATTR_FLAG_CREAT was specified - * - ENOATTR If the attribute does not exist and the flag - * SMBC_XATTR_FLAG_REPLACE was specified - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - * @note Attribute names are compared in a case-insensitive - * fashion. All of the following are equivalent, although - * the all-lower-case name is the preferred format: - * system.nt_sec_desc.owner - * SYSTEM.NT_SEC_DESC.OWNER - * sYsTeM.nt_sEc_desc.owNER - * - */ -int smbc_lsetxattr(const char *url, - const char *name, - const void *value, - size_t size, - int flags); - - -/**@ingroup attribute - * Set extended attributes for a file. This is used for modifying a file's - * security descriptor (i.e. owner, group, and access control list) - * - * @param fd A file descriptor associated with an open file (as - * previously returned by smbc_open(), to get extended - * attributes for. - * - * @param name The name of an attribute to be changed. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter should contain a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @param value The value to be assigned to the specified attribute name. - * This buffer should contain only the attribute value if the - * name was of the "system.nt_sec_desc.<attribute_name>" - * form. If the name was of the "system.nt_sec_desc.*" form - * then a complete security descriptor, with name:value pairs - * separated by tabs, commas, or newlines (not spaces!), - * should be provided in this value buffer. A complete - * security descriptor will contain one or more entries - * selected from the following: - * - * REVISION:<revision number> - * OWNER:<sid or name> - * GROUP:<sid or name> - * ACL:<sid or name>:<type>/<flags>/<mask> - * - * The revision of the ACL specifies the internal Windows NT - * ACL revision for the security descriptor. If not specified - * it defaults to 1. Using values other than 1 may cause - * strange behaviour. - * - * The owner and group specify the owner and group sids for - * the object. If the attribute name (either '*+' with a - * complete security descriptor, or individual 'owner+' or - * 'group+' attribute names) ended with a plus sign, the - * specified name is resolved to a SID value, using the - * server on which the file or directory resides. Otherwise, - * the value should be provided in SID-printable format as - * S-1-x-y-z, and is used directly. The <sid or name> - * associated with the ACL: attribute should be provided - * similarly. - * - * @param size The number of the bytes of data in the value buffer - * - * @param flags A bit-wise OR of zero or more of the following: - * SMBC_XATTR_FLAG_CREATE - - * fail if the named attribute already exists - * SMBC_XATTR_FLAG_REPLACE - - * fail if the attribute does not already exist - * - * If neither flag is specified, the specified attributes - * will be added or replace existing attributes of the same - * name, as necessary. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * or one of the parameters is not of a correct - * form - * - ENOMEM No memory was available for internal needs - * - EEXIST If the attribute already exists and the flag - * SMBC_XATTR_FLAG_CREAT was specified - * - ENOATTR If the attribute does not exist and the flag - * SMBC_XATTR_FLAG_REPLACE was specified - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - * @note Attribute names are compared in a case-insensitive - * fashion. All of the following are equivalent, although - * the all-lower-case name is the preferred format: - * system.nt_sec_desc.owner - * SYSTEM.NT_SEC_DESC.OWNER - * sYsTeM.nt_sEc_desc.owNER - * - */ -int smbc_fsetxattr(int fd, - const char *name, - const void *value, - size_t size, - int flags); - - -/**@ingroup attribute - * Get extended attributes for a file. - * - * @param url The smb url of the file or directory to get extended - * attributes for. - * - * @param name The name of an attribute to be retrieved. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter will return a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @param value A pointer to a buffer in which the value of the specified - * attribute will be placed (unless size is zero). - * - * @param size The size of the buffer pointed to by value. This parameter - * may also be zero, in which case the size of the buffer - * required to hold the attribute value will be returned, - * but nothing will be placed into the value buffer. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * or one of the parameters is not of a correct - * form - * - ENOMEM No memory was available for internal needs - * - EEXIST If the attribute already exists and the flag - * SMBC_XATTR_FLAG_CREAT was specified - * - ENOATTR If the attribute does not exist and the flag - * SMBC_XATTR_FLAG_REPLACE was specified - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - */ -int smbc_getxattr(const char *url, - const char *name, - const void *value, - size_t size); - - -/**@ingroup attribute - * Get extended attributes for a file. The POSIX function which this maps to - * would act on a symbolic link rather than acting on what the symbolic link - * points to, but with no symbolic links in SMB file systems, this function - * is functionally identical to smbc_getxattr(). - * - * @param url The smb url of the file or directory to get extended - * attributes for. - * - * @param name The name of an attribute to be retrieved. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter will return a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @param value A pointer to a buffer in which the value of the specified - * attribute will be placed (unless size is zero). - * - * @param size The size of the buffer pointed to by value. This parameter - * may also be zero, in which case the size of the buffer - * required to hold the attribute value will be returned, - * but nothing will be placed into the value buffer. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * or one of the parameters is not of a correct - * form - * - ENOMEM No memory was available for internal needs - * - EEXIST If the attribute already exists and the flag - * SMBC_XATTR_FLAG_CREAT was specified - * - ENOATTR If the attribute does not exist and the flag - * SMBC_XATTR_FLAG_REPLACE was specified - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - */ -int smbc_lgetxattr(const char *url, - const char *name, - const void *value, - size_t size); - - -/**@ingroup attribute - * Get extended attributes for a file. - * - * @param fd A file descriptor associated with an open file (as - * previously returned by smbc_open(), to get extended - * attributes for. - * - * @param name The name of an attribute to be retrieved. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter will return a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @param value A pointer to a buffer in which the value of the specified - * attribute will be placed (unless size is zero). - * - * @param size The size of the buffer pointed to by value. This parameter - * may also be zero, in which case the size of the buffer - * required to hold the attribute value will be returned, - * but nothing will be placed into the value buffer. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * or one of the parameters is not of a correct - * form - * - ENOMEM No memory was available for internal needs - * - EEXIST If the attribute already exists and the flag - * SMBC_XATTR_FLAG_CREAT was specified - * - ENOATTR If the attribute does not exist and the flag - * SMBC_XATTR_FLAG_REPLACE was specified - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - */ -int smbc_fgetxattr(int fd, - const char *name, - const void *value, - size_t size); - - -/**@ingroup attribute - * Remove extended attributes for a file. This is used for modifying a file's - * security descriptor (i.e. owner, group, and access control list) - * - * @param url The smb url of the file or directory to remove the extended - * attributes for. - * - * @param name The name of an attribute to be removed. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter will return a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - ENOMEM No memory was available for internal needs - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - */ -int smbc_removexattr(const char *url, - const char *name); - - -/**@ingroup attribute - * Remove extended attributes for a file. This is used for modifying a file's - * security descriptor (i.e. owner, group, and access control list) The POSIX - * function which this maps to would act on a symbolic link rather than acting - * on what the symbolic link points to, but with no symbolic links in SMB file - * systems, this function is functionally identical to smbc_removexattr(). - * - * @param url The smb url of the file or directory to remove the extended - * attributes for. - * - * @param name The name of an attribute to be removed. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter will return a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - ENOMEM No memory was available for internal needs - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - */ -int smbc_lremovexattr(const char *url, - const char *name); - - -/**@ingroup attribute - * Remove extended attributes for a file. This is used for modifying a file's - * security descriptor (i.e. owner, group, and access control list) - * - * @param fd A file descriptor associated with an open file (as - * previously returned by smbc_open(), to get extended - * attributes for. - * - * @param name The name of an attribute to be removed. Names are of - * one of the following forms: - * - * system.nt_sec_desc.<attribute name> - * system.nt_sec_desc.* - * system.nt_sec_desc.*+ - * - * where <attribute name> is one of: - * - * revision - * owner - * owner+ - * group - * group+ - * acl:<name or sid> - * acl+:<name or sid> - * - * In the forms "system.nt_sec_desc.*" and - * "system.nt_sec_desc.*+", the asterisk and plus signs are - * literal, i.e. the string is provided exactly as shown, and - * the value parameter will return a complete security - * descriptor with name:value pairs separated by tabs, - * commas, or newlines (not spaces!). - * - * The plus sign ('+') indicates that SIDs should be mapped - * to names. Without the plus sign, SIDs are not mapped; - * rather they are simply converted to a string format. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - ENOMEM No memory was available for internal needs - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - */ -int smbc_fremovexattr(int fd, - const char *name); - - -/**@ingroup attribute - * List the supported extended attribute names associated with a file - * - * @param url The smb url of the file or directory to list the extended - * attributes for. - * - * @param list A pointer to a buffer in which the list of attributes for - * the specified file or directory will be placed (unless - * size is zero). - * - * @param size The size of the buffer pointed to by list. This parameter - * may also be zero, in which case the size of the buffer - * required to hold all of the attribute names will be - * returned, but nothing will be placed into the list buffer. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - ENOMEM No memory was available for internal needs - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - * @note This function always returns all attribute names supported - * by NT file systems, regardless of wether the referenced - * file system supports extended attributes (e.g. a Windows - * 2000 machine supports extended attributes if NTFS is used, - * but not if FAT is used, and Windows 98 doesn't support - * extended attributes at all. Whether this is a feature or - * a bug is yet to be decided. - */ -int smbc_listxattr(const char *url, - char *list, - size_t size); - -/**@ingroup attribute - * List the supported extended attribute names associated with a file The - * POSIX function which this maps to would act on a symbolic link rather than - * acting on what the symbolic link points to, but with no symbolic links in - * SMB file systems, this function is functionally identical to - * smbc_listxattr(). - * - * @param url The smb url of the file or directory to list the extended - * attributes for. - * - * @param list A pointer to a buffer in which the list of attributes for - * the specified file or directory will be placed (unless - * size is zero). - * - * @param size The size of the buffer pointed to by list. This parameter - * may also be zero, in which case the size of the buffer - * required to hold all of the attribute names will be - * returned, but nothing will be placed into the list buffer. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - ENOMEM No memory was available for internal needs - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - * @note This function always returns all attribute names supported - * by NT file systems, regardless of wether the referenced - * file system supports extended attributes (e.g. a Windows - * 2000 machine supports extended attributes if NTFS is used, - * but not if FAT is used, and Windows 98 doesn't support - * extended attributes at all. Whether this is a feature or - * a bug is yet to be decided. - */ -int smbc_llistxattr(const char *url, - char *list, - size_t size); - -/**@ingroup attribute - * List the supported extended attribute names associated with a file - * - * @param fd A file descriptor associated with an open file (as - * previously returned by smbc_open(), to get extended - * attributes for. - * - * @param list A pointer to a buffer in which the list of attributes for - * the specified file or directory will be placed (unless - * size is zero). - * - * @param size The size of the buffer pointed to by list. This parameter - * may also be zero, in which case the size of the buffer - * required to hold all of the attribute names will be - * returned, but nothing will be placed into the list buffer. - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL The client library is not properly initialized - * - ENOMEM No memory was available for internal needs - * - EPERM Permission was denied. - * - ENOTSUP The referenced file system does not support - * extended attributes - * - * @note This function always returns all attribute names supported - * by NT file systems, regardless of wether the referenced - * file system supports extended attributes (e.g. a Windows - * 2000 machine supports extended attributes if NTFS is used, - * but not if FAT is used, and Windows 98 doesn't support - * extended attributes at all. Whether this is a feature or - * a bug is yet to be decided. - */ -int smbc_flistxattr(int fd, - char *list, - size_t size); - -/**@ingroup print - * Print a file given the name in fname. It would be a URL ... - * - * @param fname The URL of a file on a remote SMB server that the - * caller wants printed - * - * @param printq The URL of the print share to print the file to. - * - * @return 0 on success, < 0 on error with errno set: - * - * - EINVAL fname or printq was NULL or smbc_init not - * not called. - * and errors returned by smbc_open - * - */ -int smbc_print_file(const char *fname, const char *printq); - -/**@ingroup print - * Open a print file that can be written to by other calls. This simply - * does an smbc_open call after checking if there is a file name on the - * URI. If not, a temporary name is added ... - * - * @param fname The URL of the print share to print to? - * - * @returns A file handle for the print file if successful. - * Returns -1 if an error ocurred and errno has the values - * - EINVAL fname was NULL or smbc_init not called. - * - all errors returned by smbc_open - * - */ -int smbc_open_print_job(const char *fname); - -/**@ingroup print - * List the print jobs on a print share, for the moment, pass a callback - * - * @param purl The url of the print share to list the jobs of - * - * @param fn Callback function the receives printjob info - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL fname was NULL or smbc_init not called - * - EACCES ??? - */ -int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn); - -/**@ingroup print - * Delete a print job - * - * @param purl Url of the print share - * - * @param id The id of the job to delete - * - * @return 0 on success, < 0 on error with errno set: - * - EINVAL fname was NULL or smbc_init not called - * - * @todo what errno values are possible here? - */ -int smbc_unlink_print_job(const char *purl, int id); - -/**@ingroup callback - * Remove a server from the cached server list it's unused. - * - * @param context pointer to smb context - * - * @param srv pointer to server to remove - * - * @return On success, 0 is returned. 1 is returned if the server could not - * be removed. Also useable outside libsmbclient. - */ -int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv); - -#endif /* SMBCLIENT_H_INCLUDED */ diff --git a/source/include/local.h b/source/include/local.h index 540365047a2..81dd7e8b203 100644 --- a/source/include/local.h +++ b/source/include/local.h @@ -6,8 +6,8 @@ #define _LOCAL_H /* The default workgroup - usually overridden in smb.conf */ -#ifndef WORKGROUP -#define WORKGROUP "WORKGROUP" +#ifndef DEFAULT_WORKGROUP +#define DEFAULT_WORKGROUP "WORKGROUP" #endif /* the maximum debug level to compile into the code. This assumes a good @@ -224,10 +224,11 @@ /* Max number of simultaneous winbindd socket connections. */ #define WINBINDD_MAX_SIMULTANEOUS_CLIENTS 200 -/* Buffer size to use when printing backtraces */ -#define BACKTRACE_STACK_SIZE 64 - /* size of listen() backlog in smbd */ -#define SMBD_LISTEN_BACKLOG 50 +#define SMBD_LISTEN_BACKLOG 10 + +/* the range of ports to try for decrpc over tcp endpoints */ +#define DCERPC_TCP_LOW_PORT 1024 +#define DCERPC_TCP_HIGH_PORT 1300 #endif diff --git a/source/include/mapping.h b/source/include/mapping.h deleted file mode 100644 index fdaa2b04532..00000000000 --- a/source/include/mapping.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-2000, - * Copyright (C) Jean François Micouleau 1998-2001. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#define ENUM_ONLY_MAPPED True -#define ENUM_ALL_MAPPED False - -typedef struct _GROUP_MAP { - struct pdb_methods *methods; - gid_t gid; - DOM_SID sid; - enum SID_NAME_USE sid_name_use; - fstring nt_name; - fstring comment; -} GROUP_MAP; - diff --git a/source/include/messages.h b/source/include/messages.h index 37e9372cdaa..ce167a772d3 100644 --- a/source/include/messages.h +++ b/source/include/messages.h @@ -43,6 +43,10 @@ #define MSG_SHUTDOWN 13 +/* Dump out the talloc useage. */ +#define MSG_REQ_TALLOC_USAGE 14 +#define MSG_TALLOC_USAGE 15 + /* nmbd messages */ #define MSG_FORCE_ELECTION 1001 #define MSG_WINS_NEW_ENTRY 1002 diff --git a/source/include/modconf.h b/source/include/modconf.h deleted file mode 100644 index f5cc5ef4889..00000000000 --- a/source/include/modconf.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef _MODCONF_H_ -#define _MODCONF_H_ -/* - Unix SMB/CIFS implementation. - - ModConf headers - - Copyright (C) Simo Sorce 2003 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#define SAMBA_CONFIG_INTERFACE_VERSION 1 - -/* Filled out by config backends */ -struct config_functions { - NTSTATUS (*init)(char *params); - NTSTATUS (*load)(BOOL (*sfunc)(const char *),BOOL (*pfunc)(const char *, const char *)); - NTSTATUS (*close)(void); -}; -#endif /* _MODCONF_H_ */ diff --git a/source/include/module.h b/source/include/module.h index c41310c7f75..02826595e40 100644 --- a/source/include/module.h +++ b/source/include/module.h @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. Handling of idle/exit events - Copyright (C) Stefan (metze) Metzmacher 2003 + Copyright (C) Jelmer Vernooij 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,17 +22,9 @@ #define _MODULE_H /* Module support */ -typedef NTSTATUS (init_module_function) (void); +typedef NTSTATUS (*init_module_function) (void); - -typedef int smb_event_id_t; -#define SMB_EVENT_ID_INVALID (-1) - -#define SMB_IDLE_EVENT_DEFAULT_INTERVAL 180 -#define SMB_IDLE_EVENT_MIN_INTERVAL 30 - -typedef void (smb_idle_event_fn)(void **data,time_t *interval,time_t now); - -typedef void (smb_exit_event_fn)(void **data); +/* Module that registers a backend for a certain subsystem */ +typedef NTSTATUS (*register_backend_function) (void *data); #endif /* _MODULE_H */ diff --git a/source/include/msdfs.h b/source/include/msdfs.h index 32aa7ecef25..1bfff9ad536 100644 --- a/source/include/msdfs.h +++ b/source/include/msdfs.h @@ -64,8 +64,8 @@ struct dfs_path lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) && \ dfs_redirect(name,conn,False)) \ return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, \ - ERRSRV, ERRbadpath);; } - + ERRSRV, ERRbadpath);; } + #define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) \ { if ( (SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) || \ ((get_remote_arch() == RA_WIN95) && lp_msdfs_root(SNUM(conn))) ) \ @@ -74,12 +74,4 @@ struct dfs_path ERRSRV, ERRbadpath);; } -#define init_dfsroot(conn, inbuf, outbuf) \ -{ if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) { \ - DEBUG(2,("Serving %s as a Dfs root\n", \ - lp_servicename(SNUM(conn)) )); \ - SSVAL(outbuf, smb_vwv2, SMB_SHARE_IN_DFS \ - | SVAL(outbuf, smb_vwv2)); \ -} } - #endif /* _MSDFS_H */ diff --git a/source/include/mutex.h b/source/include/mutex.h new file mode 100644 index 00000000000..21e4f9f8a5c --- /dev/null +++ b/source/include/mutex.h @@ -0,0 +1,79 @@ +#ifndef _MUTEX_H_ +#define _MUTEX_H_ +/* + Unix SMB/CIFS implementation. + Samba mutex functions + Copyright (C) Andrew Tridgell 2003 + Copyright (C) James J Myers 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* To add a new mutex, add it to enum mutex_id + */ +enum mutex_id { MUTEX_SMBD, /* global smbd lock */ + MUTEX_TALLOC, /* global talloc.c lock */ + MUTEX_DEBUG, /* global debug.c lock */ + MUTEX_TANK, /* vfs_tank lock */ + + MUTEX_MAX /* this MUST be kept last */ +}; + +/* To add a new read/write lock, add it to enum rwlock_id + */ +enum rwlock_id { RWLOCK_SMBD, /* global smbd lock */ + + RWLOCK_MAX /* this MUST be kept last */ +}; + +#define MUTEX_LOCK_BY_ID(mutex_index) smb_mutex_lock_by_id(mutex_index, #mutex_index) +#define MUTEX_UNLOCK_BY_ID(mutex_index) smb_mutex_unlock_by_id(mutex_index, #mutex_index) +#define MUTEX_INIT(mutex, name) smb_mutex_init(mutex, #name) +#define MUTEX_DESTROY(mutex, name) smb_mutex_destroy(mutex, #name) +#define MUTEX_LOCK(mutex, name) smb_mutex_lock(mutex, #name) +#define MUTEX_UNLOCK(mutex, name) smb_mutex_unlock(mutex, #name) + +#define RWLOCK_INIT(rwlock, name) smb_rwlock_init(rwlock, #name) +#define RWLOCK_DESTROY(rwlock, name) smb_rwlock_destroy(rwlock, #name) +#define RWLOCK_LOCK_WRITE(rwlock, name) smb_rwlock_lock_write(rwlock, #name) +#define RWLOCK_LOCK_READ(rwlock, name) smb_rwlock_lock_read(rwlock, #name) +#define RWLOCK_UNLOCK(rwlock, name) smb_rwlock_unlock(rwlock, #name) + + + +/* this null typedef ensures we get the types right and avoids the + pitfalls of void* */ +typedef struct { + void *mutex; +} smb_mutex_t; +typedef struct { + void *rwlock; +} smb_rwlock_t; + +/* the mutex model operations structure - contains function pointers to + the model-specific implementations of each operation */ +struct mutex_ops { + int (*mutex_init)(smb_mutex_t *mutex, const char *name); + int (*mutex_lock)(smb_mutex_t *mutex, const char *name); + int (*mutex_unlock)(smb_mutex_t *mutex, const char *name); + int (*mutex_destroy)(smb_mutex_t *mutex, const char *name); + int (*rwlock_init)(smb_rwlock_t *rwlock, const char *name); + int (*rwlock_lock_write)(smb_rwlock_t *rwlock, const char *name); + int (*rwlock_lock_read)(smb_rwlock_t *rwlock, const char *name); + int (*rwlock_unlock)(smb_rwlock_t *rwlock, const char *name); + int (*rwlock_destroy)(smb_rwlock_t *rwlock, const char *name); +}; + +#endif /* ndef _MUTEX_H_ */ diff --git a/source/include/nameserv.h b/source/include/nameserv.h index ec3d56c06b7..7611fdfb8d0 100644 --- a/source/include/nameserv.h +++ b/source/include/nameserv.h @@ -176,116 +176,128 @@ enum name_source {LMHOSTS_NAME, REGISTER_NAME, SELF_NAME, DNS_NAME, enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3}; enum packet_type {NMB_PACKET, DGRAM_PACKET}; -enum master_state { - MST_NONE, - MST_POTENTIAL, - MST_BACKUP, - MST_MSB, - MST_BROWSER, - MST_UNBECOMING_MASTER +enum master_state +{ + MST_NONE, + MST_POTENTIAL, + MST_BACKUP, + MST_MSB, + MST_BROWSER, + MST_UNBECOMING_MASTER }; -enum domain_state { - DOMAIN_NONE, - DOMAIN_WAIT, - DOMAIN_MST +enum domain_state +{ + DOMAIN_NONE, + DOMAIN_WAIT, + DOMAIN_MST }; -enum logon_state { - LOGON_NONE, - LOGON_WAIT, - LOGON_SRV +enum logon_state +{ + LOGON_NONE, + LOGON_WAIT, + LOGON_SRV }; struct subnet_record; -struct nmb_data { - uint16 nb_flags; /* Netbios flags. */ - int num_ips; /* Number of ip entries. */ - struct in_addr *ip; /* The ip list for this name. */ +struct nmb_data +{ + uint16 nb_flags; /* Netbios flags. */ + int num_ips; /* Number of ip entries. */ + struct in_addr *ip; /* The ip list for this name. */ - enum name_source source; /* Where the name came from. */ + enum name_source source; /* Where the name came from. */ - time_t death_time; /* The time the record must be removed (do not remove if 0). */ - time_t refresh_time; /* The time the record should be refreshed. */ + time_t death_time; /* The time the record must be removed (do not remove if 0). */ + time_t refresh_time; /* The time the record should be refreshed. */ - SMB_BIG_UINT id; /* unique id */ - struct in_addr wins_ip; /* the adress of the wins server this record comes from */ + SMB_BIG_UINT id; /* unique id */ + struct in_addr wins_ip; /* the adress of the wins server this record comes from */ - int wins_flags; /* similar to the netbios flags but different ! */ + int wins_flags; /* similar to the netbios flags but different ! */ }; /* This structure represents an entry in a local netbios name list. */ -struct name_record { - ubi_trNode node[1]; - struct subnet_record *subnet; - struct nmb_name name; /* The netbios name. */ - struct nmb_data data; /* The netbios data. */ -}; +struct name_record + { +#if 0 + ubi_trNode node[1]; +#endif + struct subnet_record *subnet; + struct nmb_name name; /* The netbios name. */ + struct nmb_data data; /* The netbios data. */ + }; /* Browser cache for synchronising browse lists. */ -struct browse_cache_record { - ubi_dlNode node[1]; - unstring lmb_name; - unstring work_group; - struct in_addr ip; - time_t sync_time; - time_t death_time; /* The time the record must be removed. */ -}; +struct browse_cache_record + { +#if 0 + ubi_dlNode node[1]; +#endif + pstring lmb_name; + pstring work_group; + struct in_addr ip; + time_t sync_time; + time_t death_time; /* The time the record must be removed. */ + }; /* This is used to hold the list of servers in my domain, and is contained within lists of domains. */ -struct server_record { - struct server_record *next; - struct server_record *prev; +struct server_record +{ + struct server_record *next; + struct server_record *prev; - struct subnet_record *subnet; + struct subnet_record *subnet; - struct server_info_struct serv; - time_t death_time; + struct server_info_struct serv; + time_t death_time; }; /* A workgroup structure. It contains a list of servers. */ -struct work_record { - struct work_record *next; - struct work_record *prev; +struct work_record +{ + struct work_record *next; + struct work_record *prev; - struct subnet_record *subnet; + struct subnet_record *subnet; - struct server_record *serverlist; + struct server_record *serverlist; - /* Stage of development from non-local-master up to local-master browser. */ - enum master_state mst_state; + /* Stage of development from non-local-master up to local-master browser. */ + enum master_state mst_state; - /* Stage of development from non-domain-master to domain-master browser. */ - enum domain_state dom_state; + /* Stage of development from non-domain-master to domain-master browser. */ + enum domain_state dom_state; - /* Stage of development from non-logon-server to logon server. */ - enum logon_state log_state; + /* Stage of development from non-logon-server to logon server. */ + enum logon_state log_state; - /* Work group info. */ - unstring work_group; - int token; /* Used when communicating with backup browsers. */ - unstring local_master_browser_name; /* Current local master browser. */ + /* Work group info. */ + fstring work_group; + int token; /* Used when communicating with backup browsers. */ + fstring local_master_browser_name; /* Current local master browser. */ - /* Announce info. */ - time_t lastannounce_time; - int announce_interval; - BOOL needannounce; + /* Announce info. */ + time_t lastannounce_time; + int announce_interval; + BOOL needannounce; - /* Timeout time for this workgroup. 0 means permanent. */ - time_t death_time; + /* Timeout time for this workgroup. 0 means permanent. */ + time_t death_time; - /* Election info */ - BOOL RunningElection; - BOOL needelection; - int ElectionCount; - uint32 ElectionCriterion; + /* Election info */ + BOOL RunningElection; + BOOL needelection; + int ElectionCount; + uint32 ElectionCriterion; - /* Domain master browser info. Used for efficient syncs. */ - struct nmb_name dmb_name; - struct in_addr dmb_addr; + /* Domain master browser info. Used for efficient syncs. */ + struct nmb_name dmb_name; + struct in_addr dmb_addr; }; /* typedefs needed to define copy & free functions for userdata. */ @@ -297,10 +309,10 @@ typedef void (*userdata_free_fn)(struct userdata_struct *); /* Structure to define any userdata passed around. */ struct userdata_struct { - userdata_copy_fn copy_fn; - userdata_free_fn free_fn; - unsigned int userdata_len; - char data[16]; /* 16 is to ensure alignment/padding on all systems */ + userdata_copy_fn copy_fn; + userdata_free_fn free_fn; + unsigned int userdata_len; + char data[16]; /* 16 is to ensure alignment/padding on all systems */ }; struct response_record; @@ -374,32 +386,33 @@ typedef void (*node_status_fail_function)( struct subnet_record *, /* Initiated name queries are recorded in this list to track any responses. */ -struct response_record { - struct response_record *next; - struct response_record *prev; +struct response_record +{ + struct response_record *next; + struct response_record *prev; - uint16 response_id; + uint16 response_id; - /* Callbacks for packets received or not. */ - response_function resp_fn; - timeout_response_function timeout_fn; + /* Callbacks for packets received or not. */ + response_function resp_fn; + timeout_response_function timeout_fn; - /* Callbacks for the request succeeding or not. */ - success_function success_fn; - fail_function fail_fn; + /* Callbacks for the request succeeding or not. */ + success_function success_fn; + fail_function fail_fn; - struct packet_struct *packet; + struct packet_struct *packet; - struct userdata_struct *userdata; + struct userdata_struct *userdata; - int num_msgs; + int num_msgs; - time_t repeat_time; - time_t repeat_interval; - int repeat_count; + time_t repeat_time; + time_t repeat_interval; + int repeat_count; - /* Recursion protection. */ - BOOL in_expiration_processing; + /* Recursion protection. */ + BOOL in_expiration_processing; }; /* A subnet structure. It contains a list of workgroups and netbios names. */ @@ -411,41 +424,44 @@ struct response_record { */ enum subnet_type { - NORMAL_SUBNET = 0, /* Subnet listed in interfaces list. */ - UNICAST_SUBNET = 1, /* Subnet for unicast packets. */ - REMOTE_BROADCAST_SUBNET = 2, /* Subnet for remote broadcasts. */ - WINS_SERVER_SUBNET = 3 /* Only created if we are a WINS server. */ + NORMAL_SUBNET = 0, /* Subnet listed in interfaces list. */ + UNICAST_SUBNET = 1, /* Subnet for unicast packets. */ + REMOTE_BROADCAST_SUBNET = 2, /* Subnet for remote broadcasts. */ + WINS_SERVER_SUBNET = 3 /* Only created if we are a WINS server. */ }; -struct subnet_record { - struct subnet_record *next; - struct subnet_record *prev; - - char *subnet_name; /* For Debug identification. */ - enum subnet_type type; /* To catagorize the subnet. */ - - struct work_record *workgrouplist; /* List of workgroups. */ - ubi_trRoot namelist[1]; /* List of netbios names. */ - struct response_record *responselist; /* List of responses expected. */ - - BOOL namelist_changed; - BOOL work_changed; - - struct in_addr bcast_ip; - struct in_addr mask_ip; - struct in_addr myip; - int nmb_sock; /* socket to listen for unicast 137. */ - int dgram_sock; /* socket to listen for unicast 138. */ +struct subnet_record +{ + struct subnet_record *next; + struct subnet_record *prev; + + char *subnet_name; /* For Debug identification. */ + enum subnet_type type; /* To catagorize the subnet. */ + + struct work_record *workgrouplist; /* List of workgroups. */ +#if 0 + ubi_trRoot namelist[1]; /* List of netbios names. */ +#endif + struct response_record *responselist; /* List of responses expected. */ + + BOOL namelist_changed; + BOOL work_changed; + + struct in_addr bcast_ip; + struct in_addr mask_ip; + struct in_addr myip; + int nmb_sock; /* socket to listen for unicast 137. */ + int dgram_sock; /* socket to listen for unicast 138. */ }; /* A resource record. */ struct res_rec { - struct nmb_name rr_name; - int rr_type; - int rr_class; - int ttl; - int rdlength; - char rdata[MAX_DGRAM_SIZE]; + struct nmb_name rr_name; + int rr_type; + int rr_class; + int ttl; + int rdlength; + char rdata[MAX_DGRAM_SIZE]; }; /* Define these so we can pass info back to caller of name_query */ @@ -457,34 +473,35 @@ struct res_rec { #define NM_FLAGS_B 0x01 /* Broadcast */ /* An nmb packet. */ -struct nmb_packet { - struct { - int name_trn_id; - int opcode; - BOOL response; - struct { - BOOL bcast; - BOOL recursion_available; - BOOL recursion_desired; - BOOL trunc; - BOOL authoritative; - } nm_flags; - int rcode; - int qdcount; - int ancount; - int nscount; - int arcount; - } header; - - struct { - struct nmb_name question_name; - int question_type; - int question_class; - } question; - - struct res_rec *answers; - struct res_rec *nsrecs; - struct res_rec *additional; +struct nmb_packet +{ + struct { + int name_trn_id; + int opcode; + BOOL response; + struct { + BOOL bcast; + BOOL recursion_available; + BOOL recursion_desired; + BOOL trunc; + BOOL authoritative; + } nm_flags; + int rcode; + int qdcount; + int ancount; + int nscount; + int arcount; + } header; + + struct { + struct nmb_name question_name; + int question_type; + int question_class; + } question; + + struct res_rec *answers; + struct res_rec *nsrecs; + struct res_rec *additional; }; /* msg_type field options - from rfc1002. */ @@ -500,23 +517,23 @@ struct nmb_packet { /* A datagram - this normally contains SMB data in the data[] array. */ struct dgram_packet { - struct { - int msg_type; - struct { - enum node_type node_type; - BOOL first; - BOOL more; - } flags; - int dgm_id; - struct in_addr source_ip; - int source_port; - int dgm_length; - int packet_offset; - } header; - struct nmb_name source_name; - struct nmb_name dest_name; - int datasize; - char data[MAX_DGRAM_SIZE]; + struct { + int msg_type; + struct { + enum node_type node_type; + BOOL first; + BOOL more; + } flags; + int dgm_id; + struct in_addr source_ip; + int source_port; + int dgm_length; + int packet_offset; + } header; + struct nmb_name source_name; + struct nmb_name dest_name; + int datasize; + char data[MAX_DGRAM_SIZE]; }; /* Define a structure used to queue packets. This will be a linked @@ -524,18 +541,18 @@ struct dgram_packet { struct packet_struct { - struct packet_struct *next; - struct packet_struct *prev; - BOOL locked; - struct in_addr ip; - int port; - int fd; - time_t timestamp; - enum packet_type packet_type; - union { - struct nmb_packet nmb; - struct dgram_packet dgram; - } packet; + struct packet_struct *next; + struct packet_struct *prev; + BOOL locked; + struct in_addr ip; + int port; + int fd; + time_t timestamp; + enum packet_type packet_type; + union { + struct nmb_packet nmb; + struct dgram_packet dgram; + } packet; }; /* NETLOGON opcodes */ diff --git a/source/include/nt_printing.h b/source/include/nt_printing.h deleted file mode 100644 index 762b1c69170..00000000000 --- a/source/include/nt_printing.h +++ /dev/null @@ -1,484 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-2000, - Copyright (C) Jean Francois Micouleau 1998-2000. - - 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 NT_PRINTING_H_ -#define NT_PRINTING_H_ - -#define ORIENTATION 0x00000001L -#define PAPERSIZE 0x00000002L -#define PAPERLENGTH 0x00000004L -#define PAPERWIDTH 0x00000008L -#define SCALE 0x00000010L -#define COPIES 0x00000100L -#define DEFAULTSOURCE 0x00000200L -#define PRINTQUALITY 0x00000400L -#define COLOR 0x00000800L -#define DUPLEX 0x00001000L -#define YRESOLUTION 0x00002000L -#define TTOPTION 0x00004000L -#define COLLATE 0x00008000L -#define FORMNAME 0x00010000L -#define LOGPIXELS 0x00020000L -#define BITSPERPEL 0x00040000L -#define PELSWIDTH 0x00080000L -#define PELSHEIGHT 0x00100000L -#define DISPLAYFLAGS 0x00200000L -#define DISPLAYFREQUENCY 0x00400000L -#define PANNINGWIDTH 0x00800000L -#define PANNINGHEIGHT 0x01000000L - -#define ORIENT_PORTRAIT 1 -#define ORIENT_LANDSCAPE 2 - -#define PAPER_FIRST PAPER_LETTER -#define PAPER_LETTER 1 /* Letter 8 1/2 x 11 in */ -#define PAPER_LETTERSMALL 2 /* Letter Small 8 1/2 x 11 in */ -#define PAPER_TABLOID 3 /* Tabloid 11 x 17 in */ -#define PAPER_LEDGER 4 /* Ledger 17 x 11 in */ -#define PAPER_LEGAL 5 /* Legal 8 1/2 x 14 in */ -#define PAPER_STATEMENT 6 /* Statement 5 1/2 x 8 1/2 in */ -#define PAPER_EXECUTIVE 7 /* Executive 7 1/4 x 10 1/2 in */ -#define PAPER_A3 8 /* A3 297 x 420 mm */ -#define PAPER_A4 9 /* A4 210 x 297 mm */ -#define PAPER_A4SMALL 10 /* A4 Small 210 x 297 mm */ -#define PAPER_A5 11 /* A5 148 x 210 mm */ -#define PAPER_B4 12 /* B4 (JIS) 250 x 354 */ -#define PAPER_B5 13 /* B5 (JIS) 182 x 257 mm */ -#define PAPER_FOLIO 14 /* Folio 8 1/2 x 13 in */ -#define PAPER_QUARTO 15 /* Quarto 215 x 275 mm */ -#define PAPER_10X14 16 /* 10x14 in */ -#define PAPER_11X17 17 /* 11x17 in */ -#define PAPER_NOTE 18 /* Note 8 1/2 x 11 in */ -#define PAPER_ENV_9 19 /* Envelope #9 3 7/8 x 8 7/8 */ -#define PAPER_ENV_10 20 /* Envelope #10 4 1/8 x 9 1/2 */ -#define PAPER_ENV_11 21 /* Envelope #11 4 1/2 x 10 3/8 */ -#define PAPER_ENV_12 22 /* Envelope #12 4 \276 x 11 */ -#define PAPER_ENV_14 23 /* Envelope #14 5 x 11 1/2 */ -#define PAPER_CSHEET 24 /* C size sheet */ -#define PAPER_DSHEET 25 /* D size sheet */ -#define PAPER_ESHEET 26 /* E size sheet */ -#define PAPER_ENV_DL 27 /* Envelope DL 110 x 220mm */ -#define PAPER_ENV_C5 28 /* Envelope C5 162 x 229 mm */ -#define PAPER_ENV_C3 29 /* Envelope C3 324 x 458 mm */ -#define PAPER_ENV_C4 30 /* Envelope C4 229 x 324 mm */ -#define PAPER_ENV_C6 31 /* Envelope C6 114 x 162 mm */ -#define PAPER_ENV_C65 32 /* Envelope C65 114 x 229 mm */ -#define PAPER_ENV_B4 33 /* Envelope B4 250 x 353 mm */ -#define PAPER_ENV_B5 34 /* Envelope B5 176 x 250 mm */ -#define PAPER_ENV_B6 35 /* Envelope B6 176 x 125 mm */ -#define PAPER_ENV_ITALY 36 /* Envelope 110 x 230 mm */ -#define PAPER_ENV_MONARCH 37 /* Envelope Monarch 3.875 x 7.5 in */ -#define PAPER_ENV_PERSONAL 38 /* 6 3/4 Envelope 3 5/8 x 6 1/2 in */ -#define PAPER_FANFOLD_US 39 /* US Std Fanfold 14 7/8 x 11 in */ -#define PAPER_FANFOLD_STD_GERMAN 40 /* German Std Fanfold 8 1/2 x 12 in */ -#define PAPER_FANFOLD_LGL_GERMAN 41 /* German Legal Fanfold 8 1/2 x 13 in */ - -#define PAPER_LAST PAPER_FANFOLD_LGL_GERMAN -#define PAPER_USER 256 - -#define BIN_FIRST BIN_UPPER -#define BIN_UPPER 1 -#define BIN_ONLYONE 1 -#define BIN_LOWER 2 -#define BIN_MIDDLE 3 -#define BIN_MANUAL 4 -#define BIN_ENVELOPE 5 -#define BIN_ENVMANUAL 6 -#define BIN_AUTO 7 -#define BIN_TRACTOR 8 -#define BIN_SMALLFMT 9 -#define BIN_LARGEFMT 10 -#define BIN_LARGECAPACITY 11 -#define BIN_CASSETTE 14 -#define BIN_FORMSOURCE 15 -#define BIN_LAST BIN_FORMSOURCE - -#define BIN_USER 256 /* device specific bins start here */ - -#define RES_DRAFT (-1) -#define RES_LOW (-2) -#define RES_MEDIUM (-3) -#define RES_HIGH (-4) - -#define COLOR_MONOCHROME 1 -#define COLOR_COLOR 2 - -#define DUP_SIMPLEX 1 -#define DUP_VERTICAL 2 -#define DUP_HORIZONTAL 3 - -#define TT_BITMAP 1 /* print TT fonts as graphics */ -#define TT_DOWNLOAD 2 /* download TT fonts as soft fonts */ -#define TT_SUBDEV 3 /* substitute device fonts for TT fonts */ - -#define COLLATE_FALSE 0 -#define COLLATE_TRUE 1 - -typedef struct nt_printer_driver_info_level_3 -{ - uint32 cversion; - - fstring name; - fstring environment; - fstring driverpath; - fstring datafile; - fstring configfile; - fstring helpfile; - fstring monitorname; - fstring defaultdatatype; - fstring *dependentfiles; -} NT_PRINTER_DRIVER_INFO_LEVEL_3; - -/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ -typedef struct { - uint32 version; - fstring name; - fstring environment; - fstring driverpath; - fstring datafile; - fstring configfile; - fstring helpfile; - fstring monitorname; - fstring defaultdatatype; - fstring mfgname; - fstring oemurl; - fstring hardwareid; - fstring provider; - fstring *dependentfiles; - fstring *previousnames; -} NT_PRINTER_DRIVER_INFO_LEVEL_6; - - -typedef struct nt_printer_driver_info_level -{ - NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; - NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; -} NT_PRINTER_DRIVER_INFO_LEVEL; - -/* predefined registry key names for printer data */ - -#define SPOOL_PRINTERDATA_KEY "PrinterDriverData" -#define SPOOL_DSSPOOLER_KEY "DsSpooler" -#define SPOOL_DSDRIVER_KEY "DsDriver" -#define SPOOL_DSUSER_KEY "DsUser" -#define SPOOL_PNPDATA_KEY "PnPData" -#define SPOOL_OID_KEY "OID" - -/* predefined value names for printer data */ -#define SPOOL_REG_ASSETNUMBER "assetNumber" -#define SPOOL_REG_BYTESPERMINUTE "bytesPerMinute" -#define SPOOL_REG_DEFAULTPRIORITY "defaultPriority" -#define SPOOL_REG_DESCRIPTION "description" -#define SPOOL_REG_DRIVERNAME "driverName" -#define SPOOL_REG_DRIVERVERSION "driverVersion" -#define SPOOL_REG_FLAGS "flags" -#define SPOOL_REG_LOCATION "location" -#define SPOOL_REG_OPERATINGSYSTEM "operatingSystem" -#define SPOOL_REG_OPERATINGSYSTEMHOTFIX "operatingSystemHotfix" -#define SPOOL_REG_OPERATINGSYSTEMSERVICEPACK "operatingSystemServicePack" -#define SPOOL_REG_OPERATINGSYSTEMVERSION "operatingSystemVersion" -#define SPOOL_REG_PORTNAME "portName" -#define SPOOL_REG_PRINTATTRIBUTES "printAttributes" -#define SPOOL_REG_PRINTBINNAMES "printBinNames" -#define SPOOL_REG_PRINTCOLLATE "printCollate" -#define SPOOL_REG_PRINTCOLOR "printColor" -#define SPOOL_REG_PRINTDUPLEXSUPPORTED "printDuplexSupported" -#define SPOOL_REG_PRINTENDTIME "printEndTime" -#define SPOOL_REG_PRINTERNAME "printerName" -#define SPOOL_REG_PRINTFORMNAME "printFormName" -#define SPOOL_REG_PRINTKEEPPRINTEDJOBS "printKeepPrintedJobs" -#define SPOOL_REG_PRINTLANGUAGE "printLanguage" -#define SPOOL_REG_PRINTMACADDRESS "printMACAddress" -#define SPOOL_REG_PRINTMAXCOPIES "printMaxCopies" -#define SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED "printMaxResolutionSupported" -#define SPOOL_REG_PRINTMAXXEXTENT "printMaxXExtent" -#define SPOOL_REG_PRINTMAXYEXTENT "printMaxYExtent" -#define SPOOL_REG_PRINTMEDIAREADY "printMediaReady" -#define SPOOL_REG_PRINTMEDIASUPPORTED "printMediaSupported" -#define SPOOL_REG_PRINTMEMORY "printMemory" -#define SPOOL_REG_PRINTMINXEXTENT "printMinXExtent" -#define SPOOL_REG_PRINTMINYEXTENT "printMinYExtent" -#define SPOOL_REG_PRINTNETWORKADDRESS "printNetworkAddress" -#define SPOOL_REG_PRINTNOTIFY "printNotify" -#define SPOOL_REG_PRINTNUMBERUP "printNumberUp" -#define SPOOL_REG_PRINTORIENTATIONSSUPPORTED "printOrientationsSupported" -#define SPOOL_REG_PRINTOWNER "printOwner" -#define SPOOL_REG_PRINTPAGESPERMINUTE "printPagesPerMinute" -#define SPOOL_REG_PRINTRATE "printRate" -#define SPOOL_REG_PRINTRATEUNIT "printRateUnit" -#define SPOOL_REG_PRINTSEPARATORFILE "printSeparatorFile" -#define SPOOL_REG_PRINTSHARENAME "printShareName" -#define SPOOL_REG_PRINTSPOOLING "printSpooling" -#define SPOOL_REGVAL_PRINTWHILESPOOLING "PrintWhileSpooling" -#define SPOOL_REGVAL_PRINTAFTERSPOOLED "PrintAfterSpooled" -#define SPOOL_REGVAL_PRINTDIRECT "PrintDirect" -#define SPOOL_REG_PRINTSTAPLINGSUPPORTED "printStaplingSupported" -#define SPOOL_REG_PRINTSTARTTIME "printStartTime" -#define SPOOL_REG_PRINTSTATUS "printStatus" -#define SPOOL_REG_PRIORITY "priority" -#define SPOOL_REG_SERVERNAME "serverName" -#define SPOOL_REG_SHORTSERVERNAME "shortServerName" -#define SPOOL_REG_UNCNAME "uNCName" -#define SPOOL_REG_URL "url" -#define SPOOL_REG_VERSIONNUMBER "versionNumber" - -/* container for a single registry key */ - -typedef struct { - char *name; - REGVAL_CTR values; -} NT_PRINTER_KEY; - -/* container for all printer data */ - -typedef struct { - int num_keys; - NT_PRINTER_KEY *keys; -} NT_PRINTER_DATA; - -#define MAXDEVICENAME 32 - -typedef struct ntdevicemode -{ - fstring devicename; - fstring formname; - - uint16 specversion; - uint16 driverversion; - uint16 size; - uint16 driverextra; - uint16 orientation; - uint16 papersize; - uint16 paperlength; - uint16 paperwidth; - uint16 scale; - uint16 copies; - uint16 defaultsource; - uint16 printquality; - uint16 color; - uint16 duplex; - uint16 yresolution; - uint16 ttoption; - uint16 collate; - uint16 logpixels; - - uint32 fields; - uint32 bitsperpel; - uint32 pelswidth; - uint32 pelsheight; - uint32 displayflags; - uint32 displayfrequency; - uint32 icmmethod; - uint32 icmintent; - uint32 mediatype; - uint32 dithertype; - uint32 reserved1; - uint32 reserved2; - uint32 panningwidth; - uint32 panningheight; - uint8 *private; -} NT_DEVICEMODE; - -typedef struct nt_printer_info_level_2 -{ - uint32 attributes; - uint32 priority; - uint32 default_priority; - uint32 starttime; - uint32 untiltime; - uint32 status; - uint32 cjobs; - uint32 averageppm; - fstring servername; - fstring printername; - fstring sharename; - fstring portname; - fstring drivername; - pstring comment; - fstring location; - NT_DEVICEMODE *devmode; - fstring sepfile; - fstring printprocessor; - fstring datatype; - fstring parameters; - NT_PRINTER_DATA data; - SEC_DESC_BUF *secdesc_buf; - uint32 changeid; - uint32 c_setprinter; - uint32 setuptime; -} NT_PRINTER_INFO_LEVEL_2; - -typedef struct nt_printer_info_level -{ - NT_PRINTER_INFO_LEVEL_2 *info_2; -} NT_PRINTER_INFO_LEVEL; - -typedef struct -{ - fstring name; - uint32 flag; - uint32 width; - uint32 length; - uint32 left; - uint32 top; - uint32 right; - uint32 bottom; -} nt_forms_struct; - -/* -typedef struct _form -{ - uint32 flags; - uint32 name_ptr; - uint32 size_x; - uint32 size_y; - uint32 left; - uint32 top; - uint32 right; - uint32 bottom; - UNISTR2 name; -} FORM; -*/ - -#ifndef SAMBA_PRINTER_PORT_NAME -#define SAMBA_PRINTER_PORT_NAME "Samba Printer Port" -#endif - -/* DOS header format */ -#define DOS_HEADER_SIZE 64 -#define DOS_HEADER_MAGIC_OFFSET 0 -#define DOS_HEADER_MAGIC 0x5A4D -#define DOS_HEADER_LFANEW_OFFSET 60 - -/* New Executable format (Win or OS/2 1.x segmented) */ -#define NE_HEADER_SIZE 64 -#define NE_HEADER_SIGNATURE_OFFSET 0 -#define NE_HEADER_SIGNATURE 0x454E -#define NE_HEADER_TARGET_OS_OFFSET 54 -#define NE_HEADER_TARGOS_WIN 0x02 -#define NE_HEADER_MINOR_VER_OFFSET 62 -#define NE_HEADER_MAJOR_VER_OFFSET 63 - -/* Portable Executable format */ -#define PE_HEADER_SIZE 248 -#define PE_HEADER_SIGNATURE_OFFSET 0 -#define PE_HEADER_SIGNATURE 0x00004550 -#define PE_HEADER_MACHINE_OFFSET 4 -#define PE_HEADER_MACHINE_I386 0x14c -#define PE_HEADER_NUMBER_OF_SECTIONS 6 -#define PE_HEADER_MAJOR_OS_VER_OFFSET 64 -#define PE_HEADER_MINOR_OS_VER_OFFSET 66 -#define PE_HEADER_MAJOR_IMG_VER_OFFSET 68 -#define PE_HEADER_MINOR_IMG_VER_OFFSET 70 -#define PE_HEADER_MAJOR_SS_VER_OFFSET 72 -#define PE_HEADER_MINOR_SS_VER_OFFSET 74 -#define PE_HEADER_SECT_HEADER_SIZE 40 -#define PE_HEADER_SECT_NAME_OFFSET 0 -#define PE_HEADER_SECT_SIZE_DATA_OFFSET 16 -#define PE_HEADER_SECT_PTR_DATA_OFFSET 20 - -/* Microsoft file version format */ -#define VS_SIGNATURE "VS_VERSION_INFO" -#define VS_MAGIC_VALUE 0xfeef04bd -#define VS_MAJOR_OFFSET 8 -#define VS_MINOR_OFFSET 12 -#define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */ -#define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */ -#define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */ - -/* Notify spoolss clients that something has changed. The - notification data is either stored in two uint32 values or a - variable length array. */ - -#define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */ - -typedef struct spoolss_notify_msg { - fstring printer; /* Name of printer notified */ - uint32 type; /* Printer or job notify */ - uint32 field; /* Notify field changed */ - uint32 id; /* Job id */ - uint32 len; /* Length of data, 0 for two uint32 value */ - uint32 flags; - union { - uint32 value[2]; - char *data; - } notify; -} SPOOLSS_NOTIFY_MSG; - -typedef struct { - fstring printername; - uint32 num_msgs; - SPOOLSS_NOTIFY_MSG *msgs; -} SPOOLSS_NOTIFY_MSG_GROUP; - -typedef struct { - TALLOC_CTX *ctx; - uint32 num_groups; - SPOOLSS_NOTIFY_MSG_GROUP *msg_groups; -} SPOOLSS_NOTIFY_MSG_CTR; - -#define PRINTER_HANDLE_IS_PRINTER 0 -#define PRINTER_HANDLE_IS_PRINTSERVER 1 - -/* structure to store the printer handles */ -/* and a reference to what it's pointing to */ -/* and the notify info asked about */ -/* that's the central struct */ -typedef struct _Printer{ - struct _Printer *prev, *next; - BOOL document_started; - BOOL page_started; - uint32 jobid; /* jobid in printing backend */ - BOOL printer_type; - TALLOC_CTX *ctx; - union { - fstring handlename; - fstring printerservername; - } dev; - uint32 type; - uint32 access_granted; - struct { - uint32 flags; - uint32 options; - fstring localmachine; - uint32 printerlocal; - SPOOL_NOTIFY_OPTION *option; - POLICY_HND client_hnd; - BOOL client_connected; - uint32 change; - /* are we in a FindNextPrinterChangeNotify() call? */ - BOOL fnpcn; - } notify; - struct { - fstring machine; - fstring user; - } client; - - /* devmode sent in the OpenPrinter() call */ - NT_DEVICEMODE *nt_devmode; - - /* cache the printer info */ - NT_PRINTER_INFO_LEVEL *printer_info; - -} Printer_entry; - -#endif /* NT_PRINTING_H_ */ diff --git a/source/include/ntdomain.h b/source/include/ntdomain.h deleted file mode 100644 index 4e6795a85d5..00000000000 --- a/source/include/ntdomain.h +++ /dev/null @@ -1,417 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - - 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 _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. - */ - -typedef struct _prs_struct -{ - BOOL io; /* parsing in or out of data stream */ - /* - * If the (incoming) data is big-endian. On output we are - * always little-endian. - */ - BOOL bigendian_data; - uint8 align; /* data alignment */ - BOOL is_dynamic; /* Do we own this memory or not ? */ - uint32 data_offset; /* Current working offset into data. */ - uint32 buffer_size; /* Current allocated size of the buffer. */ - uint32 grow_size; /* size requested via prs_grow() calls */ - char *data_p; /* The buffer itself. */ - TALLOC_CTX *mem_ctx; /* When unmarshalling, use this.... */ -} prs_struct; - -/* - * Defines for io member of prs_struct. - */ - -#define MARSHALL 0 -#define UNMARSHALL 1 - -#define MARSHALLING(ps) (!(ps)->io) -#define UNMARSHALLING(ps) ((ps)->io) - -#define RPC_BIG_ENDIAN 1 -#define RPC_LITTLE_ENDIAN 0 - -#define RPC_PARSE_ALIGN 4 - -typedef struct _output_data { - /* - * Raw RPC output data. This does not include RPC headers or footers. - */ - prs_struct rdata; - - /* The amount of data sent from the current rdata struct. */ - uint32 data_sent_length; - - /* - * The current PDU being returned. This inclues - * headers, data and authentication footer. - */ - unsigned char current_pdu[MAX_PDU_FRAG_LEN]; - - /* The amount of data in the current_pdu buffer. */ - uint32 current_pdu_len; - - /* The amount of data sent from the current PDU. */ - uint32 current_pdu_sent; -} output_data; - -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). - */ - unsigned char current_in_pdu[MAX_PDU_FRAG_LEN]; - - /* - * The amount of data needed to complete the in_pdu. - * If this is zero, then we are at the start of a new - * pdu. - */ - uint32 pdu_needed_len; - - /* - * The amount of data received so far in the in_pdu. - * If this is zero, then we are at the start of a new - * pdu. - */ - uint32 pdu_received_len; - - /* - * This is the collection of input data with all - * the rpc headers and auth footers removed. - * The maximum length of this (1Mb) is strictly enforced. - */ - prs_struct data; -} input_data; - -/* - * Handle database - stored per pipe. - */ - -struct policy -{ - struct policy *next, *prev; - - POLICY_HND pol_hnd; - - void *data_ptr; - void (*free_fn)(void *); - -}; - -struct handle_list { - struct policy *Policy; /* List of policies. */ - size_t count; /* Current number of handles. */ - size_t pipe_ref_count; /* Number of pipe handles referring to this 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 */ - - uchar sess_key[8]; /* Session key */ - uchar md4pw[16]; /* md4(machine password) */ - - fstring mach_acct; /* Machine name we've authenticated. */ - - fstring remote_machine; /* Machine name we've authenticated. */ - - BOOL challenge_sent; - BOOL got_session_key; - BOOL authenticated; - -}; - -typedef struct pipe_rpc_fns { - - struct pipe_rpc_fns *next, *prev; - - /* RPC function table associated with the current rpc_bind (associated by context) */ - - struct api_struct *cmds; - int n_cmds; - uint32 context_id; - -} PIPE_RPC_FNS; - -/* - * DCE/RPC-specific samba-internal-specific handling of data on - * NamedPipes. - */ - -typedef struct pipes_struct -{ - struct pipes_struct *next, *prev; - - connection_struct *conn; - uint16 vuid; /* points to the unauthenticated user that opened this pipe. */ - - fstring name; - fstring pipe_srv_name; - - /* linked list of rpc dispatch tables associated - with the open rpc contexts */ - - PIPE_RPC_FNS *contexts; - - 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. */ - - /* Hmm. In my understanding the authentication happens - implicitly later, so there are no two stages for - schannel. */ - - BOOL netsec_auth_validated; - struct netsec_auth_struct netsec_auth; - - /* - * Windows user info. - */ - fstring user_name; - fstring domain; - fstring wks; - - /* - * Unix user name and credentials. - */ - - 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. - */ - - BOOL pipe_bound; - - /* - * Set to true when we should return fault PDU's for everything. - */ - - BOOL fault_state; - - /* - * Set to true when we should return fault PDU's for a bad handle. - */ - - BOOL bad_handle_fault_state; - - /* - * Set to RPC_BIG_ENDIAN when dealing with big-endian PDU's - */ - - BOOL endian; - - /* - * Struct to deal with multiple pdu inputs. - */ - - input_data in_data; - - /* - * Struct to deal with multiple pdu outputs. - */ - - output_data out_data; - - /* talloc context to use when allocating memory on this pipe. */ - TALLOC_CTX *mem_ctx; - - /* handle database to use on this pipe. */ - struct handle_list *pipe_handles; - -} pipes_struct; - -typedef struct smb_np_struct -{ - struct smb_np_struct *next, *prev; - int pnum; - connection_struct *conn; - uint16 vuid; /* points to the unauthenticated user that opened this pipe. */ - BOOL open; /* open connection */ - uint16 device_state; - uint16 priority; - fstring name; - - /* When replying to an SMBtrans, this is the maximum amount of - data that can be sent in the initial reply. */ - int max_trans_reply; - - /* - * NamedPipe state information. - * - * (e.g. typecast a np_struct, above). - */ - void *np_state; - - /* - * NamedPipe functions, to be called to perform - * Named Pipe transactions on request from an - * SMB client. - */ - - /* call to create a named pipe connection. - * returns: state information representing the connection. - * is stored in np_state, above. - */ - void * (*namedpipe_create)(char *pipe_name, - connection_struct *conn, uint16 vuid); - - /* call to perform a write / read namedpipe transaction. - * TransactNamedPipe is weird: it returns whether there - * is more data outstanding to be read, and the - * caller is expected to take note and follow up with - * read requests. - */ - ssize_t (*namedpipe_transact)(void *np_state, - char *data, int len, - char *rdata, int rlen, - BOOL *pipe_outstanding); - - /* call to perform a write namedpipe operation - */ - ssize_t (*namedpipe_write)(void * np_state, - char *data, size_t n); - - /* call to perform a read namedpipe operation. - * - * NOTE: the only reason that the pipe_outstanding - * argument is here is because samba does not use - * the namedpipe_transact function yet: instead, - * it performs the same as what namedpipe_transact - * does - a write, followed by a read. - * - * when samba is modified to use namedpipe_transact, - * the pipe_outstanding argument may be removed. - */ - ssize_t (*namedpipe_read)(void * np_state, - char *data, size_t max_len, - BOOL *pipe_outstanding); - - /* call to close a namedpipe. - * function is expected to perform all cleanups - * necessary, free all memory etc. - * - * returns True if cleanup was successful (not that - * we particularly care). - */ - BOOL (*namedpipe_close)(void * np_state); - -} smb_np_struct; - -struct api_struct -{ - const char *name; - uint8 opnum; - BOOL (*fn) (pipes_struct *); -}; - -typedef struct -{ - uint32 rid; - const char *name; - -} rid_name; - -/* - * higher order functions for use with msrpc client code - */ - -#define PRINT_INFO_FN(fn)\ - void (*fn)(const char*, uint32, uint32, void *const *const) -#define JOB_INFO_FN(fn)\ - void (*fn)(const char*, const char*, uint32, uint32, void *const *const) - -/* end higher order functions */ - - -/* security descriptor structures */ -#include "rpc_secdes.h" - -/* pac */ -#include "authdata.h" - -/* different dce/rpc pipes */ -#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_spoolss.h" -#include "rpc_dfs.h" -#include "rpc_ds.h" -#include "rpc_echo.h" -#include "rpc_epmapper.h" -#include "rpc_shutdown.h" - -#endif /* _NT_DOMAIN_H */ diff --git a/source/include/nterr.h b/source/include/nterr.h index 19c70cffcc9..1b78ad189c8 100644 --- a/source/include/nterr.h +++ b/source/include/nterr.h @@ -561,4 +561,9 @@ #define NT_STATUS_NOT_A_REPARSE_POINT NT_STATUS(0xC0000000 | 0x0275) #define NT_STATUS_NO_SUCH_JOB NT_STATUS(0xC0000000 | 0xEDE) /* scheduler */ + +/* I use NT_STATUS_FOOBAR when I have no idea what error code to use - + * this means we need a torture test */ +#define NT_STATUS_FOOBAR NT_STATUS_UNSUCCESSFUL + #endif /* _NTERR_H */ diff --git a/source/include/ntioctl.h b/source/include/ntioctl.h deleted file mode 100644 index 9814c88e5e5..00000000000 --- a/source/include/ntioctl.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Unix SMB/CIFS implementation. - NT ioctl code constants - Copyright (C) Andrew Tridgell 2002 - - 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. -*/ - -/* - I'm guessing we will need to support a bunch of these eventually. For now - we only need the sparse flag -*/ - -#ifndef _NTIOCTL_H -#define _NTIOCTL_H - -/* IOCTL information */ -/* List of ioctl function codes that look to be of interest to remote clients like this. */ -/* Need to do some experimentation to make sure they all work remotely. */ -/* Some of the following such as the encryption/compression ones would be */ -/* invoked from tools via a specialized hook into the VFS rather than via the */ -/* standard vfs entry points */ -#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 -#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 -#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 -#define FSCTL_LOCK_VOLUME 0x00090018 -#define FSCTL_UNLOCK_VOLUME 0x0009001C -#define FSCTL_GET_COMPRESSION 0x0009003C -#define FSCTL_SET_COMPRESSION 0x0009C040 -#define FSCTL_REQUEST_FILTER_OPLOCK 0x0009008C -#define FSCTL_FIND_FILES_BY_SID 0x0009008F -#define FSCTL_FILESYS_GET_STATISTICS 0x00090090 -#define FSCTL_SET_REPARSE_POINT 0x000900A4 -#define FSCTL_GET_REPARSE_POINT 0x000900A8 -#define FSCTL_DELETE_REPARSE_POINT 0x000900AC -#define FSCTL_0x000900C0 0x000900C0 -#define FSCTL_SET_SPARSE 0x000900C4 -#define FSCTL_SET_ZERO_DATA 0x000900C8 -#define FSCTL_SET_ENCRYPTION 0x000900D7 -#define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB -#define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF -#define FSCTL_READ_RAW_ENCRYPTED 0x000900E3 -#define FSCTL_SIS_COPYFILE 0x00090100 -#define FSCTL_SIS_LINK_FILES 0x0009C104 - -#define FSCTL_GET_SHADOW_COPY_DATA 0x00144064 /* KJC -- Shadow Copy information */ - -#if 0 -#define FSCTL_SECURITY_ID_CHECK -#define FSCTL_DISMOUNT_VOLUME -#define FSCTL_GET_NTFS_FILE_RECORD -#define FSCTL_ALLOW_EXTENDED_DASD_IO -#define FSCTL_RECALL_FILE -#define FSCTL_QUERY_ALLOCATED_RANGES - -#endif - -#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 -#define IO_REPARSE_TAG_HSM 0xC0000004 -#define IO_REPARSE_TAG_SIS 0x80000007 - - -/* For FSCTL_GET_SHADOW_COPY_DATA ...*/ -typedef char SHADOW_COPY_LABEL[25]; - -typedef struct shadow_copy_data { - TALLOC_CTX *mem_ctx; - /* Total number of shadow volumes currently mounted */ - uint32 num_volumes; - /* Concatenated list of labels */ - SHADOW_COPY_LABEL *labels; -} SHADOW_COPY_DATA; - - -#endif /* _NTIOCTL_H */ diff --git a/source/include/ntlmssp.h b/source/include/ntlmssp.h deleted file mode 100644 index 24ac7967615..00000000000 --- a/source/include/ntlmssp.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - - 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. -*/ - -/* NTLMSSP mode */ -enum NTLMSSP_ROLE -{ - NTLMSSP_SERVER, - NTLMSSP_CLIENT -}; - -/* NTLMSSP message types */ -enum NTLM_MESSAGE_TYPE -{ - NTLMSSP_INITIAL = 0 /* samba internal state */, - NTLMSSP_NEGOTIATE = 1, - NTLMSSP_CHALLENGE = 2, - NTLMSSP_AUTH = 3, - NTLMSSP_UNKNOWN = 4 -}; - -/* NTLMSSP negotiation flags */ -#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001 -#define NTLMSSP_NEGOTIATE_OEM 0x00000002 -#define NTLMSSP_REQUEST_TARGET 0x00000004 -#define NTLMSSP_NEGOTIATE_SIGN 0x00000010 /* Message integrity */ -#define NTLMSSP_NEGOTIATE_SEAL 0x00000020 /* Message confidentiality */ -#define NTLMSSP_NEGOTIATE_DATAGRAM_STYLE 0x00000040 -#define NTLMSSP_NEGOTIATE_LM_KEY 0x00000080 -#define NTLMSSP_NEGOTIATE_NETWARE 0x00000100 -#define NTLMSSP_NEGOTIATE_NTLM 0x00000200 -#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x00001000 -#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x00002000 -#define NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL 0x00004000 -#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000 -#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 -#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 -#define NTLMSSP_CHAL_INIT_RESPONSE 0x00010000 - -#define NTLMSSP_CHAL_ACCEPT_RESPONSE 0x00020000 -#define NTLMSSP_CHAL_NON_NT_SESSION_KEY 0x00040000 -#define NTLMSSP_NEGOTIATE_NTLM2 0x00080000 -#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_NAME_TYPE_SERVER 0x01 -#define NTLMSSP_NAME_TYPE_DOMAIN 0x02 -#define NTLMSSP_NAME_TYPE_SERVER_DNS 0x03 -#define NTLMSSP_NAME_TYPE_DOMAIN_DNS 0x04 - -typedef struct ntlmssp_state -{ - TALLOC_CTX *mem_ctx; - unsigned int ref_count; - enum NTLMSSP_ROLE role; - enum server_types server_role; - uint32 expected_state; - - BOOL unicode; - BOOL use_ntlmv2; - char *user; - char *domain; - char *workstation; - char *password; - char *server_domain; - - DATA_BLOB internal_chal; /* Random challenge as supplied to the client for NTLM authentication */ - - DATA_BLOB chal; /* Random challenge as input into the actual NTLM (or NTLM2) authentication */ - DATA_BLOB lm_resp; - DATA_BLOB nt_resp; - DATA_BLOB session_key; - - uint32 neg_flags; /* the current state of negotiation with the NTLMSSP partner */ - - void *auth_context; - - /** - * Callback to get the 'challenge' used for NTLM authentication. - * - * @param ntlmssp_state This structure - * @return 8 bytes of challnege data, determined by the server to be the challenge for NTLM authentication - * - */ - const uint8 *(*get_challenge)(const struct ntlmssp_state *ntlmssp_state); - - /** - * Callback to find if the challenge used by NTLM authentication may be modified - * - * The NTLM2 authentication scheme modifies the effective challenge, but this is not compatiable with the - * current 'security=server' implementation.. - * - * @param ntlmssp_state This structure - * @return Can the challenge be set to arbitary values? - * - */ - BOOL (*may_set_challenge)(const struct ntlmssp_state *ntlmssp_state); - - /** - * Callback to set the 'challenge' used for NTLM authentication. - * - * The callback may use the void *auth_context to store state information, but the same value is always available - * from the DATA_BLOB chal on this structure. - * - * @param ntlmssp_state This structure - * @param challange 8 bytes of data, agreed by the client and server to be the effective challenge for NTLM2 authentication - * - */ - NTSTATUS (*set_challenge)(struct ntlmssp_state *ntlmssp_state, DATA_BLOB *challenge); - - /** - * Callback to check the user's password. - * - * The callback must reads the feilds of this structure for the information it needs on the user - * @param ntlmssp_state This structure - * @param nt_session_key If an NT session key is returned by the authentication process, return it here - * @param lm_session_key If an LM session key is returned by the authentication process, return it here - * - */ - NTSTATUS (*check_password)(struct ntlmssp_state *ntlmssp_state, DATA_BLOB *nt_session_key, DATA_BLOB *lm_session_key); - - 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]; - - /* ntlmv1 */ - unsigned char ntlmssp_hash[258]; - - /* it turns out that we don't always get the - response in at the time we want to process it. - Store it here, until we need it */ - DATA_BLOB stored_response; - -} NTLMSSP_STATE; - diff --git a/source/include/ntquotas.h b/source/include/ntquotas.h deleted file mode 100644 index dac1173770b..00000000000 --- a/source/include/ntquotas.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Unix SMB/CIFS implementation. - NT QUOTA code constants - Copyright (C) Stefan (metze) Metzmacher 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _NTQUOTAS_H -#define _NTQUOTAS_H - -/* - * details for Quota Flags: - * - * 0x20 Log Limit: log if the user exceeds his Hard Quota - * 0x10 Log Warn: log if the user exceeds his Soft Quota - * 0x02 Deny Disk: deny disk access when the user exceeds his Hard Quota - * 0x01 Enable Quotas: enable quota for this fs - * - */ - -#define QUOTAS_ENABLED 0x0001 -#define QUOTAS_DENY_DISK 0x0002 -#define QUOTAS_LOG_VIOLATIONS 0x0004 -#define CONTENT_INDEX_DISABLED 0x0008 -#define QUOTAS_LOG_THRESHOLD 0x0010 -#define QUOTAS_LOG_LIMIT 0x0020 -#define LOG_VOLUME_THRESHOLD 0x0040 -#define LOG_VOLUME_LIMIT 0x0080 -#define QUOTAS_INCOMPLETE 0x0100 -#define QUOTAS_REBUILDING 0x0200 -#define QUOTAS_0400 0x0400 -#define QUOTAS_0800 0x0800 -#define QUOTAS_1000 0x1000 -#define QUOTAS_2000 0x2000 -#define QUOTAS_4000 0x4000 -#define QUOTAS_8000 0x8000 - -#define SMB_NTQUOTAS_NO_LIMIT ((SMB_BIG_UINT)(-1)) -#define SMB_NTQUOTAS_NO_ENTRY ((SMB_BIG_UINT)(-2)) -#define SMB_NTQUOTAS_NO_SPACE ((SMB_BIG_UINT)(0)) -#define SMB_NTQUOTAS_1_B (SMB_BIG_UINT)0x0000000000000001 -#define SMB_NTQUOTAS_1KB (SMB_BIG_UINT)0x0000000000000400 -#define SMB_NTQUOTAS_1MB (SMB_BIG_UINT)0x0000000000100000 -#define SMB_NTQUOTAS_1GB (SMB_BIG_UINT)0x0000000040000000 -#define SMB_NTQUOTAS_1TB (SMB_BIG_UINT)0x0000010000000000 -#define SMB_NTQUOTAS_1PB (SMB_BIG_UINT)0x0004000000000000 -#define SMB_NTQUOTAS_1EB (SMB_BIG_UINT)0x1000000000000000 - -enum SMB_QUOTA_TYPE { - SMB_INVALID_QUOTA_TYPE = -1, - SMB_USER_FS_QUOTA_TYPE = 1, - SMB_USER_QUOTA_TYPE = 2, - SMB_GROUP_FS_QUOTA_TYPE = 3,/* not used yet */ - SMB_GROUP_QUOTA_TYPE = 4 /* not in use yet, maybe for disk_free queries */ -}; - -typedef struct _SMB_NTQUOTA_STRUCT { - enum SMB_QUOTA_TYPE qtype; - SMB_BIG_UINT usedspace; - SMB_BIG_UINT softlim; - SMB_BIG_UINT hardlim; - uint32 qflags; - DOM_SID sid; -} SMB_NTQUOTA_STRUCT; - -typedef struct _SMB_NTQUOTA_LIST { - struct _SMB_NTQUOTA_LIST *prev,*next; - TALLOC_CTX *mem_ctx; - uid_t uid; - SMB_NTQUOTA_STRUCT *quotas; -} SMB_NTQUOTA_LIST; - -typedef struct _SMB_NTQUOTA_HANDLE { - BOOL valid; - SMB_NTQUOTA_LIST *quota_list; - SMB_NTQUOTA_LIST *tmp_list; -} SMB_NTQUOTA_HANDLE; - -#define CHECK_NTQUOTA_HANDLE_OK(fsp,conn) (FNUM_OK(fsp,conn) &&\ - (fsp)->fake_file_handle &&\ - ((fsp)->fake_file_handle->type == FAKE_FILE_TYPE_QUOTA) &&\ - (fsp)->fake_file_handle->pd) - -#endif /*_NTQUOTAS_H */ diff --git a/source/include/passdb.h b/source/include/passdb.h deleted file mode 100644 index baf0e23a20c..00000000000 --- a/source/include/passdb.h +++ /dev/null @@ -1,573 +0,0 @@ -/* - Unix SMB/CIFS implementation. - passdb structures and parameters - Copyright (C) Gerald Carter 2001 - Copyright (C) Luke Kenneth Casson Leighton 1998 - 2000 - Copyright (C) Andrew Bartlett 2002 - Copyright (C) Simo Sorce 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _PASSDB_H -#define _PASSDB_H - - -/* - * fields_present flags meanings - * same names as found in samba4 idl files - */ - -#define ACCT_USERNAME 0x00000001 -#define ACCT_FULL_NAME 0x00000002 -#define ACCT_RID 0x00000004 -#define ACCT_PRIMARY_GID 0x00000008 -#define ACCT_ADMIN_DESC 0x00000010 -#define ACCT_DESCRIPTION 0x00000020 -#define ACCT_HOME_DIR 0x00000040 -#define ACCT_HOME_DRIVE 0x00000080 -#define ACCT_LOGON_SCRIPT 0x00000100 -#define ACCT_PROFILE 0x00000200 -#define ACCT_WORKSTATIONS 0x00000400 -#define ACCT_LAST_LOGON 0x00000800 -#define ACCT_LAST_LOGOFF 0x00001000 -#define ACCT_LOGON_HOURS 0x00002000 -#define ACCT_BAD_PWD_COUNT 0x00004000 -#define ACCT_NUM_LOGONS 0x00008000 -#define ACCT_ALLOW_PWD_CHANGE 0x00010000 -#define ACCT_FORCE_PWD_CHANGE 0x00020000 -#define ACCT_LAST_PWD_CHANGE 0x00040000 -#define ACCT_EXPIRY 0x00080000 -#define ACCT_FLAGS 0x00100000 -#define ACCT_CALLBACK 0x00200000 -#define ACCT_COUNTRY_CODE 0x00400000 -#define ACCT_CODE_PAGE 0x00800000 -#define ACCT_NT_PWD_SET 0x01000000 -#define ACCT_LM_PWD_SET 0x02000000 -#define ACCT_PRIVATEDATA 0x04000000 -#define ACCT_EXPIRED_FLAG 0x08000000 -#define ACCT_SEC_DESC 0x10000000 -#define ACCT_OWF_PWD 0x20000000 - -/* - * bit flags representing initialized fields in SAM_ACCOUNT - */ -enum pdb_elements { - PDB_UNINIT, - PDB_SMBHOME, - PDB_PROFILE, - PDB_DRIVE, - PDB_LOGONSCRIPT, - PDB_LOGONTIME, - PDB_LOGOFFTIME, - PDB_KICKOFFTIME, - PDB_BAD_PASSWORD_TIME, - PDB_CANCHANGETIME, - PDB_MUSTCHANGETIME, - PDB_PLAINTEXT_PW, - PDB_USERNAME, - PDB_FULLNAME, - PDB_DOMAIN, - PDB_NTUSERNAME, - PDB_HOURSLEN, - PDB_LOGONDIVS, - PDB_USERSID, - PDB_GROUPSID, - PDB_ACCTCTRL, - PDB_PASSLASTSET, - PDB_UNIXHOMEDIR, - PDB_ACCTDESC, - PDB_WORKSTATIONS, - PDB_UNKNOWNSTR, - PDB_MUNGEDDIAL, - PDB_HOURS, - PDB_FIELDS_PRESENT, - PDB_BAD_PASSWORD_COUNT, - PDB_LOGON_COUNT, - PDB_UNKNOWN6, - PDB_LMPASSWD, - PDB_NTPASSWD, - PDB_BACKEND_PRIVATE_DATA, - - /* this must be the last element */ - PDB_COUNT -}; - -enum pdb_group_elements { - PDB_GROUP_NAME, - PDB_GROUP_SID, - PDB_GROUP_SID_NAME_USE, - PDB_GROUP_MEMBERS, - - /* this must be the last element */ - PDB_GROUP_COUNT -}; - -enum pdb_trust_passwd_elements { - PDB_TRUST_PASS, - PDB_TRUST_SID, - PDB_TRUST_NAME, - PDB_TRUST_MODTIME, - PDB_TRUST_FLAGS, - - PDB_TRUST_COUNT -}; - -enum pdb_value_state { - PDB_DEFAULT=0, - PDB_SET, - PDB_CHANGED -}; - -#define IS_SAM_SET(x, flag) (pdb_get_init_flags(x, flag) == PDB_SET) -#define IS_SAM_CHANGED(x, flag) (pdb_get_init_flags(x, flag) == PDB_CHANGED) -#define IS_SAM_DEFAULT(x, flag) (pdb_get_init_flags(x, flag) == PDB_DEFAULT) - -/* cache for bad password lockout data, to be used on replicated SAMs */ -typedef struct logon_cache_struct -{ - time_t entry_timestamp; - uint16 acct_ctrl; - uint16 bad_password_count; - time_t bad_password_time; -} LOGIN_CACHE; - -typedef struct sam_passwd -{ - TALLOC_CTX *mem_ctx; - - void (*free_fn)(struct sam_passwd **); - - struct pdb_methods *methods; - - struct user_data { - /* initialization flags */ - struct bitmap *change_flags; - struct bitmap *set_flags; - - time_t logon_time; /* logon time */ - time_t logoff_time; /* logoff time */ - time_t kickoff_time; /* kickoff time */ - time_t bad_password_time; /* last bad password entered */ - time_t pass_last_set_time; /* password last set time */ - time_t pass_can_change_time; /* password can change time */ - time_t pass_must_change_time; /* password must change time */ - - const char * username; /* UNIX username string */ - const char * domain; /* Windows Domain name */ - const char * nt_username; /* Windows username string */ - const char * full_name; /* user's full name string */ - const char * unix_home_dir; /* UNIX home directory string */ - const char * home_dir; /* home directory string */ - const char * dir_drive; /* home directory drive string */ - const char * logon_script; /* logon script string */ - const char * profile_path; /* profile path string */ - const char * acct_desc ; /* user description string */ - const char * workstations; /* login from workstations string */ - const char * unknown_str ; /* don't know what this is, yet. */ - const char * munged_dial ; /* munged path name and dial-back tel number */ - - DOM_SID user_sid; /* Primary User SID */ - DOM_SID group_sid; /* Primary Group SID */ - - DATA_BLOB lm_pw; /* .data is Null if no password */ - DATA_BLOB nt_pw; /* .data is Null if no password */ - char* plaintext_pw; /* is Null if not available */ - - uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ - uint32 fields_present; /* 0x00ff ffff */ - - uint16 logon_divs; /* 168 - number of hours in a week */ - uint32 hours_len; /* normally 21 bytes */ - uint8 hours[MAX_HOURS_LEN]; - - /* Was unknown_5. */ - uint16 bad_password_count; - uint16 logon_count; - - uint32 unknown_6; /* 0x0000 04ec */ - /* a tag for who added the private methods */ - const struct pdb_methods *backend_private_methods; - void *backend_private_data; - void (*backend_private_data_free_fn)(void **); - } private; - - /* Lets see if the remaining code can get the hint that you - are meant to use the pdb_...() functions. */ - -} SAM_ACCOUNT; - -typedef struct sam_group { - TALLOC_CTX *mem_ctx; - - void (*free_fn)(struct sam_group **); - - struct pdb_methods *methods; - - struct group_data { - /* initialization flags */ - struct bitmap *change_flags; - struct bitmap *set_flags; - - const char *name; /* Windows group name string */ - - DOM_SID sid; /* Group SID */ - enum SID_NAME_USE sid_name_use; /* Group type */ - - uint32 mem_num; /* Number of member SIDs */ - DOM_SID *members; /* SID array */ - } private; - -} SAM_GROUP; - - -typedef struct _GROUP_INFO { - struct pdb_methods *methods; - DOM_SID sid; - enum SID_NAME_USE sid_name_use; - fstring nt_name; - fstring comment; -} GROUP_INFO; - -struct acct_info -{ - fstring acct_name; /* account name */ - fstring acct_desc; /* account name */ - uint32 rid; /* domain-relative RID */ -}; - -typedef struct sam_trust_passwd { - TALLOC_CTX *mem_ctx; - - void (*free_fn)(struct sam_trust_passwd **); - - struct pdb_methods *methods; - - struct trust_passwd_data { - uint16 flags; /* flags */ - size_t uni_name_len; /* unicode name length */ - smb_ucs2_t uni_name[32]; /* unicode domain name */ - fstring pass; /* trust password */ - time_t mod_time; /* last change time */ - DOM_SID domain_sid; /* trusted domain sid */ - } private; - -} SAM_TRUST_PASSWD; - - - -/***************************************************************** - Functions to be implemented by the new (v2) passdb API -****************************************************************/ - -/* - * This next constant specifies the version number of the PASSDB interface - * this SAMBA will load. Increment this if *ANY* changes are made to the interface. - */ - -#define PASSDB_INTERFACE_VERSION 7 - -typedef struct pdb_context -{ - struct pdb_methods *pdb_methods; - struct pdb_methods *pwent_methods; - - /* These functions are wrappers for the functions listed above. - They may do extra things like re-reading a SAM_ACCOUNT on update */ - - NTSTATUS (*pdb_setsampwent)(struct pdb_context *, BOOL update); - - void (*pdb_endsampwent)(struct pdb_context *); - - NTSTATUS (*pdb_getsampwent)(struct pdb_context *, SAM_ACCOUNT *user); - - NTSTATUS (*pdb_getsampwnam)(struct pdb_context *, SAM_ACCOUNT *sam_acct, const char *username); - - NTSTATUS (*pdb_getsampwsid)(struct pdb_context *, SAM_ACCOUNT *sam_acct, const DOM_SID *sid); - - NTSTATUS (*pdb_add_sam_account)(struct pdb_context *, SAM_ACCOUNT *sampass); - - NTSTATUS (*pdb_update_sam_account)(struct pdb_context *, SAM_ACCOUNT *sampass); - - NTSTATUS (*pdb_delete_sam_account)(struct pdb_context *, SAM_ACCOUNT *username); - - /* group mapping functions: to be removed */ - - NTSTATUS (*pdb_getgrsid)(struct pdb_context *context, GROUP_MAP *map, DOM_SID sid); - - NTSTATUS (*pdb_getgrgid)(struct pdb_context *context, GROUP_MAP *map, gid_t gid); - - NTSTATUS (*pdb_getgrnam)(struct pdb_context *context, GROUP_MAP *map, const char *name); - - NTSTATUS (*pdb_add_group_mapping_entry)(struct pdb_context *context, - GROUP_MAP *map); - - NTSTATUS (*pdb_update_group_mapping_entry)(struct pdb_context *context, - GROUP_MAP *map); - - NTSTATUS (*pdb_delete_group_mapping_entry)(struct pdb_context *context, - DOM_SID sid); - - NTSTATUS (*pdb_enum_group_mapping)(struct pdb_context *context, - enum SID_NAME_USE sid_name_use, - GROUP_MAP **rmap, int *num_entries, - BOOL unix_only); - - NTSTATUS (*pdb_find_alias)(struct pdb_context *context, - const char *name, DOM_SID *sid); - - NTSTATUS (*pdb_create_alias)(struct pdb_context *context, - const char *name, uint32 *rid); - - NTSTATUS (*pdb_delete_alias)(struct pdb_context *context, - const DOM_SID *sid); - - NTSTATUS (*pdb_enum_aliases)(struct pdb_context *context, - const DOM_SID *domain_sid, - uint32 start_idx, uint32 num_entries, - uint32 *num_aliases, - struct acct_info **aliases); - - NTSTATUS (*pdb_get_aliasinfo)(struct pdb_context *context, - const DOM_SID *sid, - struct acct_info *info); - - NTSTATUS (*pdb_set_aliasinfo)(struct pdb_context *context, - const DOM_SID *sid, - struct acct_info *info); - - NTSTATUS (*pdb_add_aliasmem)(struct pdb_context *context, - const DOM_SID *alias, - const DOM_SID *member); - - NTSTATUS (*pdb_del_aliasmem)(struct pdb_context *context, - const DOM_SID *alias, - const DOM_SID *member); - - NTSTATUS (*pdb_enum_aliasmem)(struct pdb_context *context, - const DOM_SID *alias, - DOM_SID **members, int *num_members); - - NTSTATUS (*pdb_enum_alias_memberships)(struct pdb_context *context, - const DOM_SID *alias, - DOM_SID **aliases, - int *num); - - /* group functions */ - - NTSTATUS (*pdb_get_group_info_by_sid)(struct pdb_context *context, GROUP_INFO *info, const DOM_SID *group); - - NTSTATUS (*pdb_get_group_list)(struct pdb_context *context, GROUP_INFO **info, const enum SID_NAME_USE sid_name_use, int *num_groups); - - NTSTATUS (*pdb_get_group_sids)(struct pdb_context *context, const DOM_SID *group, DOM_SID **members, int *num_members); - - NTSTATUS (*pdb_add_group)(struct pdb_context *context, const SAM_GROUP *group); - - NTSTATUS (*pdb_update_group)(struct pdb_context *context, const SAM_GROUP *group); - - NTSTATUS (*pdb_delete_group)(struct pdb_context *context, const DOM_SID *group); - - NTSTATUS (*pdb_add_sid_to_group)(struct pdb_context *context, const DOM_SID *group, const DOM_SID *member); - - NTSTATUS (*pdb_remove_sid_from_group)(struct pdb_context *context, const DOM_SID *group, const DOM_SID *member); - - NTSTATUS (*pdb_get_group_info_by_name)(struct pdb_context *context, GROUP_INFO *info, const char *name); - - NTSTATUS (*pdb_get_group_info_by_nt_name)(struct pdb_context *context, GROUP_INFO *info, const char *nt_name); - - NTSTATUS (*pdb_get_group_uids)(struct pdb_context *context, const DOM_SID *group, uid_t **members, int *num_members); - - /* trust password functions */ - - NTSTATUS (*pdb_settrustpwent)(struct pdb_context *context); - - NTSTATUS (*pdb_gettrustpwent)(struct pdb_context *context, SAM_TRUST_PASSWD *trust); - - NTSTATUS (*pdb_gettrustpwnam)(struct pdb_context *context, SAM_TRUST_PASSWD *trust, const char *dom_name); - - NTSTATUS (*pdb_gettrustpwsid)(struct pdb_context *context, SAM_TRUST_PASSWD *trust, const DOM_SID *sid); - - NTSTATUS (*pdb_add_trust_passwd)(struct pdb_context *context, SAM_TRUST_PASSWD* trust); - - NTSTATUS (*pdb_update_trust_passwd)(struct pdb_context *context, SAM_TRUST_PASSWD* trust); - - NTSTATUS (*pdb_delete_trust_passwd)(struct pdb_context *context, SAM_TRUST_PASSWD* trust); - - /* privileges functions */ - - NTSTATUS (*pdb_add_sid_to_privilege)(struct pdb_context *context, const char *priv_name, const DOM_SID *sid); - - NTSTATUS (*pdb_remove_sid_from_privilege)(struct pdb_context *context, const char *priv_name, const DOM_SID *sid); - - NTSTATUS (*pdb_get_privilege_set)(struct pdb_context *context, DOM_SID *user_sids, int num_sids, PRIVILEGE_SET *privs); - - NTSTATUS (*pdb_get_privilege_entry)(struct pdb_context *context, const char *privname, char **sid_list); - - void (*free_fn)(struct pdb_context **); - - TALLOC_CTX *mem_ctx; - -} PDB_CONTEXT; - -typedef struct pdb_methods -{ - const char *name; /* What name got this module */ - struct pdb_context *parent; - - /* Use macros from dlinklist.h on these two */ - struct pdb_methods *next; - struct pdb_methods *prev; - - NTSTATUS (*setsampwent)(struct pdb_methods *, BOOL update); - - void (*endsampwent)(struct pdb_methods *); - - NTSTATUS (*getsampwent)(struct pdb_methods *, SAM_ACCOUNT *user); - - NTSTATUS (*getsampwnam)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const char *username); - - NTSTATUS (*getsampwsid)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const DOM_SID *sid); - - NTSTATUS (*add_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass); - - NTSTATUS (*update_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass); - - NTSTATUS (*delete_sam_account)(struct pdb_methods *, SAM_ACCOUNT *username); - - /* group mapping functions: to be removed */ - - NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map, DOM_SID sid); - - NTSTATUS (*getgrgid)(struct pdb_methods *methods, GROUP_MAP *map, gid_t gid); - - NTSTATUS (*getgrnam)(struct pdb_methods *methods, GROUP_MAP *map, const char *name); - - NTSTATUS (*add_group_mapping_entry)(struct pdb_methods *methods, - GROUP_MAP *map); - - NTSTATUS (*update_group_mapping_entry)(struct pdb_methods *methods, - GROUP_MAP *map); - - NTSTATUS (*delete_group_mapping_entry)(struct pdb_methods *methods, - DOM_SID sid); - - NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods, - enum SID_NAME_USE sid_name_use, - GROUP_MAP **rmap, int *num_entries, - BOOL unix_only); - - NTSTATUS (*find_alias)(struct pdb_methods *methods, - const char *name, DOM_SID *sid); - - NTSTATUS (*create_alias)(struct pdb_methods *methods, - const char *name, uint32 *rid); - - NTSTATUS (*delete_alias)(struct pdb_methods *methods, - const DOM_SID *sid); - - NTSTATUS (*enum_aliases)(struct pdb_methods *methods, - const DOM_SID *domain_sid, - uint32 start_idx, uint32 max_entries, - uint32 *num_aliases, struct acct_info **info); - - NTSTATUS (*get_aliasinfo)(struct pdb_methods *methods, - const DOM_SID *sid, - struct acct_info *info); - - NTSTATUS (*set_aliasinfo)(struct pdb_methods *methods, - const DOM_SID *sid, - struct acct_info *info); - - NTSTATUS (*add_aliasmem)(struct pdb_methods *methods, - const DOM_SID *alias, const DOM_SID *member); - NTSTATUS (*del_aliasmem)(struct pdb_methods *methods, - const DOM_SID *alias, const DOM_SID *member); - NTSTATUS (*enum_aliasmem)(struct pdb_methods *methods, - const DOM_SID *alias, DOM_SID **members, - int *num_members); - NTSTATUS (*enum_alias_memberships)(struct pdb_methods *methods, - const DOM_SID *sid, - DOM_SID **aliases, int *num); - - /* group functions */ - - NTSTATUS (*get_group_info_by_sid)(struct pdb_methods *methods, GROUP_INFO *info, const DOM_SID *group); - - NTSTATUS (*get_group_list)(struct pdb_methods *methods, GROUP_INFO **info, const enum SID_NAME_USE sid_name_use, int *num_groups); - - NTSTATUS (*get_group_sids)(struct pdb_methods *methods, const DOM_SID *group, DOM_SID **members, int *num_members); - - NTSTATUS (*add_group)(struct pdb_methods *methods, const SAM_GROUP *group); - - NTSTATUS (*update_group)(struct pdb_methods *methods, const SAM_GROUP *group); - - NTSTATUS (*delete_group)(struct pdb_methods *methods, const DOM_SID *group); - - NTSTATUS (*add_sid_to_group)(struct pdb_methods *methods, const DOM_SID *group, const DOM_SID *member); - - NTSTATUS (*remove_sid_from_group)(struct pdb_methods *methods, const DOM_SID *group, const DOM_SID *member); - - NTSTATUS (*get_group_info_by_name)(struct pdb_methods *methods, GROUP_INFO *info, const char *name); - - NTSTATUS (*get_group_info_by_nt_name)(struct pdb_methods *methods, GROUP_INFO *info, const char *nt_name); - - NTSTATUS (*get_group_uids)(struct pdb_methods *methods, const DOM_SID *group, uid_t **members, int *num_members); - - void *private_data; /* Private data of some kind */ - - void (*free_private_data)(void **); - - /* trust password functions */ - - NTSTATUS (*settrustpwent)(struct pdb_methods *methods); - - NTSTATUS (*gettrustpwent)(struct pdb_methods *methods, SAM_TRUST_PASSWD *trust); - - NTSTATUS (*gettrustpwnam)(struct pdb_methods *methods, SAM_TRUST_PASSWD *trust, const char *name); - - NTSTATUS (*gettrustpwsid)(struct pdb_methods *methods, SAM_TRUST_PASSWD *trust, const DOM_SID *sid); - - NTSTATUS (*add_trust_passwd)(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust); - - NTSTATUS (*update_trust_passwd)(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust); - - NTSTATUS (*delete_trust_passwd)(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust); - - /* privileges functions */ - - NTSTATUS (*add_sid_to_privilege)(struct pdb_methods *methods, const char *priv_name, const DOM_SID *sid); - - NTSTATUS (*remove_sid_from_privilege)(struct pdb_methods *methods, const char *priv_name, const DOM_SID *sid); - - NTSTATUS (*get_privilege_set)(struct pdb_methods *methods, DOM_SID *user_sids, int num_sids, PRIVILEGE_SET *privs); - - NTSTATUS (*get_privilege_entry)(struct pdb_methods *methods, const char *privname, char **sid_list); - -} PDB_METHODS; - -typedef NTSTATUS (*pdb_init_function)(struct pdb_context *, - struct pdb_methods **, - const char *); - -struct pdb_init_function_entry { - const char *name; - /* Function to create a member of the pdb_methods list */ - pdb_init_function init; - struct pdb_init_function_entry *prev, *next; -}; - -enum sql_search_field { SQL_SEARCH_NONE = 0, SQL_SEARCH_USER_SID = 1, SQL_SEARCH_USER_NAME = 2}; - -#endif /* _PASSDB_H */ diff --git a/source/include/popt_common.h b/source/include/popt_common.h index 6db30fbc0ac..57850bf6826 100644 --- a/source/include/popt_common.h +++ b/source/include/popt_common.h @@ -41,7 +41,6 @@ struct user_auth_info { pstring password; BOOL got_pass; BOOL use_kerberos; - int signing_state; }; extern struct user_auth_info cmdline_auth_info; diff --git a/source/include/printing.h b/source/include/printing.h deleted file mode 100644 index bf7c61b251e..00000000000 --- a/source/include/printing.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef PRINTING_H_ -#define PRINTING_H_ - -/* - Unix SMB/CIFS implementation. - printing definitions - Copyright (C) Andrew Tridgell 1992-2000 - - 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. -*/ - -/* - This file defines the low-level printing system interfaces used by the - SAMBA printing subsystem. -*/ - -/* Information for print jobs */ -struct printjob { - pid_t pid; /* which process launched the job */ - int sysjob; /* the system (lp) job number */ - int fd; /* file descriptor of open file if open */ - time_t starttime; /* when the job started spooling */ - int status; /* the status of this job */ - size_t size; /* the size of the job so far */ - int page_count; /* then number of pages so far */ - BOOL spooled; /* has it been sent to the spooler yet? */ - BOOL smbjob; /* set if the job is a SMB job */ - fstring filename; /* the filename used to spool the file */ - fstring jobname; /* the job name given to us by the client */ - fstring user; /* the user who started the job */ - fstring queuename; /* service number of printer for this job */ - NT_DEVICEMODE *nt_devmode; -}; - -/* Information for print interfaces */ -struct printif -{ - int (*queue_get)(int snum, print_queue_struct **q, - print_status_struct *status); - int (*queue_pause)(int snum); - int (*queue_resume)(int snum); - int (*job_delete)(int snum, 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); -}; - -extern struct printif generic_printif; - -#ifdef HAVE_CUPS -extern struct printif cups_printif; -#endif /* HAVE_CUPS */ - -/* PRINT_MAX_JOBID is now defined in local.h */ -#define UNIX_JOB_START PRINT_MAX_JOBID -#define NEXT_JOBID(j) ((j+1) % PRINT_MAX_JOBID > 0 ? (j+1) % PRINT_MAX_JOBID : 1) - -#define MAX_CACHE_VALID_TIME 3600 - -#define PRINT_SPOOL_PREFIX "smbprn." -#define PRINT_DATABASE_VERSION 5 - -/* There can be this many printing tdb's open, plus any locked ones. */ -#define MAX_PRINT_DBS_OPEN 1 - -struct tdb_print_db { - struct tdb_print_db *next, *prev; - TDB_CONTEXT *tdb; - int ref_count; - fstring printer_name; -}; - -/* - * Used for print notify - */ - -#define NOTIFY_PID_LIST_KEY "NOTIFY_PID_LIST" - -#endif /* PRINTING_H_ */ diff --git a/source/include/privileges.h b/source/include/privileges.h deleted file mode 100644 index 289afa234ec..00000000000 --- a/source/include/privileges.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - - 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 PRIVILEGES_H -#define PRIVILEGES_H - -#define PRIV_ALL_INDEX 30 - -#define SE_NONE 0 -#define SE_ASSIGN_PRIMARY_TOKEN 1 -#define SE_CREATE_TOKEN 2 -#define SE_LOCK_MEMORY 3 -#define SE_INCREASE_QUOTA 4 -#define SE_UNSOLICITED_INPUT 5 -#define SE_MACHINE_ACCOUNT 6 -#define SE_TCB 7 -#define SE_SECURITY 8 -#define SE_TAKE_OWNERSHIP 9 -#define SE_LOAD_DRIVER 10 -#define SE_SYSTEM_PROFILE 11 -#define SE_SYSTEM_TIME 12 -#define SE_PROF_SINGLE_PROCESS 13 -#define SE_INC_BASE_PRIORITY 14 -#define SE_CREATE_PAGEFILE 15 -#define SE_CREATE_PERMANENT 16 -#define SE_BACKUP 17 -#define SE_RESTORE 18 -#define SE_SHUTDOWN 19 -#define SE_DEBUG 20 -#define SE_AUDIT 21 -#define SE_SYSTEM_ENVIRONMENT 22 -#define SE_CHANGE_NOTIFY 23 -#define SE_REMOTE_SHUTDOWN 24 -#define SE_UNDOCK 25 -#define SE_SYNC_AGENT 26 -#define SE_ENABLE_DELEGATION 27 -#define SE_PRINT_OPERATOR 28 -#define SE_ADD_USERS 29 -#define SE_ALL_PRIVS 0xffff - -#define PR_NONE 0x0000 -#define PR_LOG_ON_LOCALLY 0x0001 -#define PR_ACCESS_FROM_NETWORK 0x0002 -#define PR_LOG_ON_BATCH_JOB 0x0004 -#define PR_LOG_ON_SERVICE 0x0010 - -#ifndef _BOOL -typedef int BOOL; -#define _BOOL /* So we don't typedef BOOL again in vfs.h */ -#endif - -typedef struct LUID -{ - uint32 low; - uint32 high; -} LUID; - -typedef struct LUID_ATTR -{ - LUID luid; - uint32 attr; -} LUID_ATTR; - -typedef struct privilege_set -{ - TALLOC_CTX *mem_ctx; - BOOL ext_ctx; - uint32 count; - uint32 control; - LUID_ATTR *set; -} PRIVILEGE_SET; - -typedef struct _PRIVS { - uint32 se_priv; - const char *priv; - const char *description; -} PRIVS; - - -#endif /* PRIVILEGES_H */ diff --git a/source/include/rap.h b/source/include/rap.h deleted file mode 100755 index 993dfa7e335..00000000000 --- a/source/include/rap.h +++ /dev/null @@ -1,507 +0,0 @@ -/* - Samba Unix/Linux SMB client library - RAP (SMB Remote Procedure Calls) defines and structures - Copyright (C) Steve French 2001 (sfrench@us.ibm.com) - Copyright (C) Jim McDonough 2001 (jmcd@us.ibm.com) - - 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 _RAP_H_ -#define _RAP_H_ - -/*****************************************************/ -/* */ -/* Additional RAP functionality */ -/* */ -/* RAP is the original SMB RPC, documented */ -/* by Microsoft and X/Open in the 1990s and */ -/* supported by most SMB/CIFS servers although */ -/* it is unlikely that any one implementation */ -/* supports all RAP command codes since some */ -/* are quite obsolete and a few are specific */ -/* to a particular network operating system */ -/* */ -/* Although it has largely been replaced */ -/* for complex remote admistration and management */ -/* (of servers) by the relatively newer */ -/* DCE/RPC based remote API (which better handles */ -/* large >64K data structures), there are many */ -/* important administrative and resource location */ -/* tasks and user tasks (e.g. password change) */ -/* that are performed via RAP. */ -/* */ -/* Although a few of the RAP calls are implemented */ -/* in the Samba client library already (clirap.c) */ -/* the new ones are in clirap2.c for easy patching */ -/* and integration and a corresponding header */ -/* file, rap.h, has been created. */ -/* */ -/* This is based on data from the CIFS spec */ -/* and the LAN Server and LAN Manager */ -/* Programming Reference books and published */ -/* RAP document and CIFS forum postings and */ -/* lots of trial and error. Additional */ -/* background information is available from the */ -/* X/Open reference book in their PC Interworking */ -/* series "IPC for SMB" and also from the */ -/* interoperability documentation in */ -/* ftp://ftp.microsoft.com/developr/drg/cifs */ -/* */ -/* Function names changed from API_ (as they are */ -/* in the CIFS specification to RAP_ in order */ -/* to avoid confusion with other API calls */ -/* sent via DCE RPC */ -/* */ -/*****************************************************/ - -/*****************************************************/ -/* */ -/* Although without pound defines (of this header) */ -/* cifsrap.c already includes support for: */ -/* */ -/* WshareEnum (API number 0, level 1) */ -/* NetServerEnum2 (API num 104, level 1) */ -/* WWkstaUserLogon (132) */ -/* SamOEMchgPasswordUser2_P (214) */ -/* */ -/* and cifsprint.c already includes support for: */ -/* */ -/* WPrintJobEnum (API num 76, level 2) */ -/* WPrintJobDel (API num 81) */ -/* */ -/*****************************************************/ - -#define RAP_WshareEnum 0 -#define RAP_WshareGetInfo 1 -#define RAP_WshareSetInfo 2 -#define RAP_WshareAdd 3 -#define RAP_WshareDel 4 -#define RAP_NetShareCheck 5 -#define RAP_WsessionEnum 6 -#define RAP_WsessionGetInfo 7 -#define RAP_WsessionDel 8 -#define RAP_WconnectionEnum 9 -#define RAP_WfileEnum 10 -#define RAP_WfileGetInfo 11 -#define RAP_WfileClose 12 -#define RAP_WserverGetInfo 13 -#define RAP_WserverSetInfo 14 -#define RAP_WserverDiskEnum 15 -#define RAP_WserverAdminCommand 16 -#define RAP_NetAuditOpen 17 -#define RAP_WauditClear 18 -#define RAP_NetErrorLogOpen 19 -#define RAP_WerrorLogClear 20 -#define RAP_NetCharDevEnum 21 -#define RAP_NetCharDevGetInfo 22 -#define RAP_WCharDevControl 23 -#define RAP_NetCharDevQEnum 24 -#define RAP_NetCharDevQGetInfo 25 -#define RAP_WCharDevQSetInfo 26 -#define RAP_WCharDevQPurge 27 -#define RAP_WCharDevQPurgeSelf 28 -#define RAP_WMessageNameEnum 29 -#define RAP_WMessageNameGetInfo 30 -#define RAP_WMessageNameAdd 31 -#define RAP_WMessageNameDel 32 -#define RAP_WMessageNameFwd 33 -#define RAP_WMessageNameUnFwd 34 -#define RAP_WMessageBufferSend 35 -#define RAP_WMessageFileSend 36 -#define RAP_WMessageLogFileSet 37 -#define RAP_WMessageLogFileGet 38 -#define RAP_WServiceEnum 39 -#define RAP_WServiceInstall 40 -#define RAP_WServiceControl 41 -#define RAP_WAccessEnum 42 -#define RAP_WAccessGetInfo 43 -#define RAP_WAccessSetInfo 44 -#define RAP_WAccessAdd 45 -#define RAP_WAccessDel 46 -#define RAP_WGroupEnum 47 -#define RAP_WGroupAdd 48 -#define RAP_WGroupDel 49 -#define RAP_WGroupAddUser 50 -#define RAP_WGroupDelUser 51 -#define RAP_WGroupGetUsers 52 -#define RAP_WUserEnum 53 -#define RAP_WUserAdd 54 -#define RAP_WUserDel 55 -#define RAP_WUserGetInfo 56 -#define RAP_WUserSetInfo 57 -#define RAP_WUserPasswordSet 58 -#define RAP_WUserGetGroups 59 -#define RAP_WWkstaSetUID 62 -#define RAP_WWkstaGetInfo 63 -#define RAP_WWkstaSetInfo 64 -#define RAP_WUseEnum 65 -#define RAP_WUseAdd 66 -#define RAP_WUseDel 67 -#define RAP_WUseGetInfo 68 -#define RAP_WPrintQEnum 69 -#define RAP_WPrintQGetInfo 70 -#define RAP_WPrintQSetInfo 71 -#define RAP_WPrintQAdd 72 -#define RAP_WPrintQDel 73 -#define RAP_WPrintQPause 74 -#define RAP_WPrintQContinue 75 -#define RAP_WPrintJobEnum 76 -#define RAP_WPrintJobGetInfo 77 -#define RAP_WPrintJobSetInfo_OLD 78 -#define RAP_WPrintJobDel 81 -#define RAP_WPrintJobPause 82 -#define RAP_WPrintJobContinue 83 -#define RAP_WPrintDestEnum 84 -#define RAP_WPrintDestGetInfo 85 -#define RAP_WPrintDestControl 86 -#define RAP_WProfileSave 87 -#define RAP_WProfileLoad 88 -#define RAP_WStatisticsGet 89 -#define RAP_WStatisticsClear 90 -#define RAP_NetRemoteTOD 91 -#define RAP_WNetBiosEnum 92 -#define RAP_WNetBiosGetInfo 93 -#define RAP_NetServerEnum 94 -#define RAP_I_NetServerEnum 95 -#define RAP_WServiceGetInfo 96 -#define RAP_WPrintQPurge 103 -#define RAP_NetServerEnum2 104 -#define RAP_WAccessGetUserPerms 105 -#define RAP_WGroupGetInfo 106 -#define RAP_WGroupSetInfo 107 -#define RAP_WGroupSetUsers 108 -#define RAP_WUserSetGroups 109 -#define RAP_WUserModalsGet 110 -#define RAP_WUserModalsSet 111 -#define RAP_WFileEnum2 112 -#define RAP_WUserAdd2 113 -#define RAP_WUserSetInfo2 114 -#define RAP_WUserPasswordSet2 115 -#define RAP_I_NetServerEnum2 116 -#define RAP_WConfigGet2 117 -#define RAP_WConfigGetAll2 118 -#define RAP_WGetDCName 119 -#define RAP_NetHandleGetInfo 120 -#define RAP_NetHandleSetInfo 121 -#define RAP_WStatisticsGet2 122 -#define RAP_WBuildGetInfo 123 -#define RAP_WFileGetInfo2 124 -#define RAP_WFileClose2 125 -#define RAP_WNetServerReqChallenge 126 -#define RAP_WNetServerAuthenticate 127 -#define RAP_WNetServerPasswordSet 128 -#define RAP_WNetAccountDeltas 129 -#define RAP_WNetAccountSync 130 -#define RAP_WUserEnum2 131 -#define RAP_WWkstaUserLogon 132 -#define RAP_WWkstaUserLogoff 133 -#define RAP_WLogonEnum 134 -#define RAP_WErrorLogRead 135 -#define RAP_NetPathType 136 -#define RAP_NetPathCanonicalize 137 -#define RAP_NetPathCompare 138 -#define RAP_NetNameValidate 139 -#define RAP_NetNameCanonicalize 140 -#define RAP_NetNameCompare 141 -#define RAP_WAuditRead 142 -#define RAP_WPrintDestAdd 143 -#define RAP_WPrintDestSetInfo 144 -#define RAP_WPrintDestDel 145 -#define RAP_WUserValidate2 146 -#define RAP_WPrintJobSetInfo 147 -#define RAP_TI_NetServerDiskEnum 148 -#define RAP_TI_NetServerDiskGetInfo 149 -#define RAP_TI_FTVerifyMirror 150 -#define RAP_TI_FTAbortVerify 151 -#define RAP_TI_FTGetInfo 152 -#define RAP_TI_FTSetInfo 153 -#define RAP_TI_FTLockDisk 154 -#define RAP_TI_FTFixError 155 -#define RAP_TI_FTAbortFix 156 -#define RAP_TI_FTDiagnoseError 157 -#define RAP_TI_FTGetDriveStats 158 -#define RAP_TI_FTErrorGetInfo 160 -#define RAP_NetAccessCheck 163 -#define RAP_NetAlertRaise 164 -#define RAP_NetAlertStart 165 -#define RAP_NetAlertStop 166 -#define RAP_NetAuditWrite 167 -#define RAP_NetIRemoteAPI 168 -#define RAP_NetServiceStatus 169 -#define RAP_NetServerRegister 170 -#define RAP_NetServerDeregister 171 -#define RAP_NetSessionEntryMake 172 -#define RAP_NetSessionEntryClear 173 -#define RAP_NetSessionEntryGetInfo 174 -#define RAP_NetSessionEntrySetInfo 175 -#define RAP_NetConnectionEntryMake 176 -#define RAP_NetConnectionEntryClear 177 -#define RAP_NetConnectionEntrySetInfo 178 -#define RAP_NetConnectionEntryGetInfo 179 -#define RAP_NetFileEntryMake 180 -#define RAP_NetFileEntryClear 181 -#define RAP_NetFileEntrySetInfo 182 -#define RAP_NetFileEntryGetInfo 183 -#define RAP_AltSrvMessageBufferSend 184 -#define RAP_AltSrvMessageFileSend 185 -#define RAP_wI_NetRplWkstaEnum 186 -#define RAP_wI_NetRplWkstaGetInfo 187 -#define RAP_wI_NetRplWkstaSetInfo 188 -#define RAP_wI_NetRplWkstaAdd 189 -#define RAP_wI_NetRplWkstaDel 190 -#define RAP_wI_NetRplProfileEnum 191 -#define RAP_wI_NetRplProfileGetInfo 192 -#define RAP_wI_NetRplProfileSetInfo 193 -#define RAP_wI_NetRplProfileAdd 194 -#define RAP_wI_NetRplProfileDel 195 -#define RAP_wI_NetRplProfileClone 196 -#define RAP_wI_NetRplBaseProfileEnum 197 -#define RAP_WIServerSetInfo 201 -#define RAP_WPrintDriverEnum 205 -#define RAP_WPrintQProcessorEnum 206 -#define RAP_WPrintPortEnum 207 -#define RAP_WNetWriteUpdateLog 208 -#define RAP_WNetAccountUpdate 209 -#define RAP_WNetAccountConfirmUpdate 210 -#define RAP_WConfigSet 211 -#define RAP_WAccountsReplicate 212 -#define RAP_SamOEMChgPasswordUser2_P 214 -#define RAP_NetServerEnum3 215 -#define RAP_WprintDriverGetInfo 250 -#define RAP_WprintDriverSetInfo 251 -#define RAP_WaliasAdd 252 -#define RAP_WaliasDel 253 -#define RAP_WaliasGetInfo 254 -#define RAP_WaliasSetInfo 255 -#define RAP_WaliasEnum 256 -#define RAP_WuserGetLogonAsn 257 -#define RAP_WuserSetLogonAsn 258 -#define RAP_WuserGetAppSel 259 -#define RAP_WuserSetAppSel 260 -#define RAP_WappAdd 261 -#define RAP_WappDel 262 -#define RAP_WappGetInfo 263 -#define RAP_WappSetInfo 264 -#define RAP_WappEnum 265 -#define RAP_WUserDCDBInit 266 -#define RAP_WDASDAdd 267 -#define RAP_WDASDDel 268 -#define RAP_WDASDGetInfo 269 -#define RAP_WDASDSetInfo 270 -#define RAP_WDASDEnum 271 -#define RAP_WDASDCheck 272 -#define RAP_WDASDCtl 273 -#define RAP_WuserRemoteLogonCheck 274 -#define RAP_WUserPasswordSet3 275 -#define RAP_WCreateRIPLMachine 276 -#define RAP_WDeleteRIPLMachine 277 -#define RAP_WGetRIPLMachineInfo 278 -#define RAP_WSetRIPLMachineInfo 279 -#define RAP_WEnumRIPLMachine 280 -#define RAP_I_ShareAdd 281 -#define RAP_AliasEnum 282 -#define RAP_WaccessApply 283 -#define RAP_WPrt16Query 284 -#define RAP_WPrt16Set 285 -#define RAP_WUserDel100 286 -#define RAP_WUserRemoteLogonCheck2 287 -#define RAP_WRemoteTODSet 294 -#define RAP_WprintJobMoveAll 295 -#define RAP_W16AppParmAdd 296 -#define RAP_W16AppParmDel 297 -#define RAP_W16AppParmGet 298 -#define RAP_W16AppParmSet 299 -#define RAP_W16RIPLMachineCreate 300 -#define RAP_W16RIPLMachineGetInfo 301 -#define RAP_W16RIPLMachineSetInfo 302 -#define RAP_W16RIPLMachineEnum 303 -#define RAP_W16RIPLMachineListParmEnum 304 -#define RAP_W16RIPLMachClassGetInfo 305 -#define RAP_W16RIPLMachClassEnum 306 -#define RAP_W16RIPLMachClassCreate 307 -#define RAP_W16RIPLMachClassSetInfo 308 -#define RAP_W16RIPLMachClassDelete 309 -#define RAP_W16RIPLMachClassLPEnum 310 -#define RAP_W16RIPLMachineDelete 311 -#define RAP_W16WSLevelGetInfo 312 -#define RAP_WserverNameAdd 313 -#define RAP_WserverNameDel 314 -#define RAP_WserverNameEnum 315 -#define RAP_I_WDASDEnum 316 -#define RAP_WDASDEnumTerminate 317 -#define RAP_WDASDSetInfo2 318 -#define MAX_API 318 - - -/* Parameter description strings for RAP calls */ -/* Names are defined name for RAP call with _REQ */ -/* appended to end. */ - -#define RAP_WFileEnum2_REQ "zzWrLehb8g8" -#define RAP_WFileGetInfo2_REQ "DWrLh" -#define RAP_WFileClose2_REQ "D" - -#define RAP_NetGroupEnum_REQ "WrLeh" -#define RAP_NetGroupAdd_REQ "WsT" -#define RAP_NetGroupDel_REQ "z" -#define RAP_NetGroupAddUser_REQ "zz" -#define RAP_NetGroupDelUser_REQ "zz" -#define RAP_NetGroupGetUsers_REQ "zWrLeh" -#define RAP_NetGroupSetUsers_REQ "zWsTW" - -#define RAP_NetUserAdd2_REQ "WsTWW" -#define RAP_NetUserEnum_REQ "WrLeh" -#define RAP_NetUserEnum2_REQ "WrLDieh" -#define RAP_NetUserGetGroups_REQ "zWrLeh" -#define RAP_NetUserSetGroups_REQ "zWsTW" -#define RAP_NetUserPasswordSet_REQ "zb16b16w" -#define RAP_NetUserPasswordSet2_REQ "zb16b16WW" -#define RAP_SAMOEMChgPasswordUser2_REQ "B516B16" -#define RAP_NetUserValidate2_REQ "Wb62WWrLhWW" - -#define RAP_NetServerEnum2_REQ "WrLehDz" -#define RAP_WserverGetInfo_REQ "WrLh" -#define RAP_NetWkstatGetInfo "WrLh" - -#define RAP_WShareAdd_REQ "WsT" -#define RAP_WShareEnum_REQ "WrLeh" -#define RAP_WShareDel_REQ "zW" -#define RAP_WWkstaGetInfo_REQ "WrLh" - -#define RAP_NetPrintQEnum_REQ "WrLeh" -#define RAP_NetPrintQGetInfo_REQ "zWrLh" - -#define RAP_NetServerAdminCommand_REQ "zhrLeh" -#define RAP_NetServiceEnum_REQ "WrLeh" -#define RAP_NetServiceControl_REQ "zWWrL" -#define RAP_NetServiceInstall_REQ "zF88sg88T" -#define RAP_NetServiceGetInfo_REQ "zWrLh" -#define RAP_NetSessionEnum_REQ "WrLeh" -#define RAP_NetSessionGetInfo_REQ "zWrLh" -#define RAP_NetSessionDel_REQ "zW" - -#define RAP_NetConnectionEnum_REQ "zWrLeh" - -#define RAP_NetWkstaUserLogoff_REQ "zzWb38WrLh" - -/* Description strings for returned data in RAP calls */ -/* I use all caps here in part to avoid accidental */ -/* name collisions */ - -#define RAP_FILE_INFO_L2 "D" -#define RAP_FILE_INFO_L3 "DWWzz" - -#define RAP_GROUP_INFO_L0 "B21" -#define RAP_GROUP_INFO_L1 "B21Bz" -#define RAP_GROUP_USERS_INFO_0 "B21" -#define RAP_GROUP_USERS_INFO_1 "B21BN" - -#define RAP_USER_INFO_L0 "B21" -#define RAP_USER_INFO_L1 "B21BB16DWzzWz" - -#define RAP_SERVER_INFO_L0 "B16" -#define RAP_SERVER_INFO_L1 "B16BBDz" -#define RAP_SERVER_INFO_L2 "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz" -#define RAP_SERVER_INFO_L3 "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWzDWz" -#define RAP_SERVICE_INFO_L0 "B16" -#define RAP_SERVICE_INFO_L2 "B16WDWB64" -#define RAP_SHARE_INFO_L0 "B13" -#define RAP_SHARE_INFO_L1 "B13BWz" -#define RAP_SHARE_INFO_L2 "B13BWzWWWzB9B" - -#define RAP_PRINTQ_INFO_L2 "B13BWWWzzzzzWN" -#define RAP_SMB_PRINT_JOB_L1 "WB21BB16B10zWWzDDz" - -#define RAP_SESSION_INFO_L2 "zzWWWDDDz" -#define RAP_CONNECTION_INFO_L1 "WWWWDzz" - -#define RAP_USER_LOGOFF_INFO_L1 "WDW" - -#define RAP_WKSTA_INFO_L1 "WDzzzzBBDWDWWWWWWWWWWWWWWWWWWWzzWzzW" -#define RAP_WKSTA_INFO_L10 "zzzBBzz" - -/* BB explicit packing would help in structs below */ - -/* sizes of fixed-length fields, including null terminator */ -#define RAP_GROUPNAME_LEN 21 -#define RAP_USERNAME_LEN 21 -#define RAP_SHARENAME_LEN 13 -#define RAP_UPASSWD_LEN 16 /* user password */ -#define RAP_SPASSWD_LEN 9 /* share password */ -#define RAP_MACHNAME_LEN 16 -#define RAP_SRVCNAME_LEN 16 -#define RAP_SRVCCMNT_LEN 64 -#define RAP_DATATYPE_LEN 10 - - -typedef struct rap_group_info_1 -{ - char group_name[RAP_GROUPNAME_LEN]; - char reserved1; - char * comment; -} RAP_GROUP_INFO_1; - -typedef struct rap_user_info_1 -{ - char user_name[RAP_USERNAME_LEN]; - char reserved1; - char passwrd[RAP_UPASSWD_LEN]; - uint32 pwage; - uint16 priv; - char * home_dir; - char * comment; - uint16 userflags; - char * logon_script; -} RAP_USER_INFO_1; - -typedef struct rap_service_info_2 -{ - char service_name[RAP_SRVCNAME_LEN]; - uint16 status; - uint32 installcode; - uint16 process_num; - char * comment; -} RAP_SERVICE_INFO_2; - - -typedef struct rap_share_info_0 -{ - char share_name[RAP_SHARENAME_LEN]; -} RAP_SHARE_INFO_0; - -typedef struct rap_share_info_1 -{ - char share_name[RAP_SHARENAME_LEN]; - char reserved1; - uint16 share_type; - char * comment; -} RAP_SHARE_INFO_1; - -typedef struct rap_share_info_2 -{ - char share_name[RAP_SHARENAME_LEN]; - char reserved1; - uint16 share_type; - char * comment; - uint16 perms; - uint16 maximum_users; - uint16 active_users; - char * path; - char password[RAP_SPASSWD_LEN]; - char reserved2; -} RAP_SHARE_INFO_2; - -#endif /* _RAP_H_ */ diff --git a/source/include/rpc_brs.h b/source/include/rpc_brs.h deleted file mode 100644 index cd0928d470f..00000000000 --- a/source/include/rpc_brs.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1999 - Copyright (C) Luke Kenneth Casson Leighton 1996-1999 - - 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_BRS_H /* _RPC_BRS_H */ -#define _RPC_BRS_H - - -/* brssvc pipe */ -#define BRS_QUERY_INFO 0x02 - - -/* BRS_Q_QUERY_INFO - probably a capabilities request */ -typedef struct q_brs_query_info_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */ - - uint16 switch_value1; /* info level 100 (0x64) */ - /* align */ - uint16 switch_value2; /* info level 100 (0x64) */ - - uint32 ptr; - uint32 pad1; - uint32 pad2; - -} BRS_Q_QUERY_INFO; - - -/* BRS_INFO_100 - level 100 info */ -typedef struct brs_info_100_info -{ - uint32 pad1; - uint32 ptr2; - uint32 pad2; - uint32 pad3; - -} BRS_INFO_100; - - -/* BRS_R_QUERY_INFO - probably a capabilities request */ -typedef struct r_brs_query_info_info -{ - uint16 switch_value1; /* 100 (0x64) - switch value */ - /* align */ - uint16 switch_value2; /* info level 100 (0x64) */ - - /* for now, only level 100 is supported. this should be an enum container */ - uint32 ptr_1; /* pointer 1 */ - - union - { - BRS_INFO_100 *brs100; /* browser info level 100 */ - void *id; - - } info; - - NTSTATUS status; /* return status */ - -} BRS_R_QUERY_INFO; - -#endif /* _RPC_BRS_H */ - diff --git a/source/include/rpc_creds.h b/source/include/rpc_creds.h index 3022b172899..f570f2eb77d 100644 --- a/source/include/rpc_creds.h +++ b/source/include/rpc_creds.h @@ -20,6 +20,10 @@ */ +#error SAMBA4 clean up +#error this file should be (re)moved +#error and all unused stuff should go + #ifndef _RPC_CREDS_H /* _RPC_CREDS_H */ #define _RPC_CREDS_H diff --git a/source/include/rpc_dce.h b/source/include/rpc_dce.h deleted file mode 100644 index 8266fc861f1..00000000000 --- a/source/include/rpc_dce.h +++ /dev/null @@ -1,361 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - - 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 _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 -{ - RPC_REQUEST = 0x00, - RPC_RESPONSE = 0x02, - RPC_FAULT = 0x03, - RPC_BIND = 0x0B, - RPC_BINDACK = 0x0C, - RPC_BINDNACK = 0x0D, - RPC_ALTCONT = 0x0E, - RPC_ALTCONTRESP = 0x0F, - RPC_BINDRESP = 0x10 /* not the real name! this is undocumented! */ -}; - -/* DCE/RPC flags */ -#define RPC_FLG_FIRST 0x01 -#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 standard identifiers to indicate - signing or sealing of an RPC pipe */ -#define RPC_PIPE_AUTH_SIGN_LEVEL 0x5 -#define RPC_PIPE_AUTH_SEAL_LEVEL 0x6 - -/* 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 RPC_AUTH_NETSEC_CHK_LEN 0x20 - -/* 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... */ -#define NETLOGON_NEG_AUTH2_FLAGS 0x000701ff - -#define NETLOGON_NEG_SCHANNEL 0x40000000 - -enum netsec_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 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 */ - -/* RPC_IFACE */ -typedef struct rpc_iface_info -{ - struct uuid uuid; /* 16 bytes of rpc interface identification */ - uint32 version; /* the interface version number */ - -} RPC_IFACE; - -#define RPC_IFACE_LEN (UUID_SIZE + 4) - -struct pipe_id_info -{ - /* the names appear not to matter: the syntaxes _do_ matter */ - - const char *client_pipe; - RPC_IFACE abstr_syntax; /* this one is the abstract syntax id */ - - const char *server_pipe; /* this one is the secondary syntax name */ - RPC_IFACE trans_syntax; /* this one is the primary syntax id */ -}; - -/* RPC_HDR - dce rpc header */ -typedef struct rpc_hdr_info -{ - uint8 major; /* 5 - RPC major version */ - uint8 minor; /* 0 - RPC minor version */ - uint8 pkt_type; /* RPC_PKT_TYPE - RPC response packet */ - uint8 flags; /* DCE/RPC flags */ - uint8 pack_type[4]; /* 0x1000 0000 - little-endian packed data representation */ - uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */ - uint16 auth_len; /* 0 - authentication length */ - uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */ - -} RPC_HDR; - -#define RPC_HEADER_LEN 16 - -/* RPC_HDR_REQ - ms request rpc header */ -typedef struct rpc_hdr_req_info -{ - uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ - uint16 context_id; /* presentation context identifier */ - uint16 opnum; /* opnum */ - -} RPC_HDR_REQ; - -#define RPC_HDR_REQ_LEN 8 - -/* RPC_HDR_RESP - ms response rpc header */ -typedef struct rpc_hdr_resp_info -{ - uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ - uint16 context_id; /* 0 - presentation context identifier */ - uint8 cancel_count; /* 0 - cancel count */ - uint8 reserved; /* 0 - reserved. */ - -} RPC_HDR_RESP; - -#define RPC_HDR_RESP_LEN 8 - -/* RPC_HDR_FAULT - fault rpc header */ -typedef struct rpc_hdr_fault_info -{ - NTSTATUS status; - uint32 reserved; /* 0x0000 0000 */ -} RPC_HDR_FAULT; - -#define RPC_HDR_FAULT_LEN 8 - -/* this seems to be the same string name depending on the name of the pipe, - * but is more likely to be linked to the interface name - * "srvsvc", "\\PIPE\\ntsvcs" - * "samr", "\\PIPE\\lsass" - * "wkssvc", "\\PIPE\\wksvcs" - * "NETLOGON", "\\PIPE\\NETLOGON" - */ -/* RPC_ADDR_STR */ -typedef struct rpc_addr_info -{ - uint16 len; /* length of the string including null terminator */ - fstring str; /* the string above in single byte, null terminated form */ - -} RPC_ADDR_STR; - -/* RPC_HDR_BBA */ -typedef struct rpc_hdr_bba_info -{ - uint16 max_tsize; /* maximum transmission fragment size (0x1630) */ - uint16 max_rsize; /* max receive fragment size (0x1630) */ - uint32 assoc_gid; /* associated group id (0x0) */ - -} RPC_HDR_BBA; - -#define RPC_HDR_BBA_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) */ - - uint8 auth_type; /* 0x0a */ - uint8 auth_level; /* 0x06 */ - uint8 stub_type_len; /* don't know */ - uint8 padding; /* padding */ - - uint32 unknown; /* 0x0014a0c0 */ - -} RPC_HDR_AUTHA; - -#define RPC_HDR_AUTHA_LEN 12 - -/* RPC_HDR_AUTH */ -typedef struct rpc_hdr_auth_info -{ - uint8 auth_type; /* 0x0a */ - uint8 auth_level; /* 0x06 */ - uint8 padding; - uint8 reserved; /* padding */ - - uint32 auth_context; /* pointer */ - -} RPC_HDR_AUTH; - -#define RPC_HDR_AUTH_LEN 8 - -/* 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 -{ - 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; - -/* attached to the end of encrypted rpc requests and responses */ -/* RPC_AUTH_NETSEC_CHK */ -typedef struct rpc_auth_netsec_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_BIND_REQ - ms req bind */ -typedef struct rpc_bind_req_info -{ - RPC_HDR_BBA bba; - - uint32 num_elements; /* the number of elements (0x1) */ - uint16 context_id; /* presentation context identifier (0x0) */ - uint8 num_syntaxes; /* the number of syntaxes (has always been 1?)(0x1) */ - - RPC_IFACE abstract; /* num and vers. of interface client is using */ - RPC_IFACE transfer; /* num and vers. of interface to use for replies */ - -} RPC_HDR_RB; - -/* - * The following length is 8 bytes RPC_HDR_BBA_LEN, 8 bytes internals - * (with 3 bytes padding), + 2 x RPC_IFACE_LEN bytes for RPC_IFACE structs. - */ - -#define RPC_HDR_RB_LEN (RPC_HDR_BBA_LEN + 8 + (2*RPC_IFACE_LEN)) - -/* RPC_RESULTS - can only cope with one reason, right now... */ -typedef struct rpc_results_info -{ -/* uint8[] # 4-byte alignment padding, against SMB header */ - - uint8 num_results; /* the number of results (0x01) */ - -/* uint8[] # 4-byte alignment padding, against SMB header */ - - uint16 result; /* result (0x00 = accept) */ - uint16 reason; /* reason (0x00 = no reason specified) */ - -} RPC_RESULTS; - -/* RPC_HDR_BA */ -typedef struct rpc_hdr_ba_info -{ - RPC_HDR_BBA bba; - - RPC_ADDR_STR addr ; /* the secondary address string, as described earlier */ - RPC_RESULTS res ; /* results and reasons */ - RPC_IFACE transfer; /* the transfer syntax from the request */ - -} RPC_HDR_BA; - -/* RPC_AUTH_VERIFIER */ -typedef struct rpc_auth_verif_info -{ - fstring signature; /* "NTLMSSP".. Ok, not quite anymore */ - 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/source/include/rpc_dfs.h b/source/include/rpc_dfs.h deleted file mode 100644 index 39316a5d541..00000000000 --- a/source/include/rpc_dfs.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Samba parameters and setup - Copyright (C) Andrew Tridgell 1992-2000 - Copyright (C) Luke Kenneth Casson Leighton 1996 - 2000 - Copyright (C) Shirish Kalele 2000 - - 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_DFS_H -#define _RPC_DFS_H - -/* NETDFS pipe: calls */ -#define DFS_EXIST 0x00 -#define DFS_ADD 0x01 -#define DFS_REMOVE 0x02 -#define DFS_GET_INFO 0x04 -#define DFS_ENUM 0x05 - -/* dfsadd flags */ -#define DFSFLAG_ADD_VOLUME 0x00000001 -#define DFSFLAG_RESTORE_VOLUME 0x00000002 - -typedef struct dfs_q_dfs_exist -{ - uint32 dummy; -} -DFS_Q_DFS_EXIST; - -/* status == 1 if dfs exists. */ -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; - -/********************************************/ -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 -{ - - 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_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; - -#endif diff --git a/source/include/rpc_ds.h b/source/include/rpc_ds.h deleted file mode 100644 index e06918730a4..00000000000 --- a/source/include/rpc_ds.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Gerald Carter 2002 - - 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_DS_H /* _RPC_LSA_H */ -#define _RPC_DS_H - -#include "rpc_misc.h" - - -/* Opcodes available on PIPE_LSARPC_DS */ - -#define DS_GETPRIMDOMINFO 0x00 -#define DS_NOP 0xFF /* no op -- placeholder */ - -/* Opcodes available on PIPE_NETLOGON */ - -#define DS_ENUM_DOM_TRUSTS 0x28 - - -/* macros for RPC's */ - -/* DSROLE_PRIMARY_DOMAIN_INFO_BASIC */ - -/* flags */ - -#define DSROLE_PRIMARY_DS_RUNNING 0x00000001 -#define DSROLE_PRIMARY_DS_MIXED_MODE 0x00000002 -#define DSROLE_UPGRADE_IN_PROGRESS 0x00000004 -#define DSROLE_PRIMARY_DOMAIN_GUID_PRESENT 0x01000000 - -/* machine role */ - -#define DSROLE_STANDALONE_SRV 2 -#define DSROLE_DOMAIN_MEMBER_SRV 3 -#define DSROLE_BDC 4 -#define DSROLE_PDC 5 - - -typedef struct -{ - uint16 machine_role; - uint16 unknown; /* 0x6173 -- maybe just alignment? */ - - uint32 flags; - - uint32 netbios_ptr; - uint32 dnsname_ptr; - uint32 forestname_ptr; - - struct uuid domain_guid; - - UNISTR2 netbios_domain; - - UNISTR2 dns_domain; /* our dns domain */ - UNISTR2 forest_domain; /* root domain of the forest to which we belong */ -} DSROLE_PRIMARY_DOMAIN_INFO_BASIC; - -typedef struct -{ - DSROLE_PRIMARY_DOMAIN_INFO_BASIC *basic; -} DS_DOMINFO_CTR; - -/* info levels for ds_getprimdominfo() */ - -#define DsRolePrimaryDomainInfoBasic 1 - - -/* DS_Q_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() request */ -typedef struct -{ - uint16 level; -} DS_Q_GETPRIMDOMINFO; - -/* DS_R_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() response */ -typedef struct -{ - uint32 ptr; - - uint16 level; - uint16 unknown0; /* 0x455c -- maybe just alignment? */ - - DS_DOMINFO_CTR info; - - NTSTATUS status; -} DS_R_GETPRIMDOMINFO; - -typedef struct { - /* static portion of structure */ - uint32 netbios_ptr; - uint32 dns_ptr; - uint32 flags; - uint32 parent_index; - uint32 trust_type; - uint32 trust_attributes; - uint32 sid_ptr; - struct uuid guid; - - UNISTR2 netbios_domain; - UNISTR2 dns_domain; - DOM_SID2 sid; - -} DS_DOMAIN_TRUSTS; - -struct ds_domain_trust { - /* static portion of structure */ - uint32 flags; - uint32 parent_index; - uint32 trust_type; - uint32 trust_attributes; - struct uuid guid; - - DOM_SID sid; - char *netbios_domain; - char *dns_domain; -}; - -typedef struct { - - uint32 ptr; - uint32 max_count; - DS_DOMAIN_TRUSTS *trusts; - -} DS_DOMAIN_TRUSTS_CTR; - -#define DS_DOMAIN_IN_FOREST 0x0001 /* domains in the forest to which - we belong; even different domain trees */ -#define DS_DOMAIN_DIRECT_OUTBOUND 0x0002 /* trusted domains */ -#define DS_DOMAIN_TREE_ROOT 0x0004 /* root of our forest; also available in - DsRoleGetPrimaryDomainInfo() */ -#define DS_DOMAIN_PRIMARY 0x0008 /* our domain */ -#define DS_DOMAIN_NATIVE_MODE 0x0010 /* native mode AD servers */ -#define DS_DOMAIN_DIRECT_INBOUND 0x0020 /* trusting domains */ - -/* DS_Q_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() request */ -typedef struct -{ - uint32 server_ptr; - UNISTR2 server; - uint32 flags; - -} DS_Q_ENUM_DOM_TRUSTS; - -/* DS_R_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() response */ -typedef struct -{ - uint32 num_domains; - DS_DOMAIN_TRUSTS_CTR domains; - - NTSTATUS status; - -} DS_R_ENUM_DOM_TRUSTS; - - -#endif /* _RPC_DS_H */ diff --git a/source/include/rpc_echo.h b/source/include/rpc_echo.h deleted file mode 100644 index 6b4ea6abfba..00000000000 --- a/source/include/rpc_echo.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Samba rpcecho definitions. - - Copyright (C) Tim Potter 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _RPC_ECHO_H -#define _RPC_ECHO_H - -#define ECHO_ADD_ONE 0x00 -#define ECHO_DATA 0x01 -#define ECHO_SINK_DATA 0x02 -#define ECHO_SOURCE_DATA 0x03 - -typedef struct echo_q_add_one -{ - uint32 request; -} ECHO_Q_ADD_ONE; - -typedef struct echo_r_add_one -{ - uint32 response; -} ECHO_R_ADD_ONE; - -typedef struct echo_q_echo_data -{ - uint32 size; - char *data; -} ECHO_Q_ECHO_DATA; - -typedef struct echo_r_echo_data -{ - uint32 size; - char *data; -} ECHO_R_ECHO_DATA; - -typedef struct echo_q_source_data -{ - uint32 size; -} ECHO_Q_SOURCE_DATA; - -typedef struct echo_r_source_data -{ - uint32 size; - char *data; -} ECHO_R_SOURCE_DATA; - -typedef struct echo_q_sink_data -{ - uint32 size; - char *data; -} ECHO_Q_SINK_DATA; - -typedef struct echo_r_sink_data -{ - int dummy; /* unused */ -} ECHO_R_SINK_DATA; - -#endif diff --git a/source/include/rpc_epmapper.h b/source/include/rpc_epmapper.h deleted file mode 100644 index bbca6ac1f28..00000000000 --- a/source/include/rpc_epmapper.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Endpoint mapper data definitions - Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#define EPM_HANDLE_LEN 20 - -/* ordinal for the mapping interface */ - -#define EPM_MAP_PIPE_NAME 0x03 - -/* some of the different connection protocols and their IDs from Windows */ - -#define EPM_FLOOR_UUID 0x0d /* floor contains UUID */ -#define EPM_FLOOR_RPC 0x0b /* tower is for connection-oriented rpc */ -#define EPM_FLOOR_TCP 0x07 /* floor contains tcp port number */ -#define EPM_FLOOR_IP 0x09 /* floor contains IP address */ -#define EPM_FLOOR_NMPIPES 0x0f /* floor contains remote named pipe name */ -#define EPM_FLOOR_LRPC 0x10 /* floor contains local named pipe name */ -#define EPM_FLOOR_NETBIOS 0x11 /* floor contains netbios address */ -#define EPM_FLOOR_NETBEUI 0x12 /* floor contains netbeui address */ -#define EPM_FLOOR_SOCKET 0x20 - -#define EPM_PIPE_NM "epmapper" - -#define MAX_TOWERS 1 - -typedef struct -{ - uint8 data[EPM_HANDLE_LEN]; -} EPM_HANDLE; - -typedef struct -{ - struct { - uint16 length; - uint8 protocol; - struct { - struct uuid uuid; - uint16 version; - } uuid; - } lhs; - struct { - uint16 length; - uint16 unknown; - struct { - uint16 port; - } tcp; - struct { - uint8 addr[4]; - } ip; - char string[MAXHOSTNAMELEN+3]; /* hostname + \\ + null term */ - } rhs; -} EPM_FLOOR; - -typedef struct -{ - uint32 max_length; - uint32 length; - uint16 num_floors; - EPM_FLOOR *floors; - uint8 unknown; -} EPM_TOWER; - -typedef struct -{ - EPM_HANDLE handle; - uint32 tower_ref_id; - EPM_TOWER *tower; - EPM_HANDLE term_handle; /* in/out */ - uint32 max_towers; -} EPM_Q_MAP; - -typedef struct -{ - uint32 max_count; - uint32 offset; - uint32 count; - uint32 *tower_ref_ids; - EPM_TOWER *towers; -} EPM_TOWER_ARRAY; - -typedef struct -{ - EPM_HANDLE handle; - uint32 num_results; - EPM_TOWER_ARRAY *results; - uint32 status; -} EPM_R_MAP; - - -/* port mapping entries to be read */ - -typedef struct _mapper_entries{ - uint8 protocol ; - RPC_IFACE uuid_info ; /* needs to be zeroed if no specific uuid */ - uint16 port ; - char pipe_name[40] ; - char srv_name[20] ; - uint8 srv_port[4] ; - char func_name[16][16]; /* array of up to 16 functions available */ -} mapper_entries; - diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h index 29a9cd7306b..d0572ff87a9 100644 --- a/source/include/rpc_lsa.h +++ b/source/include/rpc_lsa.h @@ -20,101 +20,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#error SAMBA4 clean up +#error this file should be (re)moved +#error and all unused stuff should go + #ifndef _RPC_LSA_H /* _RPC_LSA_H */ #define _RPC_LSA_H #include "rpc_misc.h" -/* Opcodes available on PIPE_LSARPC */ - -#if 0 /* UNIMPLEMENTED */ - -#define LSA_LOOKUPSIDS2 0x39 - -#endif - -#define LSA_CLOSE 0x00 -#define LSA_DELETE 0x01 -#define LSA_ENUM_PRIVS 0x02 -#define LSA_QUERYSECOBJ 0x03 -#define LSA_SETSECOBJ 0x04 -#define LSA_CHANGEPASSWORD 0x05 -#define LSA_OPENPOLICY 0x06 -#define LSA_QUERYINFOPOLICY 0x07 -#define LSA_SETINFOPOLICY 0x08 -#define LSA_CLEARAUDITLOG 0x09 -#define LSA_CREATEACCOUNT 0x0a -#define LSA_ENUM_ACCOUNTS 0x0b -#define LSA_CREATETRUSTDOM 0x0c -#define LSA_ENUMTRUSTDOM 0x0d -#define LSA_LOOKUPNAMES 0x0e -#define LSA_LOOKUPSIDS 0x0f -#define LSA_CREATESECRET 0x10 -#define LSA_OPENACCOUNT 0x11 -#define LSA_ENUMPRIVSACCOUNT 0x12 -#define LSA_ADDPRIVS 0x13 -#define LSA_REMOVEPRIVS 0x14 -#define LSA_GETQUOTAS 0x15 -#define LSA_SETQUOTAS 0x16 -#define LSA_GETSYSTEMACCOUNT 0x17 -#define LSA_SETSYSTEMACCOUNT 0x18 -#define LSA_OPENTRUSTDOM 0x19 -#define LSA_QUERYTRUSTDOM 0x1a -#define LSA_SETINFOTRUSTDOM 0x1b -#define LSA_OPENSECRET 0x1c -#define LSA_SETSECRET 0x1d -#define LSA_QUERYSECRET 0x1e -#define LSA_LOOKUPPRIVVALUE 0x1f -#define LSA_LOOKUPPRIVNAME 0x20 -#define LSA_PRIV_GET_DISPNAME 0x21 -#define LSA_DELETEOBJECT 0x22 -#define LSA_ENUMACCTWITHRIGHT 0x23 -#define LSA_ENUMACCTRIGHTS 0x24 -#define LSA_ADDACCTRIGHTS 0x25 -#define LSA_REMOVEACCTRIGHTS 0x26 -#define LSA_QUERYTRUSTDOMINFO 0x27 -#define LSA_SETTRUSTDOMINFO 0x28 -#define LSA_DELETETRUSTDOM 0x29 -#define LSA_STOREPRIVDATA 0x2a -#define LSA_RETRPRIVDATA 0x2b -#define LSA_OPENPOLICY2 0x2c -#define LSA_UNK_GET_CONNUSER 0x2d /* LsaGetConnectedCredentials ? */ -#define LSA_QUERYINFO2 0x2e - -/* XXXX these are here to get a compile! */ -#define LSA_LOOKUPRIDS 0xFD - -/* DOM_QUERY - info class 3 and 5 LSA Query response */ -typedef struct dom_query_info -{ - uint16 uni_dom_max_len; /* domain name string length * 2 */ - uint16 uni_dom_str_len; /* domain name string length * 2 */ - uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */ - uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */ - UNISTR2 uni_domain_name; /* domain name (unicode string) */ - DOM_SID2 dom_sid; /* domain SID */ - -} DOM_QUERY; - -/* level 5 is same as level 3. */ -typedef DOM_QUERY DOM_QUERY_3; -typedef DOM_QUERY DOM_QUERY_5; - -/* level 2 is auditing settings */ -typedef struct dom_query_2 -{ - uint32 auditing_enabled; - uint32 count1; /* usualy 7, at least on nt4sp4 */ - uint32 count2; /* the same */ - uint32 *auditsettings; -} DOM_QUERY_2; - -/* level 6 is server role information */ -typedef struct dom_query_6 -{ - uint16 server_role; /* 2=backup, 3=primary */ -} DOM_QUERY_6; - typedef struct seq_qos_info { uint32 len; /* 12 */ @@ -147,34 +61,6 @@ typedef struct lsa_q_open_pol_info } LSA_Q_OPEN_POL; -/* LSA_R_OPEN_POL - response to LSA Open Policy */ -typedef struct lsa_r_open_pol_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return code */ - -} LSA_R_OPEN_POL; - -/* LSA_Q_OPEN_POL2 - LSA Query Open Policy */ -typedef struct lsa_q_open_pol2_info -{ - uint32 ptr; /* undocumented buffer pointer */ - UNISTR2 uni_server_name; /* server name, starting with two '\'s */ - LSA_OBJ_ATTR attr ; /* object attributes */ - - uint32 des_access; /* desired access attributes */ - -} LSA_Q_OPEN_POL2; - -/* LSA_R_OPEN_POL2 - response to LSA Open Policy */ -typedef struct lsa_r_open_pol2_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return code */ - -} LSA_R_OPEN_POL2; - - #define POLICY_VIEW_LOCAL_INFORMATION 0x00000001 #define POLICY_VIEW_AUDIT_INFORMATION 0x00000002 #define POLICY_GET_PRIVATE_INFORMATION 0x00000004 @@ -221,524 +107,6 @@ typedef struct lsa_r_open_pol2_info POLICY_VIEW_LOCAL_INFORMATION |\ POLICY_LOOKUP_NAMES ) -/* LSA_Q_QUERY_SEC_OBJ - LSA query security */ -typedef struct lsa_query_sec_obj_info -{ - POLICY_HND pol; /* policy handle */ - uint32 sec_info; - -} LSA_Q_QUERY_SEC_OBJ; - -/* LSA_R_QUERY_SEC_OBJ - probably an open */ -typedef struct r_lsa_query_sec_obj_info -{ - uint32 ptr; - SEC_DESC_BUF *buf; - - NTSTATUS status; /* return status */ - -} LSA_R_QUERY_SEC_OBJ; - -/* LSA_Q_QUERY_INFO - LSA query info policy */ -typedef struct lsa_query_info -{ - POLICY_HND pol; /* policy handle */ - uint16 info_class; /* info class */ - -} LSA_Q_QUERY_INFO; - -/* LSA_INFO_UNION */ -typedef union lsa_info_union -{ - DOM_QUERY_2 id2; - DOM_QUERY_3 id3; - DOM_QUERY_5 id5; - DOM_QUERY_6 id6; -} LSA_INFO_UNION; - -/* LSA_R_QUERY_INFO - response to LSA query info policy */ -typedef struct lsa_r_query_info -{ - uint32 undoc_buffer; /* undocumented buffer pointer */ - uint16 info_class; /* info class (same as info class in request) */ - - LSA_INFO_UNION dom; - - NTSTATUS status; /* return code */ - -} LSA_R_QUERY_INFO; - -/* LSA_DNS_DOM_INFO - DNS domain info - info class 12*/ -typedef struct lsa_dns_dom_info -{ - UNIHDR hdr_nb_dom_name; /* netbios domain name */ - UNIHDR hdr_dns_dom_name; - UNIHDR hdr_forest_name; - - struct uuid dom_guid; /* domain GUID */ - - UNISTR2 uni_nb_dom_name; - UNISTR2 uni_dns_dom_name; - UNISTR2 uni_forest_name; - - uint32 ptr_dom_sid; - DOM_SID2 dom_sid; /* domain SID */ -} LSA_DNS_DOM_INFO; - -typedef union lsa_info2_union -{ - LSA_DNS_DOM_INFO dns_dom_info; -} LSA_INFO2_UNION; - -/* LSA_Q_QUERY_INFO2 - LSA query info */ -typedef struct lsa_q_query_info2 -{ - POLICY_HND pol; /* policy handle */ - uint16 info_class; /* info class */ -} LSA_Q_QUERY_INFO2; - -typedef struct lsa_r_query_info2 -{ - uint32 ptr; /* pointer to info struct */ - uint16 info_class; - LSA_INFO2_UNION info; /* so far the only one */ - NTSTATUS status; -} LSA_R_QUERY_INFO2; - -/* LSA_Q_ENUM_TRUST_DOM - LSA enumerate trusted domains */ -typedef struct lsa_enum_trust_dom_info -{ - POLICY_HND pol; /* policy handle */ - uint32 enum_context; /* enumeration context handle */ - uint32 preferred_len; /* preferred maximum length */ - -} LSA_Q_ENUM_TRUST_DOM; - -/* LSA_R_ENUM_TRUST_DOM - response to LSA enumerate trusted domains */ -typedef struct lsa_r_enum_trust_dom_info -{ - uint32 enum_context; /* enumeration context handle */ - uint32 num_domains; /* number of domains */ - uint32 ptr_enum_domains; /* buffer pointer to num domains */ - - /* this lot is only added if ptr_enum_domains is non-NULL */ - uint32 num_domains2; /* number of domains */ - UNIHDR2 *hdr_domain_name; - UNISTR2 *uni_domain_name; - DOM_SID2 *domain_sid; - - NTSTATUS status; /* return code */ - -} LSA_R_ENUM_TRUST_DOM; - -/* LSA_Q_CLOSE */ -typedef struct lsa_q_close_info -{ - POLICY_HND pol; /* policy handle */ - -} LSA_Q_CLOSE; - -/* LSA_R_CLOSE */ -typedef struct lsa_r_close_info -{ - POLICY_HND pol; /* policy handle. should be all zeros. */ - - NTSTATUS status; /* return code */ - -} LSA_R_CLOSE; - - -#define MAX_REF_DOMAINS 32 - -/* DOM_TRUST_HDR */ -typedef struct dom_trust_hdr -{ - UNIHDR hdr_dom_name; /* referenced domain unicode string headers */ - uint32 ptr_dom_sid; - -} DOM_TRUST_HDR; - -/* DOM_TRUST_INFO */ -typedef struct dom_trust_info -{ - UNISTR2 uni_dom_name; /* domain name unicode string */ - DOM_SID2 ref_dom ; /* referenced domain SID */ - -} DOM_TRUST_INFO; - -/* DOM_R_REF */ -typedef struct dom_ref_info -{ - uint32 num_ref_doms_1; /* num referenced domains */ - uint32 ptr_ref_dom; /* pointer to referenced domains */ - uint32 max_entries; /* 32 - max number of entries */ - uint32 num_ref_doms_2; /* num referenced domains */ - - DOM_TRUST_HDR hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domains */ - DOM_TRUST_INFO ref_dom [MAX_REF_DOMAINS]; /* referenced domains */ - -} DOM_R_REF; - -/* the domain_idx points to a SID associated with the name */ - -/* LSA_TRANS_NAME - translated name */ -typedef struct lsa_trans_name_info -{ - uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */ - UNIHDR hdr_name; - uint32 domain_idx; /* index into DOM_R_REF array of SIDs */ - -} LSA_TRANS_NAME; - -/* This number purly arbitary - just to prevent a client from requesting large amounts of memory */ -#define MAX_LOOKUP_SIDS 256 - -/* LSA_TRANS_NAME_ENUM - LSA Translated Name Enumeration container */ -typedef struct lsa_trans_name_enum_info -{ - uint32 num_entries; - uint32 ptr_trans_names; - uint32 num_entries2; - - LSA_TRANS_NAME *name; /* translated names */ - UNISTR2 *uni_name; - -} LSA_TRANS_NAME_ENUM; - -/* LSA_SID_ENUM - LSA SID enumeration container */ -typedef struct lsa_sid_enum_info -{ - uint32 num_entries; - uint32 ptr_sid_enum; - uint32 num_entries2; - - uint32 *ptr_sid; /* domain SID pointers to be looked up. */ - DOM_SID2 *sid; /* domain SIDs to be looked up. */ - -} LSA_SID_ENUM; - -/* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */ -typedef struct lsa_q_lookup_sids -{ - POLICY_HND pol; /* policy handle */ - LSA_SID_ENUM sids; - LSA_TRANS_NAME_ENUM names; - LOOKUP_LEVEL level; - uint32 mapped_count; - -} LSA_Q_LOOKUP_SIDS; - -/* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */ -typedef struct lsa_r_lookup_sids -{ - uint32 ptr_dom_ref; - DOM_R_REF *dom_ref; /* domain reference info */ - - LSA_TRANS_NAME_ENUM *names; - uint32 mapped_count; - - NTSTATUS status; /* return code */ - -} LSA_R_LOOKUP_SIDS; - -/* LSA_Q_LOOKUP_NAMES - LSA Lookup NAMEs */ -typedef struct lsa_q_lookup_names -{ - POLICY_HND pol; /* policy handle */ - uint32 num_entries; - uint32 num_entries2; - UNIHDR *hdr_name; /* name buffer pointers */ - UNISTR2 *uni_name; /* names to be looked up */ - - uint32 num_trans_entries; - uint32 ptr_trans_sids; /* undocumented domain SID buffer pointer */ - uint32 lookup_level; - uint32 mapped_count; - -} LSA_Q_LOOKUP_NAMES; - -/* LSA_R_LOOKUP_NAMES - response to LSA Lookup NAMEs by name */ -typedef struct lsa_r_lookup_names -{ - uint32 ptr_dom_ref; - DOM_R_REF *dom_ref; /* domain reference info */ - - uint32 num_entries; - uint32 ptr_entries; - uint32 num_entries2; - DOM_RID2 *dom_rid; /* domain RIDs being looked up */ - - uint32 mapped_count; - - NTSTATUS status; /* return code */ -} LSA_R_LOOKUP_NAMES; - -/* This is probably a policy handle but at the moment we - never read it - so use a dummy struct. */ - -typedef struct lsa_q_open_secret -{ - uint32 dummy; -} LSA_Q_OPEN_SECRET; - -/* We always return "not found" at present - so just marshal the minimum. */ - -typedef struct lsa_r_open_secret -{ - uint32 dummy1; - uint32 dummy2; - uint32 dummy3; - uint32 dummy4; - NTSTATUS status; -} LSA_R_OPEN_SECRET; - -typedef struct lsa_enum_priv_entry -{ - UNIHDR hdr_name; - uint32 luid_low; - uint32 luid_high; - UNISTR2 name; - -} LSA_PRIV_ENTRY; - -/* LSA_Q_ENUM_PRIVS - LSA enum privileges */ -typedef struct lsa_q_enum_privs -{ - POLICY_HND pol; /* policy handle */ - uint32 enum_context; - uint32 pref_max_length; -} LSA_Q_ENUM_PRIVS; - -typedef struct lsa_r_enum_privs -{ - uint32 enum_context; - uint32 count; - uint32 ptr; - uint32 count1; - - LSA_PRIV_ENTRY *privs; - - NTSTATUS status; -} LSA_R_ENUM_PRIVS; - -/* LSA_Q_ENUM_ACCT_RIGHTS - LSA enum account rights */ -typedef struct -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 sid; -} LSA_Q_ENUM_ACCT_RIGHTS; - -/* LSA_R_ENUM_ACCT_RIGHTS - LSA enum account rights */ -typedef struct -{ - uint32 count; - UNISTR2_ARRAY rights; - NTSTATUS status; -} LSA_R_ENUM_ACCT_RIGHTS; - - -/* LSA_Q_ADD_ACCT_RIGHTS - LSA add account rights */ -typedef struct -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 sid; - UNISTR2_ARRAY rights; - uint32 count; -} LSA_Q_ADD_ACCT_RIGHTS; - -/* LSA_R_ADD_ACCT_RIGHTS - LSA add account rights */ -typedef struct -{ - NTSTATUS status; -} LSA_R_ADD_ACCT_RIGHTS; - - -/* LSA_Q_REMOVE_ACCT_RIGHTS - LSA remove account rights */ -typedef struct -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 sid; - uint32 removeall; - UNISTR2_ARRAY rights; - uint32 count; -} LSA_Q_REMOVE_ACCT_RIGHTS; - -/* LSA_R_REMOVE_ACCT_RIGHTS - LSA remove account rights */ -typedef struct -{ - NTSTATUS status; -} LSA_R_REMOVE_ACCT_RIGHTS; - - -/* LSA_Q_PRIV_GET_DISPNAME - LSA get privilege display name */ -typedef struct lsa_q_priv_get_dispname -{ - POLICY_HND pol; /* policy handle */ - UNIHDR hdr_name; - UNISTR2 name; - uint16 lang_id; - uint16 lang_id_sys; -} LSA_Q_PRIV_GET_DISPNAME; - -typedef struct lsa_r_priv_get_dispname -{ - uint32 ptr_info; - UNIHDR hdr_desc; - UNISTR2 desc; - /* Don't align ! */ - uint16 lang_id; - /* align */ - NTSTATUS status; -} LSA_R_PRIV_GET_DISPNAME; - -/* LSA_Q_ENUM_ACCOUNTS */ -typedef struct lsa_q_enum_accounts -{ - POLICY_HND pol; /* policy handle */ - uint32 enum_context; - uint32 pref_max_length; -} LSA_Q_ENUM_ACCOUNTS; - -/* LSA_R_ENUM_ACCOUNTS */ -typedef struct lsa_r_enum_accounts -{ - uint32 enum_context; - LSA_SID_ENUM sids; - NTSTATUS status; -} LSA_R_ENUM_ACCOUNTS; - -/* LSA_Q_UNK_GET_CONNUSER - gets username\domain of connected user - called when "Take Ownership" is clicked -SK */ -typedef struct lsa_q_unk_get_connuser -{ - uint32 ptr_srvname; - UNISTR2 uni2_srvname; - uint32 unk1; /* 3 unknown uint32's are seen right after uni2_srvname */ - uint32 unk2; /* unk2 appears to be a ptr, unk1 = unk3 = 0 usually */ - uint32 unk3; -} LSA_Q_UNK_GET_CONNUSER; - -/* LSA_R_UNK_GET_CONNUSER */ -typedef struct lsa_r_unk_get_connuser -{ - uint32 ptr_user_name; - UNIHDR hdr_user_name; - UNISTR2 uni2_user_name; - - uint32 unk1; - - uint32 ptr_dom_name; - UNIHDR hdr_dom_name; - UNISTR2 uni2_dom_name; - - NTSTATUS status; -} LSA_R_UNK_GET_CONNUSER; - - -typedef struct lsa_q_createaccount -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 sid; - uint32 access; /* access */ -} LSA_Q_CREATEACCOUNT; - -typedef struct lsa_r_createaccount -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; -} LSA_R_CREATEACCOUNT; - - -typedef struct lsa_q_openaccount -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 sid; - uint32 access; /* desired access */ -} LSA_Q_OPENACCOUNT; - -typedef struct lsa_r_openaccount -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; -} LSA_R_OPENACCOUNT; - -typedef struct lsa_q_enumprivsaccount -{ - POLICY_HND pol; /* policy handle */ -} LSA_Q_ENUMPRIVSACCOUNT; - -typedef struct lsa_r_enumprivsaccount -{ - uint32 ptr; - uint32 count; - PRIVILEGE_SET *set; - NTSTATUS status; -} LSA_R_ENUMPRIVSACCOUNT; - -typedef struct lsa_q_getsystemaccount -{ - POLICY_HND pol; /* policy handle */ -} LSA_Q_GETSYSTEMACCOUNT; - -typedef struct lsa_r_getsystemaccount -{ - uint32 access; - NTSTATUS status; -} LSA_R_GETSYSTEMACCOUNT; - - -typedef struct lsa_q_setsystemaccount -{ - POLICY_HND pol; /* policy handle */ - uint32 access; -} LSA_Q_SETSYSTEMACCOUNT; - -typedef struct lsa_r_setsystemaccount -{ - NTSTATUS status; -} LSA_R_SETSYSTEMACCOUNT; - - -typedef struct lsa_q_lookupprivvalue -{ - POLICY_HND pol; /* policy handle */ - UNIHDR hdr_right; - UNISTR2 uni2_right; -} LSA_Q_LOOKUPPRIVVALUE; - -typedef struct lsa_r_lookupprivvalue -{ - LUID luid; - NTSTATUS status; -} LSA_R_LOOKUPPRIVVALUE; - - -typedef struct lsa_q_addprivs -{ - POLICY_HND pol; /* policy handle */ - uint32 count; - PRIVILEGE_SET *set; -} LSA_Q_ADDPRIVS; - -typedef struct lsa_r_addprivs -{ - NTSTATUS status; -} LSA_R_ADDPRIVS; - - -typedef struct lsa_q_removeprivs -{ - POLICY_HND pol; /* policy handle */ - uint32 allrights; - uint32 ptr; - uint32 count; - PRIVILEGE_SET *set; -} LSA_Q_REMOVEPRIVS; - -typedef struct lsa_r_removeprivs -{ - NTSTATUS status; -} LSA_R_REMOVEPRIVS; +#endif /* _RPC_LSA_H */ -#endif /* _RPC_LSA_H */ diff --git a/source/include/rpc_misc.h b/source/include/rpc_misc.h index 0c6eee3650a..430489a00dc 100644 --- a/source/include/rpc_misc.h +++ b/source/include/rpc_misc.h @@ -20,13 +20,10 @@ 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 -#define SMB_RPC_INTERFACE_VERSION 1 + /* well-known RIDs - Relative IDs */ @@ -63,7 +60,6 @@ #define BUILTIN_ALIAS_RID_REPLICATOR (0x00000228L) #define BUILTIN_ALIAS_RID_RAS_SERVERS (0x00000229L) -#define BUILTIN_ALIAS_RID_PRE_2K_ACCESS (0x0000022aL) /* * Masks for mappings between unix uid and gid types and @@ -81,328 +77,4 @@ #define USER_RID_TYPE 0 #define GROUP_RID_TYPE 1 -/* ENUM_HND */ -typedef struct enum_hnd_info -{ - uint32 ptr_hnd; /* pointer to enumeration handle */ - uint32 handle; /* enumeration handle */ -} ENUM_HND; - -/* LOOKUP_LEVEL - switch value */ -typedef struct lookup_level_info -{ - uint16 value; -} LOOKUP_LEVEL; - -/* DOM_SID2 - security id */ -typedef struct sid_info_2 -{ - uint32 num_auths; /* length, bytes, including length of len :-) */ - DOM_SID sid; -} DOM_SID2; - -/* STRHDR - string header */ -typedef struct header_info -{ - uint16 str_str_len; - uint16 str_max_len; - uint32 buffer; /* non-zero */ -} STRHDR; - -/* UNIHDR - unicode string header */ -typedef struct unihdr_info -{ - uint16 uni_str_len; - uint16 uni_max_len; - uint32 buffer; /* usually has a value of 4 */ -} UNIHDR; - -/* UNIHDR2 - unicode string header and undocumented buffer */ -typedef struct unihdr2_info -{ - UNIHDR unihdr; - uint32 buffer; /* 32 bit buffer pointer */ -} UNIHDR2; - -/* clueless as to what maximum length should be */ -#define MAX_UNISTRLEN 256 -#define MAX_STRINGLEN 256 -#define MAX_BUFFERLEN 512 - -/* UNISTR - unicode string size and buffer */ -typedef struct unistr_info -{ - /* unicode characters. ***MUST*** be little-endian. ***MUST*** be null-terminated */ - uint16 *buffer; -} UNISTR; - -/* BUFHDR - buffer header */ -typedef struct bufhdr_info -{ - uint32 buf_max_len; - uint32 buf_len; -} BUFHDR; - -/* BUFFER2 - unicode string, size (in uint8 ascii chars) and buffer */ -/* pathetic. some stupid team of \PIPE\winreg writers got the concept */ -/* of a unicode string different from the other \PIPE\ writers */ -typedef struct buffer2_info -{ - uint32 buf_max_len; - uint32 offset; - uint32 buf_len; - /* unicode characters. ***MUST*** be little-endian. **NOT** necessarily null-terminated */ - uint16 *buffer; -} BUFFER2; - -/* BUFFER3 */ -typedef struct buffer3_info -{ - uint32 buf_max_len; - uint8 *buffer; /* Data */ - uint32 buf_len; -} BUFFER3; - -/* BUFFER5 */ -typedef struct buffer5_info -{ - uint32 buf_len; - uint16 *buffer; /* data */ -} BUFFER5; - -/* UNISTR2 - unicode string size (in uint16 unicode chars) and buffer */ -typedef struct unistr2_info -{ - uint32 uni_max_len; - uint32 offset; - uint32 uni_str_len; - /* unicode characters. ***MUST*** be little-endian. - **must** be null-terminated and the uni_str_len should include - the NULL character */ - uint16 *buffer; -} UNISTR2; - -/* STRING2 - string size (in uint8 chars) and buffer */ -typedef struct string2_info -{ - uint32 str_max_len; - uint32 offset; - uint32 str_str_len; - uint8 *buffer; /* uint8 characters. **NOT** necessarily null-terminated */ -} STRING2; - -/* UNISTR3 - XXXX not sure about this structure */ -typedef struct unistr3_info -{ - uint32 uni_str_len; - UNISTR str; - -} UNISTR3; - -/* an element in a unicode string array */ -typedef struct -{ - uint16 length; - uint16 size; - uint32 ref_id; - UNISTR2 string; -} UNISTR2_ARRAY_EL; - -/* an array of unicode strings */ -typedef struct -{ - uint32 ref_id; - uint32 count; - UNISTR2_ARRAY_EL *strings; -} UNISTR2_ARRAY; - - -/* an element in a sid array */ -typedef struct -{ - uint32 ref_id; - DOM_SID2 sid; -} SID_ARRAY_EL; - -/* an array of sids */ -typedef struct -{ - uint32 ref_id; - uint32 count; - SID_ARRAY_EL *sids; -} SID_ARRAY; - -/* DOM_RID2 - domain RID structure for ntlsa pipe */ -typedef struct domrid2_info -{ - uint8 type; /* value is SID_NAME_USE enum */ - uint32 rid; - uint32 rid_idx; /* referenced domain index */ - -} DOM_RID2; - -/* DOM_RID3 - domain RID structure for samr pipe */ -typedef struct domrid3_info -{ - uint32 rid; /* domain-relative (to a SID) id */ - uint32 type1; /* value is 0x1 */ - uint32 ptr_type; /* undocumented pointer */ - uint32 type2; /* value is 0x1 */ - uint32 unk; /* value is 0x2 */ - -} DOM_RID3; - -/* DOM_RID4 - rid + user attributes */ -typedef struct domrid4_info -{ - uint32 unknown; - uint16 attr; - uint32 rid; /* user RID */ -} DOM_RID4; - -/* DOM_CLNT_SRV - client / server names */ -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 */ - UNISTR2 uni_comp_name; /* client machine name */ -} DOM_CLNT_SRV; - -/* DOM_LOG_INFO - login 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 */ - uint16 sec_chan; /* secure channel type */ - UNISTR2 uni_comp_name; /* client machine name */ -} DOM_LOG_INFO; - -/* DOM_CHAL - challenge info */ -typedef struct chal_info -{ - uchar data[8]; /* credentials */ -} DOM_CHAL; - -/* DOM_CREDs - timestamped client or server credentials */ -typedef struct cred_info -{ - DOM_CHAL challenge; /* credentials */ - UTIME timestamp; /* credential time-stamp */ -} DOM_CRED; - -/* DOM_CLNT_INFO - client info */ -typedef struct clnt_info -{ - DOM_LOG_INFO login; - DOM_CRED cred; -} DOM_CLNT_INFO; - -/* DOM_CLNT_INFO2 - client info */ -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 -{ - uint32 low; - uint32 high; -} DOM_LOGON_ID; - -/* OWF INFO */ -typedef struct owf_info -{ - uint8 data[16]; -} OWF_INFO; - - -/* DOM_GID - group id + user attributes */ -typedef struct gid_info -{ - uint32 g_rid; /* a group RID */ - uint32 attr; -} DOM_GID; - -/* POLICY_HND */ -typedef struct lsa_policy_info -{ - uint32 data1; - uint32 data2; - uint16 data3; - uint16 data4; - uint8 data5[8]; -#ifdef __INSURE__ - - /* To prevent the leakage of policy handles mallocate a bit of - memory when a policy handle is created and free it when the - handle is closed. This should cause Insure to flag an error - when policy handles are overwritten or fall out of scope without - being freed. */ - - char *marker; -#endif -} POLICY_HND; - -/* - * 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; - -/* BUFHDR2 - another buffer header, with info level */ -typedef struct bufhdr2_info -{ - uint32 info_level; - uint32 length; /* uint8 chars */ - uint32 buffer; - -} -BUFHDR2; - -/* BUFFER4 - simple length and buffer */ -typedef struct buffer4_info -{ - uint32 buf_len; - uint8 buffer[MAX_BUFFERLEN]; - -} -BUFFER4; - -enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3 }; #endif /* _RPC_MISC_H */ diff --git a/source/include/rpc_netlogon.h b/source/include/rpc_netlogon.h deleted file mode 100644 index a5b93b0238a..00000000000 --- a/source/include/rpc_netlogon.h +++ /dev/null @@ -1,930 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - Copyright (C) Jean François Micouleau 2002 - - 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_NETLOGON_H /* _RPC_NETLOGON_H */ -#define _RPC_NETLOGON_H - - -/* NETLOGON pipe */ -#define NET_SAMLOGON 0x02 -#define NET_SAMLOGOFF 0x03 -#define NET_REQCHAL 0x04 -#define NET_AUTH 0x05 -#define NET_SRVPWSET 0x06 -#define NET_SAM_DELTAS 0x07 -#define NET_LOGON_CTRL 0x0c -#define NET_GETDCNAME 0x0d -#define NET_AUTH2 0x0f -#define NET_LOGON_CTRL2 0x0e -#define NET_SAM_SYNC 0x10 -#define NET_TRUST_DOM_LIST 0x13 -#define NET_AUTH3 0x1a - -/* Secure Channel types. used in NetrServerAuthenticate negotiation */ -#define SEC_CHAN_WKSTA 2 -#define SEC_CHAN_DOMAIN 4 -#define SEC_CHAN_BDC 6 - -/* Returned delta types */ -#define SAM_DELTA_DOMAIN_INFO 0x01 -#define SAM_DELTA_GROUP_INFO 0x02 -#define SAM_DELTA_RENAME_GROUP 0x04 -#define SAM_DELTA_ACCOUNT_INFO 0x05 -#define SAM_DELTA_RENAME_USER 0x07 -#define SAM_DELTA_GROUP_MEM 0x08 -#define SAM_DELTA_ALIAS_INFO 0x09 -#define SAM_DELTA_RENAME_ALIAS 0x0b -#define SAM_DELTA_ALIAS_MEM 0x0c -#define SAM_DELTA_POLICY_INFO 0x0d -#define SAM_DELTA_TRUST_DOMS 0x0e -#define SAM_DELTA_PRIVS_INFO 0x10 /* DT_DELTA_ACCOUNTS */ -#define SAM_DELTA_SECRET_INFO 0x12 -#define SAM_DELTA_DELETE_GROUP 0x14 -#define SAM_DELTA_DELETE_USER 0x15 -#define SAM_DELTA_MODIFIED_COUNT 0x16 - -/* SAM database types */ -#define SAM_DATABASE_DOMAIN 0x00 /* Domain users and groups */ -#define SAM_DATABASE_BUILTIN 0x01 /* BUILTIN users and groups */ -#define SAM_DATABASE_PRIVS 0x02 /* Privileges */ - -#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 -{ - uint32 ptr_user_info; - - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - UNIHDR hdr_user_name; /* username unicode string header */ - UNIHDR hdr_full_name; /* user's full name unicode string header */ - UNIHDR hdr_logon_script; /* logon script unicode string header */ - UNIHDR hdr_profile_path; /* profile path unicode string header */ - UNIHDR hdr_home_dir; /* home directory unicode string header */ - UNIHDR hdr_dir_drive; /* home directory drive unicode string header */ - - uint16 logon_count; /* logon count */ - uint16 bad_pw_count; /* bad password count */ - - uint32 user_id; /* User ID */ - uint32 group_id; /* Group ID */ - uint32 num_groups; /* num groups */ - uint32 buffer_groups; /* undocumented buffer pointer to groups. */ - uint32 user_flgs; /* user flags */ - - uint8 user_sess_key[16]; /* unused user session key */ - - UNIHDR hdr_logon_srv; /* logon server unicode string header */ - UNIHDR hdr_logon_dom; /* logon domain unicode string header */ - - uint32 buffer_dom_id; /* undocumented logon domain id pointer */ - uint8 padding[40]; /* unused padding bytes. expansion room */ - - 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 */ - UNISTR2 uni_profile_path; /* profile path unicode string */ - UNISTR2 uni_home_dir; /* home directory unicode string */ - UNISTR2 uni_dir_drive; /* home directory drive unicode string */ - - uint32 num_groups2; /* num groups */ - DOM_GID *gids; /* group info */ - - UNISTR2 uni_logon_srv; /* logon server unicode string */ - UNISTR2 uni_logon_dom; /* logon domain unicode string */ - - DOM_SID2 dom_sid; /* domain SID */ - - uint32 num_other_groups; /* other groups */ - DOM_GID *other_gids; /* group info */ - DOM_SID2 *other_sids; /* undocumented - domain SIDs */ - -} NET_USER_INFO_2; -#endif - -/* NET_USER_INFO_3 */ -typedef struct net_user_info_3 -{ - uint32 ptr_user_info; - - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - UNIHDR hdr_user_name; /* username unicode string header */ - UNIHDR hdr_full_name; /* user's full name unicode string header */ - UNIHDR hdr_logon_script; /* logon script unicode string header */ - UNIHDR hdr_profile_path; /* profile path unicode string header */ - UNIHDR hdr_home_dir; /* home directory unicode string header */ - UNIHDR hdr_dir_drive; /* home directory drive unicode string header */ - - uint16 logon_count; /* logon count */ - uint16 bad_pw_count; /* bad password count */ - - uint32 user_rid; /* User RID */ - uint32 group_rid; /* Group RID */ - - uint32 num_groups; /* num groups */ - uint32 buffer_groups; /* undocumented buffer pointer to groups. */ - uint32 user_flgs; /* user flags */ - - uint8 user_sess_key[16]; /* user session key */ - - UNIHDR hdr_logon_srv; /* logon server unicode string header */ - UNIHDR hdr_logon_dom; /* logon domain unicode string header */ - - uint32 buffer_dom_id; /* undocumented logon domain id pointer */ - uint8 padding[40]; /* unused padding bytes. expansion room */ - - uint32 num_other_sids; /* number of foreign/trusted domain sids */ - uint32 buffer_other_sids; - - 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 */ - UNISTR2 uni_profile_path; /* profile path unicode string */ - UNISTR2 uni_home_dir; /* home directory unicode string */ - UNISTR2 uni_dir_drive; /* home directory drive unicode string */ - - uint32 num_groups2; /* num groups */ - DOM_GID *gids; /* group info */ - - UNISTR2 uni_logon_srv; /* logon server unicode string */ - UNISTR2 uni_logon_dom; /* logon domain unicode string */ - - DOM_SID2 dom_sid; /* domain SID */ - - uint32 num_other_groups; /* other groups */ - DOM_GID *other_gids; /* group info */ - DOM_SID2 *other_sids; /* foreign/trusted domain SIDs */ - -} NET_USER_INFO_3; - - -/* NETLOGON_INFO_1 - pdc status info, i presume */ -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 -{ - uint32 flags; /* 0x0 - undocumented */ - uint32 pdc_status; /* 0x0 - undocumented */ - uint32 ptr_trusted_dc_name; /* pointer to trusted domain controller name */ - uint32 tc_status; /* 0x051f - ERROR_NO_LOGON_SERVERS */ - 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 -{ - uint32 flags; /* 0x0 - undocumented */ - uint32 logon_attempts; /* number of logon attempts */ - uint32 reserved_1; /* 0x0 - undocumented */ - uint32 reserved_2; /* 0x0 - undocumented */ - uint32 reserved_3; /* 0x0 - undocumented */ - uint32 reserved_4; /* 0x0 - undocumented */ - uint32 reserved_5; /* 0x0 - undocumented */ - -} NETLOGON_INFO_3; - -/******************************************************** - Logon Control Query - - This is generated by a nltest /bdc_query:DOMAIN - - query_level 0x1, function_code 0x1 - - ********************************************************/ - -/* NET_Q_LOGON_CTRL - LSA Netr Logon Control */ - -typedef struct net_q_logon_ctrl_info -{ - uint32 ptr; - UNISTR2 uni_server_name; - uint32 function_code; - uint32 query_level; -} NET_Q_LOGON_CTRL; - -/* NET_R_LOGON_CTRL - LSA Netr Logon Control */ - -typedef struct net_r_logon_ctrl_info -{ - uint32 switch_value; - uint32 ptr; - - union { - NETLOGON_INFO_1 info1; - } logon; - - NTSTATUS status; -} NET_R_LOGON_CTRL; - -/******************************************************** - Logon Control2 Query - - query_level 0x1 - pdc status - query_level 0x3 - number of logon attempts. - - ********************************************************/ - -/* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2 */ -typedef struct net_q_logon_ctrl2_info -{ - uint32 ptr; /* undocumented buffer pointer */ - UNISTR2 uni_server_name; /* server name, starting with two '\'s */ - - uint32 function_code; /* 0x1 */ - uint32 query_level; /* 0x1, 0x3 */ - uint32 switch_value; /* 0x1 */ - -} NET_Q_LOGON_CTRL2; - -/******************************************************* - Logon Control Response - - switch_value is same as query_level in request - *******************************************************/ - -/* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */ -typedef struct net_r_logon_ctrl2_info -{ - uint32 switch_value; /* 0x1, 0x3 */ - uint32 ptr; - - union - { - NETLOGON_INFO_1 info1; - NETLOGON_INFO_2 info2; - NETLOGON_INFO_3 info3; - - } 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 -{ - uint32 ptr_logon_server; - UNISTR2 uni_logon_server; - uint32 ptr_domainname; - UNISTR2 uni_domainname; -} NET_Q_GETDCNAME; - -/* NET_R_GETDCNAME - Ask a DC for a trusted DC name */ - -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 -{ - 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 -{ - 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 */ - -} 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 */ - -} NET_Q_REQ_CHAL; - - -/* NET_R_REQ_CHAL */ -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 -{ - 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 -{ - 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 */ - -} NET_Q_AUTH_2; - - -/* NET_R_AUTH_2 */ -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 */ -} NET_Q_AUTH_3; - -/* NET_R_AUTH_3 */ -typedef struct net_r_auth3_info -{ - DOM_CHAL srv_chal; /* server-calculated credentials */ - NEG_FLAGS srv_flgs; /* usually 0x6007 ffff */ - uint32 unknown; /* 0x0000045b */ - NTSTATUS status; /* return code */ -} NET_R_AUTH_3; - - -/* 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. */ - -} 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 */ - -} NET_R_SRV_PWSET; - -/* NET_ID_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) */ - DOM_LOGON_ID logon_id; /* logon ID */ - UNIHDR hdr_user_name; /* user name unicode header */ - UNIHDR hdr_wksta_name; /* workstation name unicode header */ - uint8 lm_chal[8]; /* lan manager 8 byte challenge */ - STRHDR hdr_nt_chal_resp; /* nt challenge response */ - STRHDR hdr_lm_chal_resp; /* lm challenge response */ - - UNISTR2 uni_domain_name; /* domain name unicode string */ - UNISTR2 uni_user_name; /* user name unicode string */ - 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 -{ - uint32 ptr_id_info1; /* pointer to id_info_1 */ - UNIHDR hdr_domain_name; /* domain name unicode header */ - uint32 param_ctrl; /* param control */ - DOM_LOGON_ID logon_id; /* logon ID */ - UNIHDR hdr_user_name; /* user name unicode header */ - UNIHDR hdr_wksta_name; /* workstation name unicode header */ - OWF_INFO lm_owf; /* LM OWF Password */ - OWF_INFO nt_owf; /* NT OWF Password */ - 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; - -} 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; - -} DOM_SAM_INFO; - -/* NET_Q_SAM_LOGON */ -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. */ - - uint16 switch_value; /* 3 - indicates type of USER INFO */ - NET_USER_INFO_3 *user; - - 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; - -} 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 */ - -} NET_R_SAM_LOGOFF; - -/* NET_Q_SAM_SYNC */ -typedef struct net_q_sam_sync_info -{ - UNISTR2 uni_srv_name; /* \\PDC */ - UNISTR2 uni_cli_name; /* BDC */ - DOM_CRED cli_creds; - DOM_CRED ret_creds; - - uint32 database_id; - uint32 restart_state; - uint32 sync_context; - - uint32 max_size; /* preferred maximum length */ - -} NET_Q_SAM_SYNC; - -/* SAM_DELTA_HDR */ -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; - -/* SAM_DOMAIN_INFO (0x1) */ -typedef struct sam_domain_info_info -{ - UNIHDR hdr_dom_name; - UNIHDR hdr_oem_info; - - UINT64_S force_logoff; - uint16 min_pwd_len; - uint16 pwd_history_len; - UINT64_S max_pwd_age; - UINT64_S min_pwd_age; - UINT64_S dom_mod_count; - NTTIME creation_time; - - BUFHDR2 hdr_sec_desc; /* security descriptor */ - UNIHDR hdr_unknown; - uint8 reserved[40]; - - UNISTR2 uni_dom_name; - UNISTR2 buf_oem_info; /* never seen */ - - BUFFER4 buf_sec_desc; - UNISTR2 buf_unknown; - -} SAM_DOMAIN_INFO; - -/* SAM_GROUP_INFO (0x2) */ -typedef struct sam_group_info_info -{ - UNIHDR hdr_grp_name; - DOM_GID gid; - UNIHDR hdr_grp_desc; - BUFHDR2 hdr_sec_desc; /* security descriptor */ - uint8 reserved[48]; - - UNISTR2 uni_grp_name; - UNISTR2 uni_grp_desc; - BUFFER4 buf_sec_desc; - -} SAM_GROUP_INFO; - -/* SAM_PWD */ -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 */ - - UNIHDR hdr_lm_pwd; - uint8 buf_lm_pwd[16]; - - UNIHDR hdr_nt_pwd; - uint8 buf_nt_pwd[16]; - - UNIHDR hdr_empty_lm; - UNIHDR hdr_empty_nt; - -} SAM_PWD; - -/* SAM_ACCOUNT_INFO (0x5) */ -typedef struct sam_account_info_info -{ - UNIHDR hdr_acct_name; - UNIHDR hdr_full_name; - - uint32 user_rid; - uint32 group_rid; - - UNIHDR hdr_home_dir; - UNIHDR hdr_dir_drive; - UNIHDR hdr_logon_script; - UNIHDR hdr_acct_desc; - UNIHDR hdr_workstations; - - NTTIME logon_time; - NTTIME logoff_time; - - uint32 logon_divs; /* 0xA8 */ - uint32 ptr_logon_hrs; - - uint16 bad_pwd_count; - uint16 logon_count; - NTTIME pwd_last_set_time; - NTTIME acct_expiry_time; - - uint32 acb_info; - uint8 nt_pwd[16]; - uint8 lm_pwd[16]; - uint8 nt_pwd_present; - uint8 lm_pwd_present; - uint8 pwd_expired; - - UNIHDR hdr_comment; - UNIHDR hdr_parameters; - uint16 country; - uint16 codepage; - - BUFHDR2 hdr_sec_desc; /* security descriptor */ - - UNIHDR hdr_profile; - UNIHDR hdr_reserved[3]; /* space for more strings */ - uint32 dw_reserved[4]; /* space for more data - first two seem to - be an NTTIME */ - - UNISTR2 uni_acct_name; - UNISTR2 uni_full_name; - UNISTR2 uni_home_dir; - UNISTR2 uni_dir_drive; - UNISTR2 uni_logon_script; - UNISTR2 uni_acct_desc; - UNISTR2 uni_workstations; - - uint32 unknown1; /* 0x4EC */ - uint32 unknown2; /* 0 */ - - BUFFER4 buf_logon_hrs; - UNISTR2 uni_comment; - UNISTR2 uni_parameters; - SAM_PWD pass; - BUFFER4 buf_sec_desc; - UNISTR2 uni_profile; - -} SAM_ACCOUNT_INFO; - -/* SAM_GROUP_MEM_INFO (0x8) */ -typedef struct sam_group_mem_info_info -{ - uint32 ptr_rids; - uint32 ptr_attribs; - uint32 num_members; - uint8 unknown[16]; - - uint32 num_members2; - uint32 *rids; - - uint32 num_members3; - uint32 *attribs; - -} SAM_GROUP_MEM_INFO; - -/* SAM_ALIAS_INFO (0x9) */ -typedef struct sam_alias_info_info -{ - UNIHDR hdr_als_name; - uint32 als_rid; - BUFHDR2 hdr_sec_desc; /* security descriptor */ - UNIHDR hdr_als_desc; - uint8 reserved[40]; - - UNISTR2 uni_als_name; - BUFFER4 buf_sec_desc; - UNISTR2 uni_als_desc; - -} SAM_ALIAS_INFO; - -/* SAM_ALIAS_MEM_INFO (0xC) */ -typedef struct sam_alias_mem_info_info -{ - uint32 num_members; - uint32 ptr_members; - uint8 unknown[16]; - - uint32 num_sids; - uint32 *ptr_sids; - DOM_SID2 *sids; - -} SAM_ALIAS_MEM_INFO; - - -/* SAM_DELTA_POLICY (0x0D) */ -typedef struct -{ - uint32 max_log_size; /* 0x5000 */ - UINT64_S audit_retention_period; /* 0 */ - uint32 auditing_mode; /* 0 */ - uint32 num_events; - uint32 ptr_events; - UNIHDR hdr_dom_name; - uint32 sid_ptr; - - uint32 paged_pool_limit; /* 0x02000000 */ - uint32 non_paged_pool_limit; /* 0x00100000 */ - uint32 min_workset_size; /* 0x00010000 */ - uint32 max_workset_size; /* 0x0f000000 */ - uint32 page_file_limit; /* 0 */ - UINT64_S time_limit; /* 0 */ - NTTIME modify_time; /* 0x3c*/ - NTTIME create_time; /* a7080110 */ - BUFHDR2 hdr_sec_desc; - - uint32 num_event_audit_options; - uint32 event_audit_option; - - UNISTR2 domain_name; - DOM_SID2 domain_sid; - - BUFFER4 buf_sec_desc; -} SAM_DELTA_POLICY; - -/* SAM_DELTA_TRUST_DOMS */ -typedef struct -{ - uint32 buf_size; - SEC_DESC *sec_desc; - DOM_SID2 sid; - UNIHDR hdr_domain; - - uint32 unknown0; - uint32 unknown1; - uint32 unknown2; - - uint32 buf_size2; - uint32 ptr; - - uint32 unknown3; - UNISTR2 domain; - -} SAM_DELTA_TRUSTDOMS; - -/* SAM_DELTA_PRIVS (0x10) */ -typedef struct -{ - DOM_SID2 sid; - - uint32 priv_count; - uint32 priv_control; - - uint32 priv_attr_ptr; - uint32 priv_name_ptr; - - uint32 paged_pool_limit; /* 0x02000000 */ - uint32 non_paged_pool_limit; /* 0x00100000 */ - uint32 min_workset_size; /* 0x00010000 */ - uint32 max_workset_size; /* 0x0f000000 */ - uint32 page_file_limit; /* 0 */ - UINT64_S time_limit; /* 0 */ - uint32 system_flags; /* 1 */ - BUFHDR2 hdr_sec_desc; - - uint32 buf_size2; - - uint32 attribute_count; - uint32 *attributes; - - uint32 privlist_count; - UNIHDR *hdr_privslist; - UNISTR2 *uni_privslist; - - BUFFER4 buf_sec_desc; -} SAM_DELTA_PRIVS; - -/* SAM_DELTA_SECRET */ -typedef struct -{ - uint32 buf_size; - SEC_DESC *sec_desc; - UNISTR2 secret; - - uint32 count1; - uint32 count2; - uint32 ptr; - NTTIME time1; - uint32 count3; - uint32 count4; - uint32 ptr2; - NTTIME time2; - uint32 unknow1; - - uint32 buf_size2; - uint32 ptr3; - uint32 unknow2; /* 0x0 12 times */ - - uint32 chal_len; - uint32 reserved1; /* 0 */ - uint32 chal_len2; - uint8 chal[16]; - - uint32 key_len; - uint32 reserved2; /* 0 */ - uint32 key_len2; - uint8 key[8]; - - uint32 buf_size3; - SEC_DESC *sec_desc2; - -} SAM_DELTA_SECRET; - -/* SAM_DELTA_MOD_COUNT (0x16) */ -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 -{ - SAM_DOMAIN_INFO domain_info ; - SAM_GROUP_INFO group_info ; - SAM_ACCOUNT_INFO account_info; - SAM_GROUP_MEM_INFO grp_mem_info; - SAM_ALIAS_INFO alias_info ; - SAM_ALIAS_MEM_INFO als_mem_info; - SAM_DELTA_POLICY policy_info; - SAM_DELTA_PRIVS privs_info; - SAM_DELTA_MOD_COUNT mod_count; - SAM_DELTA_TRUSTDOMS trustdoms_info; - SAM_DELTA_SECRET secret_info; -} SAM_DELTA_CTR; - -/* NET_R_SAM_SYNC */ -typedef struct net_r_sam_sync_info -{ - DOM_CRED srv_creds; - - uint32 sync_context; - - uint32 ptr_deltas; - uint32 num_deltas; - uint32 ptr_deltas2; - uint32 num_deltas2; - - SAM_DELTA_HDR *hdr_deltas; - SAM_DELTA_CTR *deltas; - - NTSTATUS status; -} NET_R_SAM_SYNC; - -/* NET_Q_SAM_DELTAS */ -typedef struct net_q_sam_deltas_info -{ - UNISTR2 uni_srv_name; - UNISTR2 uni_cli_name; - DOM_CRED cli_creds; - DOM_CRED ret_creds; - - uint32 database_id; - 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 -{ - DOM_CRED srv_creds; - - UINT64_S dom_mod_count; /* new domain mod count */ - - uint32 ptr_deltas; - uint32 num_deltas; - uint32 num_deltas2; - - SAM_DELTA_HDR *hdr_deltas; - SAM_DELTA_CTR *deltas; - - NTSTATUS status; -} NET_R_SAM_DELTAS; - -#endif /* _RPC_NETLOGON_H */ diff --git a/source/include/rpc_parse.h b/source/include/rpc_parse.h deleted file mode 100644 index 73fbcb2b1be..00000000000 --- a/source/include/rpc_parse.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-2000 - Copyright (C) Luke Kenneth Casson Leighton 1996-2000 - Copyright (C) Elrond 2000 - - 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_PARSE_H -#define _RPC_PARSE_H - -/* different dce/rpc pipes */ -#include "rpc_reg.h" -#include "rpc_brs.h" - -#endif /* _RPC_PARSE_H */ diff --git a/source/include/rpc_reg.h b/source/include/rpc_reg.h deleted file mode 100644 index 46ec88283df..00000000000 --- a/source/include/rpc_reg.h +++ /dev/null @@ -1,644 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997. - Copyright (C) Luke Kenneth Casson Leighton 1996-1997. - Copyright (C) Paul Ashton 1997. - Copyright (C) Gerald Carter 2002. - - 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_REG_H /* _RPC_REG_H */ -#define _RPC_REG_H - - -/* winreg pipe defines - NOT IMPLEMENTED !! -#define _REG_UNK_01 0x01 -#define _REG_UNK_03 0x03 -#define REG_CREATE_KEY 0x06 -#define REG_DELETE_KEY 0x07 -#define REG_DELETE_VALUE 0x08 -#define REG_FLUSH_KEY 0x0b -#define REG_GET_KEY_SEC 0x0c -#define _REG_UNK_0D 0x0d -#define _REG_UNK_0E 0x0e -#define _REG_UNK_12 0x12 -#define _REG_UNK_13 0x13 -#define REG_SET_KEY_SEC 0x15 -#define REG_CREATE_VALUE 0x16 -#define _REG_UNK_17 0x17 -*/ - -/* Implemented */ -#define REG_OPEN_HKCR 0x00 -#define REG_OPEN_HKLM 0x02 -#define REG_OPEN_HKU 0x04 -#define REG_CLOSE 0x05 -#define REG_ENUM_KEY 0x09 -#define REG_ENUM_VALUE 0x0a -#define REG_OPEN_ENTRY 0x0f -#define REG_QUERY_KEY 0x10 -#define REG_INFO 0x11 -#define REG_SHUTDOWN 0x18 -#define REG_ABORT_SHUTDOWN 0x19 -#define REG_SAVE_KEY 0x14 /* no idea what the real name is */ -#define REG_UNKNOWN_1A 0x1a - - -#define HKEY_CLASSES_ROOT 0x80000000 -#define HKEY_CURRENT_USER 0x80000001 -#define HKEY_LOCAL_MACHINE 0x80000002 -#define HKEY_USERS 0x80000003 - -#define KEY_HKLM "HKLM" -#define KEY_HKU "HKU" -#define KEY_HKCR "HKCR" -#define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" -#define KEY_TREE_ROOT "" - -/* Registry data types */ - -#define REG_NONE 0 -#define REG_SZ 1 -#define REG_EXPAND_SZ 2 -#define REG_BINARY 3 -#define REG_DWORD 4 -#define REG_DWORD_LE 4 /* DWORD, little endian */ -#define REG_DWORD_BE 5 /* DWORD, big endian */ -#define REG_LINK 6 -#define REG_MULTI_SZ 7 -#define REG_RESOURCE_LIST 8 -#define REG_FULL_RESOURCE_DESCRIPTOR 9 -#define REG_RESOURCE_REQUIREMENTS_LIST 10 - -/* structure to contain registry values */ - -typedef struct { - fstring valuename; - uint16 type; - uint32 size; /* in bytes */ - uint8 *data_p; -} REGISTRY_VALUE; - -/* container for regostry values */ - -typedef struct { - TALLOC_CTX *ctx; - uint32 num_values; - REGISTRY_VALUE **values; -} REGVAL_CTR; - -/* container for registry subkey names */ - -typedef struct { - TALLOC_CTX *ctx; - uint32 num_subkeys; - char **subkeys; -} REGSUBKEY_CTR; - - -/* - * container for function pointers to enumeration routines - * for vitural registry view - */ - -typedef struct { - /* functions for enumerating subkeys and values */ - int (*subkey_fn)( char *key, REGSUBKEY_CTR *subkeys); - int (*value_fn) ( char *key, REGVAL_CTR *val ); - BOOL (*store_subkeys_fn)( char *key, REGSUBKEY_CTR *subkeys ); - BOOL (*store_values_fn)( char *key, REGVAL_CTR *val ); -} REGISTRY_OPS; - -typedef struct { - const char *keyname; /* full path to name of key */ - REGISTRY_OPS *ops; /* registry function hooks */ -} REGISTRY_HOOK; - - - -/* structure to store the registry handles */ - -typedef struct _RegistryKey { - - struct _RegistryKey *prev, *next; - - POLICY_HND hnd; - pstring name; /* full name of registry key */ - REGISTRY_HOOK *hook; - -} REGISTRY_KEY; - - -/* REG_Q_OPEN_HKCR */ -typedef struct q_reg_open_hkcr_info -{ - uint32 ptr; - uint16 unknown_0; /* 0x5428 - 16 bit unknown */ - uint16 unknown_1; /* random. changes */ - uint32 level; /* 0x0000 0002 - 32 bit unknown */ - -} REG_Q_OPEN_HKCR ; - -/* REG_R_OPEN_HKCR */ -typedef struct r_reg_open_hkcr_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} REG_R_OPEN_HKCR; - - -/* REG_Q_OPEN_HKLM */ -typedef struct q_reg_open_hklm_info -{ - uint32 ptr; - uint16 unknown_0; /* 0xE084 - 16 bit unknown */ - uint16 unknown_1; /* random. changes */ - uint32 access_mask; - -} -REG_Q_OPEN_HKLM; - -/* REG_R_OPEN_HKLM */ -typedef struct r_reg_open_hklm_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} -REG_R_OPEN_HKLM; - - -/* REG_Q_OPEN_HKU */ -typedef struct q_reg_open_hku_info -{ - uint32 ptr; - uint16 unknown_0; - uint16 unknown_1; - uint32 access_mask; - -} REG_Q_OPEN_HKU; - -/* REG_R_OPEN_HKU */ -typedef struct r_reg_open_hku_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} REG_R_OPEN_HKU; - - -/* REG_Q_FLUSH_KEY */ -typedef struct q_reg_open_flush_key_info -{ - POLICY_HND pol; /* policy handle */ - -} REG_Q_FLUSH_KEY; - -/* REG_R_FLUSH_KEY */ -typedef struct r_reg_open_flush_key_info -{ - NTSTATUS status; /* return status */ - -} REG_R_FLUSH_KEY; - - -/* REG_Q_SET_KEY_SEC */ -typedef struct q_reg_set_key_sec_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ - - uint32 ptr; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - SEC_DESC_BUF *data; /* security data */ - -} REG_Q_SET_KEY_SEC; - -/* REG_R_SET_KEY_SEC */ -typedef struct r_reg_set_key_sec_info -{ - NTSTATUS status; - -} REG_R_SET_KEY_SEC; - - -/* REG_Q_GET_KEY_SEC */ -typedef struct q_reg_get_key_sec_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ - - uint32 ptr; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - SEC_DESC_BUF *data; /* security data */ - -} REG_Q_GET_KEY_SEC; - -/* REG_R_GET_KEY_SEC */ -typedef struct r_reg_get_key_sec_info -{ - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ - - uint32 ptr; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - SEC_DESC_BUF *data; /* security data */ - - NTSTATUS status; - -} REG_R_GET_KEY_SEC; - -/* REG_Q_CREATE_VALUE */ -typedef struct q_reg_create_value_info -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_name; /* name of value */ - UNISTR2 uni_name; - - uint32 type; /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */ - - BUFFER3 *buf_value; /* value, in byte buffer */ - -} REG_Q_CREATE_VALUE; - -/* REG_R_CREATE_VALUE */ -typedef struct r_reg_create_value_info -{ - NTSTATUS status; /* return status */ - -} REG_R_CREATE_VALUE; - -/* REG_Q_ENUM_VALUE */ -typedef struct q_reg_query_value_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 val_index; /* index */ - - UNIHDR hdr_name; /* name of value */ - UNISTR2 uni_name; - - uint32 ptr_type; /* pointer */ - uint32 type; /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */ - - uint32 ptr_value; /* pointer */ - BUFFER2 buf_value; /* value, in byte buffer */ - - uint32 ptr1; /* pointer */ - uint32 len_value1; /* */ - - uint32 ptr2; /* pointer */ - uint32 len_value2; /* */ - - -} REG_Q_ENUM_VALUE; - -/* REG_R_ENUM_VALUE */ -typedef struct r_reg_enum_value_info -{ - UNIHDR hdr_name; /* name of value */ - UNISTR2 uni_name; - - uint32 ptr_type; /* pointer */ - uint32 type; /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */ - - uint32 ptr_value; /* pointer */ - BUFFER2 buf_value; /* value, in byte buffer */ - - uint32 ptr1; /* pointer */ - uint32 len_value1; /* */ - - uint32 ptr2; /* pointer */ - uint32 len_value2; /* */ - - NTSTATUS status; /* return status */ - -} REG_R_ENUM_VALUE; - -/* REG_Q_CREATE_KEY */ -typedef struct q_reg_create_key_info -{ - POLICY_HND pnt_pol; /* parent key policy handle */ - - UNIHDR hdr_name; - UNISTR2 uni_name; - - UNIHDR hdr_class; - UNISTR2 uni_class; - - uint32 reserved; /* 0x0000 0000 */ - SEC_ACCESS sam_access; /* access rights flags, see rpc_secdes.h */ - - uint32 ptr1; - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ - - uint32 ptr2; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - uint32 ptr3; /* pointer */ - SEC_DESC_BUF *data; - - uint32 unknown_2; /* 0x0000 0000 */ - -} REG_Q_CREATE_KEY; - -/* REG_R_CREATE_KEY */ -typedef struct r_reg_create_key_info -{ - POLICY_HND key_pol; /* policy handle */ - uint32 unknown; /* 0x0000 0000 */ - - NTSTATUS status; /* return status */ - -} REG_R_CREATE_KEY; - -/* REG_Q_DELETE_KEY */ -typedef struct q_reg_delete_key_info -{ - POLICY_HND pnt_pol; /* parent key policy handle */ - - UNIHDR hdr_name; - UNISTR2 uni_name; -} REG_Q_DELETE_KEY; - -/* REG_R_DELETE_KEY */ -typedef struct r_reg_delete_key_info -{ - POLICY_HND key_pol; /* policy handle */ - - NTSTATUS status; /* return status */ - -} REG_R_DELETE_KEY; - -/* REG_Q_DELETE_VALUE */ -typedef struct q_reg_delete_val_info -{ - POLICY_HND pnt_pol; /* parent key policy handle */ - - UNIHDR hdr_name; - UNISTR2 uni_name; - -} REG_Q_DELETE_VALUE; - -/* REG_R_DELETE_VALUE */ -typedef struct r_reg_delete_val_info -{ - POLICY_HND key_pol; /* policy handle */ - - NTSTATUS status; /* return status */ - -} REG_R_DELETE_VALUE; - -/* REG_Q_QUERY_KEY */ -typedef struct q_reg_query_info -{ - POLICY_HND pol; /* policy handle */ - UNIHDR hdr_class; - UNISTR2 uni_class; - -} REG_Q_QUERY_KEY; - -/* REG_R_QUERY_KEY */ -typedef struct r_reg_query_key_info -{ - UNIHDR hdr_class; - UNISTR2 uni_class; - - uint32 num_subkeys; - uint32 max_subkeylen; - uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */ - uint32 num_values; - uint32 max_valnamelen; - uint32 max_valbufsize; - uint32 sec_desc; /* 0x0000 0078 */ - NTTIME mod_time; /* modified time */ - - NTSTATUS status; /* return status */ - -} REG_R_QUERY_KEY; - - -/* REG_Q_UNKNOWN_1A */ -typedef struct q_reg_unk_1a_info -{ - POLICY_HND pol; /* policy handle */ - -} REG_Q_UNKNOWN_1A; - -/* REG_R_UNKNOWN_1A */ -typedef struct r_reg_unk_1a_info -{ - uint32 unknown; /* 0x0500 0000 */ - NTSTATUS status; /* return status */ - -} REG_R_UNKNOWN_1A; - - -/* REG_Q_UNKNOWN_1A */ -typedef struct q_reg_unknown_14 -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_file; /* unicode product type header */ - UNISTR2 uni_file; /* local filename to save key as from regedt32.exe */ - /* e.g. "c:\temp\test.dat" */ - - uint32 unknown; /* 0x0000 0000 */ - -} REG_Q_SAVE_KEY; - - -/* REG_R_UNKNOWN_1A */ -typedef struct r_reg_unknown_14 -{ - NTSTATUS status; /* return status */ - -} REG_R_SAVE_KEY; - - - -/* REG_Q_CLOSE */ -typedef struct reg_q_close_info -{ - POLICY_HND pol; /* policy handle */ - -} REG_Q_CLOSE; - -/* REG_R_CLOSE */ -typedef struct reg_r_close_info -{ - POLICY_HND pol; /* policy handle. should be all zeros. */ - - NTSTATUS status; /* return code */ - -} REG_R_CLOSE; - - -/* REG_Q_ENUM_KEY */ -typedef struct q_reg_enum_value_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 key_index; - - uint16 key_name_len; /* 0x0000 */ - uint16 unknown_1; /* 0x0414 */ - - uint32 ptr1; /* pointer */ - uint32 unknown_2; /* 0x0000 020A */ - uint8 pad1[8]; /* padding - zeros */ - - uint32 ptr2; /* pointer */ - uint8 pad2[8]; /* padding - zeros */ - - uint32 ptr3; /* pointer */ - NTTIME time; /* current time? */ - -} REG_Q_ENUM_KEY; - -/* REG_R_ENUM_KEY */ -typedef struct r_reg_enum_key_info -{ - uint16 key_name_len; /* number of bytes in key name */ - uint16 unknown_1; /* 0x0414 - matches with query unknown_1 */ - - uint32 ptr1; /* pointer */ - uint32 unknown_2; /* 0x0000 020A */ - uint32 unknown_3; /* 0x0000 0000 */ - - UNISTR3 key_name; - - uint32 ptr2; /* pointer */ - uint8 pad2[8]; /* padding - zeros */ - - uint32 ptr3; /* pointer */ - NTTIME time; /* current time? */ - - NTSTATUS status; /* return status */ - -} REG_R_ENUM_KEY; - - -/* REG_Q_INFO */ -typedef struct q_reg_info_info -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_type; /* unicode product type header */ - UNISTR2 uni_type; /* unicode product type - "ProductType" */ - - uint32 ptr_reserved; /* pointer */ - - uint32 ptr_buf; /* the next three fields follow if ptr_buf != 0 */ - uint32 ptr_bufsize; - uint32 bufsize; - uint32 buf_unk; - - uint32 unk1; - uint32 ptr_buflen; - uint32 buflen; - - uint32 ptr_buflen2; - uint32 buflen2; - -} REG_Q_INFO; - -/* REG_R_INFO */ -typedef struct r_reg_info_info -{ - uint32 ptr_type; /* key type pointer */ - uint32 type; /* key datatype */ - - uint32 ptr_uni_val; /* key value pointer */ - BUFFER2 uni_val; /* key value */ - - uint32 ptr_max_len; - uint32 buf_max_len; - - uint32 ptr_len; - uint32 buf_len; - - NTSTATUS status; /* return status */ - -} REG_R_INFO; - - -/* REG_Q_OPEN_ENTRY */ -typedef struct q_reg_open_entry_info -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_name; /* unicode registry string header */ - UNISTR2 uni_name; /* unicode registry string name */ - - uint32 unknown_0; /* 32 bit unknown - 0x0000 0000 */ - uint32 access_desired; - -} REG_Q_OPEN_ENTRY; - - - -/* REG_R_OPEN_ENTRY */ -typedef struct r_reg_open_entry_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} REG_R_OPEN_ENTRY; - -/* REG_Q_SHUTDOWN */ -typedef struct q_reg_shutdown_info -{ - uint32 ptr_0; - uint32 ptr_1; - uint32 ptr_2; - UNIHDR hdr_msg; /* shutdown message */ - UNISTR2 uni_msg; /* seconds */ - uint32 timeout; /* seconds */ - uint8 force; /* boolean: force shutdown */ - uint8 reboot; /* boolean: reboot on shutdown */ - -} REG_Q_SHUTDOWN; - -/* REG_R_SHUTDOWN */ -typedef struct r_reg_shutdown_info -{ - NTSTATUS status; /* return status */ - -} REG_R_SHUTDOWN; - -/* REG_Q_ABORT_SHUTDOWN */ -typedef struct q_reg_abort_shutdown_info -{ - uint32 ptr_server; - uint16 server; - -} REG_Q_ABORT_SHUTDOWN; - -/* REG_R_ABORT_SHUTDOWN */ -typedef struct r_reg_abort_shutdown_info -{ - NTSTATUS status; /* return status */ - -} REG_R_ABORT_SHUTDOWN; - - -#endif /* _RPC_REG_H */ - diff --git a/source/include/rpc_samr.h b/source/include/rpc_samr.h deleted file mode 100644 index 111e62c3553..00000000000 --- a/source/include/rpc_samr.h +++ /dev/null @@ -1,1862 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-2000 - Copyright (C) Luke Kenneth Casson Leighton 1996-2000 - Copyright (C) Paul Ashton 1997-2000 - Copyright (C) Jean François Micouleau 1998-2001 - Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002 - - - 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_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: - -x SamrAddMemberToAlias -x SamrAddMemberToGroup -SamrAddMultipleMembersToAlias -x SamrChangePasswordUser -x SamrCloseHandle -x SamrConnect -x SamrCreateAliasInDomain -x SamrCreateGroupInDomain -x SamrCreateUserInDomain -? SamrDeleteAlias -SamrDeleteGroup -x SamrDeleteUser -x SamrEnumerateAliasesInDomain -SamrEnumerateDomainsInSamServer -x SamrEnumerateGroupsInDomain -x SamrEnumerateUsersInDomain -SamrGetUserDomainPasswordInformation -SamrLookupDomainInSamServer -? SamrLookupIdsInDomain -x SamrLookupNamesInDomain -x SamrOpenAlias -x SamrOpenDomain -x SamrOpenGroup -x SamrOpenUser -x SamrQueryDisplayInformation -x SamrQueryInformationAlias -SamrQueryInformationDomain -? SamrQueryInformationUser -x SamrQuerySecurityObject -SamrRemoveMemberFromAlias -SamrRemoveMemberFromForiegnDomain -SamrRemoveMemberFromGroup -SamrRemoveMultipleMembersFromAlias -x SamrSetInformationAlias -SamrSetInformationDomain -x SamrSetInformationGroup -x SamrSetInformationUser -SamrSetMemberAttributesOfGroup -SamrSetSecurityObject -SamrShutdownSamServer -SamrTestPrivateFunctionsDomain -SamrTestPrivateFunctionsUser - -********************************************************************/ - -#define SAMR_CONNECT_ANON 0x00 -#define SAMR_CLOSE_HND 0x01 -#define SAMR_SET_SEC_OBJECT 0x02 -#define SAMR_QUERY_SEC_OBJECT 0x03 - -#define SAMR_UNKNOWN_4 0x04 /* profile info? */ -#define SAMR_LOOKUP_DOMAIN 0x05 -#define SAMR_ENUM_DOMAINS 0x06 -#define SAMR_OPEN_DOMAIN 0x07 -#define SAMR_QUERY_DOMAIN_INFO 0x08 -#define SAMR_SET_DOMAIN_INFO 0x09 - -#define SAMR_CREATE_DOM_GROUP 0x0a -#define SAMR_ENUM_DOM_GROUPS 0x0b -#define SAMR_ENUM_DOM_USERS 0x0d -#define SAMR_CREATE_DOM_ALIAS 0x0e -#define SAMR_ENUM_DOM_ALIASES 0x0f -#define SAMR_QUERY_USERALIASES 0x10 - -#define SAMR_LOOKUP_NAMES 0x11 -#define SAMR_LOOKUP_RIDS 0x12 - -#define SAMR_OPEN_GROUP 0x13 -#define SAMR_QUERY_GROUPINFO 0x14 -#define SAMR_SET_GROUPINFO 0x15 -#define SAMR_ADD_GROUPMEM 0x16 -#define SAMR_DELETE_DOM_GROUP 0x17 -#define SAMR_DEL_GROUPMEM 0x18 -#define SAMR_QUERY_GROUPMEM 0x19 -#define SAMR_UNKNOWN_1A 0x1a - -#define SAMR_OPEN_ALIAS 0x1b -#define SAMR_QUERY_ALIASINFO 0x1c -#define SAMR_SET_ALIASINFO 0x1d -#define SAMR_DELETE_DOM_ALIAS 0x1e -#define SAMR_ADD_ALIASMEM 0x1f -#define SAMR_DEL_ALIASMEM 0x20 -#define SAMR_QUERY_ALIASMEM 0x21 - -#define SAMR_OPEN_USER 0x22 -#define SAMR_DELETE_DOM_USER 0x23 -#define SAMR_QUERY_USERINFO 0x24 -#define SAMR_SET_USERINFO2 0x25 -#define SAMR_QUERY_USERGROUPS 0x27 - -#define SAMR_QUERY_DISPINFO 0x28 -#define SAMR_UNKNOWN_29 0x29 -#define SAMR_UNKNOWN_2a 0x2a -#define SAMR_UNKNOWN_2b 0x2b -#define SAMR_GET_USRDOM_PWINFO 0x2c -#define SAMR_REMOVE_SID_FOREIGN_DOMAIN 0x2d -#define SAMR_UNKNOWN_2E 0x2e /* looks like an alias for SAMR_QUERY_DOMAIN_INFO */ -#define SAMR_UNKNOWN_2f 0x2f -#define SAMR_QUERY_DISPINFO3 0x30 /* Alias for SAMR_QUERY_DISPINFO - with info level 3 */ -#define SAMR_UNKNOWN_31 0x31 -#define SAMR_CREATE_USER 0x32 -#define SAMR_QUERY_DISPINFO4 0x33 /* Alias for SAMR_QUERY_DISPINFO - with info level 4 */ -#define SAMR_ADDMULTI_ALIASMEM 0x34 - -#define SAMR_UNKNOWN_35 0x35 -#define SAMR_UNKNOWN_36 0x36 -#define SAMR_CHGPASSWD_USER 0x37 -#define SAMR_GET_DOM_PWINFO 0x38 -#define SAMR_CONNECT 0x39 -#define SAMR_SET_USERINFO 0x3A -#define SAMR_CONNECT4 0x3E - -typedef struct logon_hours_info -{ - uint32 len; /* normally 21 bytes */ - uint8 hours[32]; - -} LOGON_HRS; - -/* SAM_USER_INFO_23 */ -typedef struct sam_user_info_23 -{ - /* TIMES MAY NOT IN RIGHT ORDER!!!! */ - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - UNIHDR hdr_user_name; /* NULL - user name unicode string header */ - UNIHDR hdr_full_name; /* user's full name unicode string header */ - UNIHDR hdr_home_dir; /* home directory unicode string header */ - UNIHDR hdr_dir_drive; /* home drive unicode string header */ - UNIHDR hdr_logon_script; /* logon script unicode string header */ - UNIHDR hdr_profile_path; /* profile path unicode string header */ - UNIHDR hdr_acct_desc ; /* user description */ - UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */ - UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */ - UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */ - - uint8 lm_pwd[16]; /* lm user passwords */ - uint8 nt_pwd[16]; /* nt user passwords */ - - uint32 user_rid; /* Primary User ID */ - uint32 group_rid; /* Primary Group ID */ - - uint32 acb_info; /* account info (ACB_xxxx bit-mask) */ - - uint32 fields_present; /* 0x09f8 27fa */ - - uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */ - /* uint8 pad[2] */ - uint32 ptr_logon_hrs; /* pointer to logon hours */ - - /* Was unknown_5. */ - uint16 bad_password_count; - uint16 logon_count; - - uint8 padding1[6]; - - uint8 passmustchange; /* 0x00 must change = 0x01 */ - - uint8 padding2; - - uint8 pass[516]; - - UNISTR2 uni_user_name; /* NULL - username unicode string */ - UNISTR2 uni_full_name; /* user's full name unicode string */ - UNISTR2 uni_home_dir; /* home directory unicode string */ - UNISTR2 uni_dir_drive; /* home directory drive unicode string */ - UNISTR2 uni_logon_script; /* logon script unicode string */ - UNISTR2 uni_profile_path; /* profile path unicode string */ - UNISTR2 uni_acct_desc ; /* user description unicode string */ - UNISTR2 uni_workstations; /* login from workstations unicode string */ - UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */ - UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */ - - uint32 unknown_6; /* 0x0000 04ec */ - uint32 padding4; - - LOGON_HRS logon_hrs; - -} SAM_USER_INFO_23; - -/* SAM_USER_INFO_24 */ -typedef struct sam_user_info_24 -{ - uint8 pass[516]; - uint16 pw_len; -} SAM_USER_INFO_24; - -/* - * NB. This structure is *definately* incorrect. It's my best guess - * currently for W2K SP2. The password field is encrypted in a different - * way than normal... And there are definately other problems. JRA. - */ - -/* SAM_USER_INFO_25 */ -typedef struct sam_user_info_25 -{ - /* TIMES MAY NOT IN RIGHT ORDER!!!! */ - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - UNIHDR hdr_user_name; /* NULL - user name unicode string header */ - UNIHDR hdr_full_name; /* user's full name unicode string header */ - UNIHDR hdr_home_dir; /* home directory unicode string header */ - UNIHDR hdr_dir_drive; /* home drive unicode string header */ - UNIHDR hdr_logon_script; /* logon script unicode string header */ - UNIHDR hdr_profile_path; /* profile path unicode string header */ - UNIHDR hdr_acct_desc ; /* user description */ - UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */ - UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */ - UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */ - - uint8 lm_pwd[16]; /* lm user passwords */ - uint8 nt_pwd[16]; /* nt user passwords */ - - uint32 user_rid; /* Primary User ID */ - uint32 group_rid; /* Primary Group ID */ - - uint32 acb_info; /* account info (ACB_xxxx bit-mask) */ - - uint32 unknown_6[6]; - - uint8 pass[532]; - - UNISTR2 uni_user_name; /* NULL - username unicode string */ - UNISTR2 uni_full_name; /* user's full name unicode string */ - UNISTR2 uni_home_dir; /* home directory unicode string */ - UNISTR2 uni_dir_drive; /* home directory drive unicode string */ - UNISTR2 uni_logon_script; /* logon script unicode string */ - UNISTR2 uni_profile_path; /* profile path unicode string */ - UNISTR2 uni_acct_desc ; /* user description unicode string */ - UNISTR2 uni_workstations; /* login from workstations unicode string */ - UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */ - UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */ -} SAM_USER_INFO_25; - - -/* SAM_USER_INFO_21 */ -typedef struct sam_user_info_21 -{ - NTTIME logon_time; /* logon time */ - NTTIME logoff_time; /* logoff time */ - NTTIME kickoff_time; /* kickoff time */ - NTTIME pass_last_set_time; /* password last set time */ - NTTIME pass_can_change_time; /* password can change time */ - NTTIME pass_must_change_time; /* password must change time */ - - UNIHDR hdr_user_name; /* username unicode string header */ - UNIHDR hdr_full_name; /* user's full name unicode string header */ - UNIHDR hdr_home_dir; /* home directory unicode string header */ - UNIHDR hdr_dir_drive; /* home drive unicode string header */ - UNIHDR hdr_logon_script; /* logon script unicode string header */ - UNIHDR hdr_profile_path; /* profile path unicode string header */ - UNIHDR hdr_acct_desc ; /* user description */ - UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */ - UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */ - UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */ - - uint8 lm_pwd[16]; /* lm user passwords */ - uint8 nt_pwd[16]; /* nt user passwords */ - - uint32 user_rid; /* Primary User ID */ - uint32 group_rid; /* Primary Group ID */ - - uint32 acb_info; /* account info (ACB_xxxx bit-mask) */ - - /* Was unknown_3 */ - uint32 fields_present; /* 0x00ff ffff */ - - uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */ - /* uint8 pad[2] */ - uint32 ptr_logon_hrs; /* unknown pointer */ - - /* Was unknown_5. */ - uint16 bad_password_count; - uint16 logon_count; - - uint8 padding1[6]; - - uint8 passmustchange; /* 0x00 must change = 0x01 */ - - uint8 padding2; - - UNISTR2 uni_user_name; /* username unicode string */ - UNISTR2 uni_full_name; /* user's full name unicode string */ - UNISTR2 uni_home_dir; /* home directory unicode string */ - UNISTR2 uni_dir_drive; /* home directory drive unicode string */ - UNISTR2 uni_logon_script; /* logon script unicode string */ - UNISTR2 uni_profile_path; /* profile path unicode string */ - UNISTR2 uni_acct_desc ; /* user description unicode string */ - UNISTR2 uni_workstations; /* login from workstations unicode string */ - UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */ - UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */ - - uint32 unknown_6; /* 0x0000 04ec */ - uint32 padding4; - - LOGON_HRS logon_hrs; - -} SAM_USER_INFO_21; - -#define PASS_MUST_CHANGE_AT_NEXT_LOGON 0x01 -#define PASS_DONT_CHANGE_AT_NEXT_LOGON 0x00 - -/* SAM_USER_INFO_20 */ -typedef struct sam_user_info_20 -{ - UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */ - - UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */ - -} SAM_USER_INFO_20; - -/* SAM_USER_INFO_12 */ -typedef struct sam_user_info_12 -{ - uint8 lm_pwd[16]; /* lm user passwords */ - uint8 nt_pwd[16]; /* nt user passwords */ - - uint8 lm_pwd_active; - uint8 nt_pwd_active; - -} SAM_USER_INFO_12; - -/* SAM_USER_INFO_11 */ -typedef struct sam_user_info_11 -{ - uint8 padding_0[16]; /* 0 - padding 16 bytes */ - NTTIME expiry; /* expiry time or something? */ - uint8 padding_1[24]; /* 0 - padding 24 bytes */ - - UNIHDR hdr_mach_acct; /* unicode header for machine account */ - uint32 padding_2; /* 0 - padding 4 bytes */ - - uint32 ptr_1; /* pointer */ - uint8 padding_3[32]; /* 0 - padding 32 bytes */ - uint32 padding_4; /* 0 - padding 4 bytes */ - - uint32 ptr_2; /* pointer */ - uint32 padding_5; /* 0 - padding 4 bytes */ - - uint32 ptr_3; /* pointer */ - uint8 padding_6[32]; /* 0 - padding 32 bytes */ - - uint32 rid_user; /* user RID */ - uint32 rid_group; /* group RID */ - - uint16 acct_ctrl; /* 0080 - ACB_XXXX */ - uint16 unknown_3; /* 16 bit padding */ - - uint16 unknown_4; /* 0x003f - 16 bit unknown */ - uint16 unknown_5; /* 0x003c - 16 bit unknown */ - - uint8 padding_7[16]; /* 0 - padding 16 bytes */ - uint32 padding_8; /* 0 - padding 4 bytes */ - - UNISTR2 uni_mach_acct; /* unicode string for machine account */ - - uint8 padding_9[48]; /* 0 - padding 48 bytes */ - -} SAM_USER_INFO_11; - - -/* SAM_USER_INFO_10 */ -typedef struct sam_user_info_10 -{ - uint32 acb_info; - -} SAM_USER_INFO_10; - - - -/* SAMR_Q_CLOSE_HND - probably a policy handle close */ -typedef struct q_samr_close_hnd_info -{ - POLICY_HND pol; /* policy handle */ - -} SAMR_Q_CLOSE_HND; - - -/* SAMR_R_CLOSE_HND - probably a policy handle close */ -typedef struct r_samr_close_hnd_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_CLOSE_HND; - - -/**************************************************************************** -SAMR_Q_GET_USRDOM_PWINFO - a "set user info" occurs just after this -*****************************************************************************/ - -/* SAMR_Q_GET_USRDOM_PWINFO */ -typedef struct q_samr_usrdom_pwinfo_info -{ - POLICY_HND user_pol; /* policy handle */ - -} SAMR_Q_GET_USRDOM_PWINFO; - - -/**************************************************************************** -SAMR_R_GET_USRDOM_PWINFO - a "set user info" occurs just after this -*****************************************************************************/ - -/* SAMR_R_GET_USRDOM_PWINFO */ -typedef struct r_samr_usrdom_pwinfo_info -{ - uint16 unknown_0; /* 0000 */ - uint16 unknown_1; /* 0x0016 or 0x0015 */ - uint32 unknown_2; /* 0x0000 0000 */ - NTSTATUS status; - -} SAMR_R_GET_USRDOM_PWINFO; - -/**************************************************************************** -SAMR_Q_SET_SEC_OBJ - info level 4. -*****************************************************************************/ - -/* SAMR_Q_SET_SEC_OBJ - */ -typedef struct q_samr_set_sec_obj_info -{ - POLICY_HND pol; /* policy handle */ - uint32 sec_info; /* xxxx_SECURITY_INFORMATION 0x0000 0004 */ - SEC_DESC_BUF *buf; - -} SAMR_Q_SET_SEC_OBJ; - -/* SAMR_R_SET_SEC_OBJ - */ -typedef struct r_samr_set_sec_obj_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_SET_SEC_OBJ; - - -/**************************************************************************** -SAMR_Q_QUERY_SEC_OBJ - info level 4. returns SIDs. -*****************************************************************************/ - -/* SAMR_Q_QUERY_SEC_OBJ - probably get domain info... */ -typedef struct q_samr_query_sec_obj_info -{ - POLICY_HND user_pol; /* policy handle */ - uint32 sec_info; /* xxxx_SECURITY_INFORMATION 0x0000 0004 */ - -} SAMR_Q_QUERY_SEC_OBJ; - -/* SAMR_R_QUERY_SEC_OBJ - probably an open */ -typedef struct r_samr_query_sec_obj_info -{ - uint32 ptr; - SEC_DESC_BUF *buf; - - NTSTATUS status; /* return status */ - -} SAMR_R_QUERY_SEC_OBJ; - - -/**************************************************************************** -SAMR_Q_QUERY_DOMAIN_INFO - probably a query on domain group info. -*****************************************************************************/ - -/* SAMR_Q_QUERY_DOMAIN_INFO - */ -typedef struct q_samr_query_domain_info -{ - POLICY_HND domain_pol; /* policy handle */ - uint16 switch_value; /* 0x0002, 0x0001 */ - -} SAMR_Q_QUERY_DOMAIN_INFO; - -typedef struct sam_unknown_info_3_info -{ - NTTIME logout; - /* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/ - - /* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/ - -} SAM_UNK_INFO_3; - -typedef struct sam_unknown_info_6_info -{ - uint32 unknown_0; /* 0x0000 0000 */ - - uint32 ptr_0; /* pointer to unknown structure */ - uint8 padding[12]; /* 12 bytes zeros */ - -} SAM_UNK_INFO_6; - -typedef struct sam_unknown_info_7_info -{ - uint16 unknown_0; /* 0x0003 */ - -} SAM_UNK_INFO_7; - -typedef struct sam_unknown_info_12_inf -{ - NTTIME duration; - NTTIME reset_count; - uint16 bad_attempt_lockout; - -} SAM_UNK_INFO_12; - -typedef struct sam_unknown_info_5_inf -{ - UNIHDR hdr_server; /* server name unicode header */ - UNISTR2 uni_server; /* server name unicode string */ - -} SAM_UNK_INFO_5; - -typedef struct sam_unknown_info_2_inf -{ - uint32 unknown_0; /* 0x0000 0000 */ - uint32 unknown_1; /* 0x8000 0000 */ - uint32 unknown_2; /* 0x0000 0000 */ - - uint32 ptr_0; /* pointer to unknown structure */ - UNIHDR hdr_domain; /* domain name unicode header */ - UNIHDR hdr_server; /* server name unicode header */ - - /* put all the data in here, at the moment, including what the above - pointer is referring to - */ - - uint32 seq_num; /* some sort of incrementing sequence number? */ - uint32 unknown_3; /* 0x0000 0000 */ - - uint32 unknown_4; /* 0x0000 0001 */ - uint32 unknown_5; /* 0x0000 0003 */ - uint32 unknown_6; /* 0x0000 0001 */ - uint32 num_domain_usrs; /* number of users in domain */ - uint32 num_domain_grps; /* number of domain groups in domain */ - uint32 num_local_grps; /* number of local groups in domain */ - - uint8 padding[12]; /* 12 bytes zeros */ - - UNISTR2 uni_domain; /* domain name unicode string */ - UNISTR2 uni_server; /* server name unicode string */ - -} SAM_UNK_INFO_2; - -typedef struct sam_unknown_info_1_inf -{ - uint16 min_length_password; - uint16 password_history; - uint32 flag; - NTTIME expire; - NTTIME min_passwordage; - -} SAM_UNK_INFO_1; - - -typedef struct sam_unknown_ctr_info -{ - union - { - SAM_UNK_INFO_1 inf1; - SAM_UNK_INFO_2 inf2; - SAM_UNK_INFO_3 inf3; - SAM_UNK_INFO_5 inf5; - SAM_UNK_INFO_6 inf6; - SAM_UNK_INFO_7 inf7; - SAM_UNK_INFO_12 inf12; - - } info; - -} SAM_UNK_CTR; - - -/* SAMR_R_QUERY_DOMAIN_INFO - */ -typedef struct r_samr_query_domain_info -{ - uint32 ptr_0; - uint16 switch_value; /* same as in query */ - - SAM_UNK_CTR *ctr; - - NTSTATUS status; /* return status */ - -} SAMR_R_QUERY_DOMAIN_INFO; - - -/* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */ -typedef struct q_samr_lookup_domain_info -{ - POLICY_HND connect_pol; - - UNIHDR hdr_domain; - UNISTR2 uni_domain; - -} SAMR_Q_LOOKUP_DOMAIN; - - -/* SAMR_R_LOOKUP_DOMAIN */ -typedef struct r_samr_lookup_domain_info -{ - uint32 ptr_sid; - DOM_SID2 dom_sid; - - NTSTATUS status; - -} SAMR_R_LOOKUP_DOMAIN; - - -/**************************************************************************** -SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs: - -0x0000 03f1 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0 -0x0000 0200 and a specific domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0 -*****************************************************************************/ - -/* SAMR_Q_OPEN_DOMAIN */ -typedef struct q_samr_open_domain_info -{ - POLICY_HND pol; /* policy handle */ - uint32 flags; /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - flags? */ - DOM_SID2 dom_sid; /* domain SID */ - -} SAMR_Q_OPEN_DOMAIN; - - -/* SAMR_R_OPEN_DOMAIN - probably an open */ -typedef struct r_samr_open_domain_info -{ - POLICY_HND domain_pol; /* policy handle associated with the SID */ - NTSTATUS status; /* return status */ - -} SAMR_R_OPEN_DOMAIN; - -#define MAX_SAM_ENTRIES_W2K 0x400 -#define MAX_SAM_ENTRIES_W95 50 -/* The following should be the greater of the preceeding two. */ -#define MAX_SAM_ENTRIES MAX_SAM_ENTRIES_W2K - -typedef struct samr_entry_info -{ - uint32 rid; - UNIHDR hdr_name; - -} SAM_ENTRY; - - -/* SAMR_Q_ENUM_DOMAINS - SAM rids and names */ -typedef struct q_samr_enum_domains_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 start_idx; /* enumeration handle */ - uint32 max_size; /* 0x0000 ffff */ - -} SAMR_Q_ENUM_DOMAINS; - -/* SAMR_R_ENUM_DOMAINS - SAM rids and Domain names */ -typedef struct r_samr_enum_domains_info -{ - uint32 next_idx; /* next starting index required for enum */ - uint32 ptr_entries1; - - uint32 num_entries2; - uint32 ptr_entries2; - - uint32 num_entries3; - - SAM_ENTRY *sam; - UNISTR2 *uni_dom_name; - - uint32 num_entries4; - - NTSTATUS status; - -} SAMR_R_ENUM_DOMAINS; - -/* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */ -typedef struct q_samr_enum_dom_users_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 start_idx; /* number of values (0 indicates unlimited?) */ - uint16 acb_mask; /* 0x0000 indicates all */ - uint16 unknown_1; /* 0x0000 */ - - uint32 max_size; /* 0x0000 ffff */ - -} SAMR_Q_ENUM_DOM_USERS; - - -/* SAMR_R_ENUM_DOM_USERS - SAM rids and names */ -typedef struct r_samr_enum_dom_users_info -{ - uint32 next_idx; /* next starting index required for enum */ - uint32 ptr_entries1; - - uint32 num_entries2; - uint32 ptr_entries2; - - uint32 num_entries3; - - SAM_ENTRY *sam; - UNISTR2 *uni_acct_name; - - uint32 num_entries4; - - NTSTATUS status; - -} SAMR_R_ENUM_DOM_USERS; - - -/* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */ -typedef struct q_samr_enum_dom_groups_info -{ - POLICY_HND pol; /* policy handle */ - - /* this is possibly an enumeration context handle... */ - uint32 start_idx; /* 0x0000 0000 */ - - uint32 max_size; /* 0x0000 ffff */ - -} SAMR_Q_ENUM_DOM_GROUPS; - - -/* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */ -typedef struct r_samr_enum_dom_groups_info -{ - uint32 next_idx; - uint32 ptr_entries1; - - uint32 num_entries2; - uint32 ptr_entries2; - - uint32 num_entries3; - - SAM_ENTRY *sam; - UNISTR2 *uni_grp_name; - - uint32 num_entries4; - - NTSTATUS status; - -} SAMR_R_ENUM_DOM_GROUPS; - - -/* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */ -typedef struct q_samr_enum_dom_aliases_info -{ - POLICY_HND pol; /* policy handle */ - - /* this is possibly an enumeration context handle... */ - uint32 start_idx; /* 0x0000 0000 */ - - uint32 max_size; /* 0x0000 ffff */ - -} SAMR_Q_ENUM_DOM_ALIASES; - - -/* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */ -typedef struct r_samr_enum_dom_aliases_info -{ - uint32 next_idx; - uint32 ptr_entries1; - - uint32 num_entries2; - uint32 ptr_entries2; - - uint32 num_entries3; - - SAM_ENTRY *sam; - UNISTR2 *uni_grp_name; - - uint32 num_entries4; - - NTSTATUS status; - -} SAMR_R_ENUM_DOM_ALIASES; - - -/* -- Level 1 Display Info - User Information -- */ - -typedef struct samr_entry_info1 -{ - uint32 user_idx; - - uint32 rid_user; - uint16 acb_info; - - UNIHDR hdr_acct_name; - UNIHDR hdr_user_name; - UNIHDR hdr_user_desc; - -} SAM_ENTRY1; - -typedef struct samr_str_entry_info1 -{ - UNISTR2 uni_acct_name; - UNISTR2 uni_full_name; - UNISTR2 uni_acct_desc; - -} SAM_STR1; - -typedef struct sam_entry_info_1 -{ - SAM_ENTRY1 *sam; - SAM_STR1 *str; - -} SAM_DISPINFO_1; - - -/* -- Level 2 Display Info - Trust Account Information -- */ - -typedef struct samr_entry_info2 -{ - uint32 user_idx; - - uint32 rid_user; - uint16 acb_info; - - UNIHDR hdr_srv_name; - UNIHDR hdr_srv_desc; - -} SAM_ENTRY2; - -typedef struct samr_str_entry_info2 -{ - UNISTR2 uni_srv_name; - UNISTR2 uni_srv_desc; - -} SAM_STR2; - -typedef struct sam_entry_info_2 -{ - SAM_ENTRY2 *sam; - SAM_STR2 *str; - -} SAM_DISPINFO_2; - - -/* -- Level 3 Display Info - Domain Group Information -- */ - -typedef struct samr_entry_info3 -{ - uint32 grp_idx; - - uint32 rid_grp; - uint32 attr; /* SE_GROUP_xxx, usually 7 */ - - UNIHDR hdr_grp_name; - UNIHDR hdr_grp_desc; - -} SAM_ENTRY3; - -typedef struct samr_str_entry_info3 -{ - UNISTR2 uni_grp_name; - UNISTR2 uni_grp_desc; - -} SAM_STR3; - -typedef struct sam_entry_info_3 -{ - SAM_ENTRY3 *sam; - SAM_STR3 *str; - -} SAM_DISPINFO_3; - - -/* -- Level 4 Display Info - User List (ASCII) -- */ - -typedef struct samr_entry_info4 -{ - uint32 user_idx; - STRHDR hdr_acct_name; - -} SAM_ENTRY4; - -typedef struct samr_str_entry_info4 -{ - STRING2 acct_name; - -} SAM_STR4; - -typedef struct sam_entry_info_4 -{ - SAM_ENTRY4 *sam; - SAM_STR4 *str; - -} SAM_DISPINFO_4; - - -/* -- Level 5 Display Info - Group List (ASCII) -- */ - -typedef struct samr_entry_info5 -{ - uint32 grp_idx; - STRHDR hdr_grp_name; - -} SAM_ENTRY5; - -typedef struct samr_str_entry_info5 -{ - STRING2 grp_name; - -} SAM_STR5; - -typedef struct sam_entry_info_5 -{ - SAM_ENTRY5 *sam; - SAM_STR5 *str; - -} SAM_DISPINFO_5; - - -typedef struct sam_dispinfo_ctr_info -{ - union - { - SAM_DISPINFO_1 *info1; /* users/names/descriptions */ - SAM_DISPINFO_2 *info2; /* trust accounts */ - SAM_DISPINFO_3 *info3; /* domain groups/descriptions */ - SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */ - SAM_DISPINFO_5 *info5; /* group list (ASCII) */ - void *info; /* allows assignment without typecasting, */ - - } sam; - -} SAM_DISPINFO_CTR; - - -/* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */ -typedef struct q_samr_query_disp_info -{ - POLICY_HND domain_pol; - - uint16 switch_level; /* see SAM_DISPINFO_CTR above */ - /* align */ - - uint32 start_idx; /* start enumeration index */ - uint32 max_entries; /* maximum number of entries to return */ - uint32 max_size; /* recommended data size; if exceeded server - should return STATUS_MORE_ENTRIES */ - -} SAMR_Q_QUERY_DISPINFO; - - -/* SAMR_R_QUERY_DISPINFO */ -typedef struct r_samr_query_dispinfo_info -{ - uint32 total_size; /* total data size for all matching entries - (0 = uncalculated) */ - uint32 data_size; /* actual data size returned = size of SAM_ENTRY - structures + total length of strings */ - - uint16 switch_level; /* see SAM_DISPINFO_CTR above */ - /* align */ - - uint32 num_entries; /* number of entries returned */ - uint32 ptr_entries; - uint32 num_entries2; - - SAM_DISPINFO_CTR *ctr; - - NTSTATUS status; - -} SAMR_R_QUERY_DISPINFO; - - -/* SAMR_Q_DELETE_DOM_GROUP - delete domain group */ -typedef struct q_samr_delete_dom_group_info -{ - POLICY_HND group_pol; /* policy handle */ - -} SAMR_Q_DELETE_DOM_GROUP; - - -/* SAMR_R_DELETE_DOM_GROUP - delete domain group */ -typedef struct r_samr_delete_dom_group_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_DELETE_DOM_GROUP; - - -/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */ -typedef struct q_samr_create_dom_group_info -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_acct_desc; - UNISTR2 uni_acct_desc; - - uint32 access_mask; - -} SAMR_Q_CREATE_DOM_GROUP; - -/* SAMR_R_CREATE_DOM_GROUP - SAM create group */ -typedef struct r_samr_create_dom_group_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 rid; - NTSTATUS status; - -} SAMR_R_CREATE_DOM_GROUP; - -/* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */ -typedef struct q_samr_query_group_info -{ - POLICY_HND pol; /* policy handle */ - - uint16 switch_level; /* 0x0001 seen */ - -} SAMR_Q_QUERY_GROUPINFO; - -typedef struct samr_group_info1 -{ - UNIHDR hdr_acct_name; - - uint32 unknown_1; /* 0x0000 0003 - number of group members? */ - uint32 num_members; /* 0x0000 0001 - number of group members? */ - - UNIHDR hdr_acct_desc; - - UNISTR2 uni_acct_name; - UNISTR2 uni_acct_desc; - -} GROUP_INFO1; - -typedef struct samr_group_info3 -{ - uint32 unknown_1; /* 0x0000 0003 - number of group members? */ - -} GROUP_INFO3; - -typedef struct samr_group_info4 -{ - uint16 level; - UNIHDR hdr_acct_desc; - UNISTR2 uni_acct_desc; - -} GROUP_INFO4; - -/* GROUP_INFO_CTR */ -typedef struct group_info_ctr -{ - uint16 switch_value1; - - union - { - GROUP_INFO1 info1; - GROUP_INFO3 info3; - GROUP_INFO4 info4; - - } group; - -} GROUP_INFO_CTR; - -/* SAMR_R_QUERY_GROUPINFO - SAM Group Info */ -typedef struct r_samr_query_groupinfo_info -{ - uint32 ptr; - GROUP_INFO_CTR *ctr; - - NTSTATUS status; - -} SAMR_R_QUERY_GROUPINFO; - - -/* SAMR_Q_SET_GROUPINFO - SAM Group Info */ -typedef struct q_samr_set_group_info -{ - POLICY_HND pol; /* policy handle */ - GROUP_INFO_CTR *ctr; - -} SAMR_Q_SET_GROUPINFO; - -/* SAMR_R_SET_GROUPINFO - SAM Group Info */ -typedef struct r_samr_set_group_info -{ - NTSTATUS status; - -} SAMR_R_SET_GROUPINFO; - - -/* SAMR_Q_DELETE_DOM_ALIAS - delete domain alias */ -typedef struct q_samr_delete_dom_alias_info -{ - POLICY_HND alias_pol; /* policy handle */ - -} SAMR_Q_DELETE_DOM_ALIAS; - - -/* SAMR_R_DELETE_DOM_ALIAS - delete domain alias */ -typedef struct r_samr_delete_dom_alias_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_DELETE_DOM_ALIAS; - - -/* SAMR_Q_CREATE_DOM_ALIAS - SAM create alias */ -typedef struct q_samr_create_dom_alias_info -{ - POLICY_HND dom_pol; /* policy handle */ - - UNIHDR hdr_acct_desc; - UNISTR2 uni_acct_desc; - - uint32 access_mask; /* 0x001f000f */ - -} SAMR_Q_CREATE_DOM_ALIAS; - -/* SAMR_R_CREATE_DOM_ALIAS - SAM create alias */ -typedef struct r_samr_create_dom_alias_info -{ - POLICY_HND alias_pol; /* policy handle */ - - uint32 rid; - NTSTATUS status; - -} SAMR_R_CREATE_DOM_ALIAS; - -/* SAMR_Q_QUERY_ALIASINFO - SAM Alias Info */ -typedef struct q_samr_query_alias_info -{ - POLICY_HND pol; /* policy handle */ - - uint16 switch_level; /* 0x0003 seen */ - -} SAMR_Q_QUERY_ALIASINFO; - -typedef struct samr_alias_info1 -{ - UNIHDR hdr_acct_name; - UNIHDR hdr_acct_desc; - uint32 num_member; - UNISTR2 uni_acct_name; - UNISTR2 uni_acct_desc; - -} ALIAS_INFO1; - -typedef struct samr_alias_info3 -{ - UNIHDR hdr_acct_desc; - UNISTR2 uni_acct_desc; - -} ALIAS_INFO3; - -/* ALIAS_INFO_CTR */ -typedef struct alias_info_ctr -{ - uint16 switch_value1; - uint16 switch_value2; - - union - { - ALIAS_INFO1 info1; - ALIAS_INFO3 info3; - - } alias; - -} ALIAS_INFO_CTR; - -/* SAMR_R_QUERY_ALIASINFO - SAM alias info */ -typedef struct r_samr_query_aliasinfo_info -{ - uint32 ptr; - ALIAS_INFO_CTR ctr; - - NTSTATUS status; - -} SAMR_R_QUERY_ALIASINFO; - - -/* SAMR_Q_SET_ALIASINFO - SAM Alias Info */ -typedef struct q_samr_set_alias_info -{ - POLICY_HND alias_pol; /* policy handle */ - ALIAS_INFO_CTR ctr; - -} SAMR_Q_SET_ALIASINFO; - -/* SAMR_R_SET_ALIASINFO - SAM alias info */ -typedef struct r_samr_set_aliasinfo_info -{ - NTSTATUS status; - -} SAMR_R_SET_ALIASINFO; - - -/* SAMR_Q_QUERY_USERGROUPS - */ -typedef struct q_samr_query_usergroup_info -{ - POLICY_HND pol; /* policy handle associated with unknown id */ - -} SAMR_Q_QUERY_USERGROUPS; - -/* SAMR_R_QUERY_USERGROUPS - probably a get sam info */ -typedef struct r_samr_query_usergroup_info -{ - uint32 ptr_0; /* pointer */ - uint32 num_entries; /* number of RID groups */ - uint32 ptr_1; /* pointer */ - uint32 num_entries2; /* number of RID groups */ - - DOM_GID *gid; /* group info */ - - NTSTATUS status; /* return status */ - -} SAMR_R_QUERY_USERGROUPS; - -/* SAM_USERINFO_CTR - sam user info */ -typedef struct sam_userinfo_ctr_info -{ - uint16 switch_value; - - union - { - SAM_USER_INFO_10 *id10; /* auth-level 0x10 */ - SAM_USER_INFO_11 *id11; /* auth-level 0x11 */ - SAM_USER_INFO_12 *id12; /* auth-level 0x12 */ - SAM_USER_INFO_20 *id20; /* auth-level 20 */ - SAM_USER_INFO_21 *id21; /* auth-level 21 */ - SAM_USER_INFO_23 *id23; /* auth-level 0x17 */ - SAM_USER_INFO_24 *id24; /* auth-level 0x18 */ - SAM_USER_INFO_25 *id25; /* auth-level 0x19 */ - void* id; /* to make typecasting easy */ - - } info; - -} SAM_USERINFO_CTR; - - -/* SAMR_Q_SET_USERINFO2 - set sam info */ -typedef struct q_samr_set_user_info2 -{ - POLICY_HND pol; /* policy handle associated with user */ - uint16 switch_value; /* 0x0010 */ - - SAM_USERINFO_CTR *ctr; - -} SAMR_Q_SET_USERINFO2; - -/* SAMR_R_SET_USERINFO2 - set sam info */ -typedef struct r_samr_set_user_info2 -{ - NTSTATUS status; /* return status */ - -} SAMR_R_SET_USERINFO2; - -/* SAMR_Q_SET_USERINFO - set sam info */ -typedef struct q_samr_set_user_info -{ - POLICY_HND pol; /* policy handle associated with user */ - uint16 switch_value; - SAM_USERINFO_CTR *ctr; - -} SAMR_Q_SET_USERINFO; - -/* SAMR_R_SET_USERINFO - set sam info */ -typedef struct r_samr_set_user_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_SET_USERINFO; - - -/* SAMR_Q_QUERY_USERINFO - probably a get sam info */ -typedef struct q_samr_query_user_info -{ - POLICY_HND pol; /* policy handle associated with unknown id */ - uint16 switch_value; /* 0x0015, 0x0011 or 0x0010 - 16 bit unknown */ - -} SAMR_Q_QUERY_USERINFO; - -/* SAMR_R_QUERY_USERINFO - probably a get sam info */ -typedef struct r_samr_query_user_info -{ - uint32 ptr; /* pointer */ - SAM_USERINFO_CTR *ctr; - - NTSTATUS status; /* return status */ - -} SAMR_R_QUERY_USERINFO; - - -/**************************************************************************** -SAMR_Q_QUERY_USERALIASES - do a conversion from name to RID. - -the policy handle allocated by an "samr open secret" call is associated -with a SID. this policy handle is what is queried here, *not* the SID -itself. the response to the lookup rids is relative to this SID. -*****************************************************************************/ -/* SAMR_Q_QUERY_USERALIASES */ -typedef struct q_samr_query_useraliases_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 num_sids1; /* number of rids being looked up */ - uint32 ptr; /* buffer pointer */ - uint32 num_sids2; /* number of rids being looked up */ - - uint32 *ptr_sid; /* pointers to sids to be looked up */ - DOM_SID2 *sid ; /* sids to be looked up. */ - -} SAMR_Q_QUERY_USERALIASES; - - -/* SAMR_R_QUERY_USERALIASES */ -typedef struct r_samr_query_useraliases_info -{ - uint32 num_entries; - uint32 ptr; /* undocumented buffer pointer */ - - uint32 num_entries2; - uint32 *rid; /* domain RIDs being looked up */ - - NTSTATUS status; /* return code */ - -} SAMR_R_QUERY_USERALIASES; - - -/**************************************************************************** -SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types. -*****************************************************************************/ -/* SAMR_Q_LOOKUP_NAMES */ -typedef struct q_samr_lookup_names_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 num_names1; /* number of names being looked up */ - uint32 flags; /* 0x0000 03e8 - unknown */ - uint32 ptr; /* 0x0000 0000 - 32 bit unknown */ - uint32 num_names2; /* number of names being looked up */ - - UNIHDR *hdr_name; /* unicode account name header */ - UNISTR2 *uni_name; /* unicode account name string */ - -} SAMR_Q_LOOKUP_NAMES; - - -/* SAMR_R_LOOKUP_NAMES */ -typedef struct r_samr_lookup_names_info -{ - uint32 num_rids1; /* number of aliases being looked up */ - uint32 ptr_rids; /* pointer to aliases */ - uint32 num_rids2; /* number of aliases being looked up */ - - uint32 *rids; /* rids */ - - uint32 num_types1; /* number of users in aliases being looked up */ - uint32 ptr_types; /* pointer to users in aliases */ - uint32 num_types2; /* number of users in aliases being looked up */ - - uint32 *types; /* SID_ENUM type */ - - NTSTATUS status; /* return code */ - -} SAMR_R_LOOKUP_NAMES; - - -/**************************************************************************** -SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something. - -called to resolve domain RID groups. -*****************************************************************************/ -/* SAMR_Q_LOOKUP_RIDS */ -typedef struct q_samr_lookup_rids_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 num_rids1; /* number of rids being looked up */ - uint32 flags; /* 0x0000 03e8 - unknown */ - uint32 ptr; /* 0x0000 0000 - 32 bit unknown */ - uint32 num_rids2; /* number of rids being looked up */ - - uint32 *rid; /* domain RIDs being looked up */ - -} SAMR_Q_LOOKUP_RIDS; - - -/**************************************************************************** -SAMR_R_LOOKUP_RIDS - do a conversion from group RID to names - -*****************************************************************************/ -/* SAMR_R_LOOKUP_RIDS */ -typedef struct r_samr_lookup_rids_info -{ - uint32 num_names1; /* number of aliases being looked up */ - uint32 ptr_names; /* pointer to aliases */ - uint32 num_names2; /* number of aliases being looked up */ - - UNIHDR *hdr_name; /* unicode account name header */ - UNISTR2 *uni_name; /* unicode account name string */ - - uint32 num_types1; /* number of users in aliases being looked up */ - uint32 ptr_types; /* pointer to users in aliases */ - uint32 num_types2; /* number of users in aliases being looked up */ - - uint32 *type; /* SID_ENUM type */ - - NTSTATUS status; - -} SAMR_R_LOOKUP_RIDS; - - -/* SAMR_Q_OPEN_USER - probably an open */ -typedef struct q_samr_open_user_info -{ - POLICY_HND domain_pol; /* policy handle */ - uint32 access_mask; /* 32 bit unknown - 0x02011b */ - uint32 user_rid; /* user RID */ - -} SAMR_Q_OPEN_USER; - - -/* SAMR_R_OPEN_USER - probably an open */ -typedef struct r_samr_open_user_info -{ - POLICY_HND user_pol; /* policy handle associated with unknown id */ - NTSTATUS status; /* return status */ - -} SAMR_R_OPEN_USER; - - -/* SAMR_Q_CREATE_USER - probably a create */ -typedef struct q_samr_create_user_info -{ - POLICY_HND domain_pol; /* policy handle */ - - UNIHDR hdr_name; /* unicode account name header */ - UNISTR2 uni_name; /* unicode account name */ - - uint32 acb_info; /* account control info */ - uint32 access_mask; /* 0xe005 00b0 */ - -} SAMR_Q_CREATE_USER; - - -/* SAMR_R_CREATE_USER - probably a create */ -typedef struct r_samr_create_user_info -{ - POLICY_HND user_pol; /* policy handle associated with user */ - - uint32 access_granted; - uint32 user_rid; /* user RID */ - NTSTATUS status; /* return status */ - -} SAMR_R_CREATE_USER; - - -/* SAMR_Q_DELETE_DOM_USER - delete domain user */ -typedef struct q_samr_delete_dom_user_info -{ - POLICY_HND user_pol; /* policy handle */ - -} SAMR_Q_DELETE_DOM_USER; - - -/* SAMR_R_DELETE_DOM_USER - delete domain user */ -typedef struct r_samr_delete_dom_user_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_DELETE_DOM_USER; - - -/* SAMR_Q_QUERY_GROUPMEM - query group members */ -typedef struct q_samr_query_groupmem_info -{ - POLICY_HND group_pol; /* policy handle */ - -} SAMR_Q_QUERY_GROUPMEM; - - -/* SAMR_R_QUERY_GROUPMEM - query group members */ -typedef struct r_samr_query_groupmem_info -{ - uint32 ptr; - uint32 num_entries; - - uint32 ptr_rids; - uint32 ptr_attrs; - - uint32 num_rids; - uint32 *rid; - - uint32 num_attrs; - uint32 *attr; - - NTSTATUS status; - -} SAMR_R_QUERY_GROUPMEM; - - -/* SAMR_Q_DEL_GROUPMEM - probably an del group member */ -typedef struct q_samr_del_group_mem_info -{ - POLICY_HND pol; /* policy handle */ - uint32 rid; /* rid */ - -} SAMR_Q_DEL_GROUPMEM; - - -/* SAMR_R_DEL_GROUPMEM - probably an del group member */ -typedef struct r_samr_del_group_mem_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_DEL_GROUPMEM; - - -/* SAMR_Q_ADD_GROUPMEM - probably an add group member */ -typedef struct q_samr_add_group_mem_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 rid; /* rid */ - uint32 unknown; /* 0x0000 0005 */ - -} SAMR_Q_ADD_GROUPMEM; - - -/* SAMR_R_ADD_GROUPMEM - probably an add group member */ -typedef struct r_samr_add_group_mem_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_ADD_GROUPMEM; - - -/* SAMR_Q_OPEN_GROUP - probably an open */ -typedef struct q_samr_open_group_info -{ - POLICY_HND domain_pol; /* policy handle */ - uint32 access_mask; /* 0x0000 0001, 0x0000 0003, 0x0000 001f */ - uint32 rid_group; /* rid */ - -} SAMR_Q_OPEN_GROUP; - - -/* SAMR_R_OPEN_GROUP - probably an open */ -typedef struct r_samr_open_group_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_OPEN_GROUP; - - -/* SAMR_Q_QUERY_ALIASMEM - query alias members */ -typedef struct q_samr_query_aliasmem_info -{ - POLICY_HND alias_pol; /* policy handle */ - -} SAMR_Q_QUERY_ALIASMEM; - - -/* SAMR_R_QUERY_ALIASMEM - query alias members */ -typedef struct r_samr_query_aliasmem_info -{ - uint32 num_sids; - uint32 ptr; - uint32 num_sids1; - - DOM_SID2 *sid; - - NTSTATUS status; - -} SAMR_R_QUERY_ALIASMEM; - - -/* SAMR_Q_ADD_ALIASMEM - add alias member */ -typedef struct q_samr_add_alias_mem_info -{ - POLICY_HND alias_pol; /* policy handle */ - - DOM_SID2 sid; /* member sid to be added to the alias */ - -} SAMR_Q_ADD_ALIASMEM; - - -/* SAMR_R_ADD_ALIASMEM - add alias member */ -typedef struct r_samr_add_alias_mem_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_ADD_ALIASMEM; - - -/* SAMR_Q_DEL_ALIASMEM - add an add alias member */ -typedef struct q_samr_del_alias_mem_info -{ - POLICY_HND alias_pol; /* policy handle */ - - DOM_SID2 sid; /* member sid to be added to alias */ - -} SAMR_Q_DEL_ALIASMEM; - - -/* SAMR_R_DEL_ALIASMEM - delete alias member */ -typedef struct r_samr_del_alias_mem_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_DEL_ALIASMEM; - - - -/* SAMR_Q_OPEN_ALIAS - probably an open */ -typedef struct q_samr_open_alias_info -{ - POLICY_HND dom_pol; - - uint32 access_mask; - uint32 rid_alias; - -} SAMR_Q_OPEN_ALIAS; - - -/* SAMR_R_OPEN_ALIAS - probably an open */ -typedef struct r_samr_open_alias_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_OPEN_ALIAS; - - -/* SAMR_Q_CONNECT_ANON - probably an open */ -typedef struct q_samr_connect_anon_info -{ - uint32 ptr; /* ptr? */ - uint16 unknown_0; /* 0x005c */ - uint16 unknown_1; /* 0x0001 */ - uint32 access_mask; - -} SAMR_Q_CONNECT_ANON; - -/* SAMR_R_CONNECT_ANON - probably an open */ -typedef struct r_samr_connect_anon_info -{ - POLICY_HND connect_pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_CONNECT_ANON; - -/* SAMR_Q_CONNECT - probably an open */ -typedef struct q_samr_connect_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */ - - uint32 access_mask; - -} SAMR_Q_CONNECT; - - -/* SAMR_R_CONNECT - probably an open */ -typedef struct r_samr_connect_info -{ - POLICY_HND connect_pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_CONNECT; - -/* SAMR_Q_CONNECT4 */ -typedef struct q_samr_connect4_info -{ - uint32 ptr_srv_name; /* pointer to server name */ - UNISTR2 uni_srv_name; - - uint32 unk_0; /* possible server name type, 1 for IP num, 2 for name */ - uint32 access_mask; -} SAMR_Q_CONNECT4; - -/* SAMR_R_CONNECT4 - same format as connect */ -typedef struct r_samr_connect_info SAMR_R_CONNECT4; - -/* SAMR_Q_GET_DOM_PWINFO */ -typedef struct q_samr_get_dom_pwinfo -{ - uint32 ptr; - UNIHDR hdr_srv_name; - UNISTR2 uni_srv_name; - -} SAMR_Q_GET_DOM_PWINFO; - -/* SAMR_R_GET_DOM_PWINFO */ -typedef struct r_samr_get_dom_pwinfo -{ - /* - * Previously this was 3 uint16's. However, after some tests - * it appears that the data len for the signing needs to be 16. - * Not sure how 3 unit16's ever worked since the length always - * turned out to 12. 3 uint32's + NT_STATUS == 16 bytes. Tested - * using NT and 2k. --jerry - */ - uint32 unk_0; - uint32 unk_1; - uint32 unk_2; - NTSTATUS status; - -} SAMR_R_GET_DOM_PWINFO; - -/* SAMR_ENC_PASSWD */ -typedef struct enc_passwd_info -{ - uint32 ptr; - uint8 pass[516]; - -} SAMR_ENC_PASSWD; - -/* SAMR_ENC_HASH */ -typedef struct enc_hash_info -{ - uint32 ptr; - uint8 hash[16]; - -} SAMR_ENC_HASH; - -/* SAMR_Q_CHGPASSWD_USER */ -typedef struct q_samr_chgpasswd_user_info -{ - uint32 ptr_0; - - UNIHDR hdr_dest_host; /* server name unicode header */ - UNISTR2 uni_dest_host; /* server name unicode string */ - - UNIHDR hdr_user_name; /* username unicode string header */ - UNISTR2 uni_user_name; /* username unicode string */ - - SAMR_ENC_PASSWD nt_newpass; - SAMR_ENC_HASH nt_oldhash; - - uint32 unknown; /* 0x0000 0001 */ - - SAMR_ENC_PASSWD lm_newpass; - SAMR_ENC_HASH lm_oldhash; - -} SAMR_Q_CHGPASSWD_USER; - -/* SAMR_R_CHGPASSWD_USER */ -typedef struct r_samr_chgpasswd_user_info -{ - NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */ - -} SAMR_R_CHGPASSWD_USER; - - -/* SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN */ -typedef struct q_samr_remove_sid_foreign_domain_info -{ - POLICY_HND dom_pol; /* policy handle */ - DOM_SID2 sid; /* SID */ - -} SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN; - - -/* SAMR_R_REMOVE_SID_FOREIGN_DOMAIN */ -typedef struct r_samr_remove_sid_foreign_domain_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_REMOVE_SID_FOREIGN_DOMAIN; - - - -/* these are from the old rpc_samr.h - they are needed while the merge - is still going on */ -#define MAX_SAM_SIDS 15 - -/* DOM_SID3 - security id */ -typedef struct sid_info_3 -{ - uint16 len; /* length, bytes, including length of len :-) */ - /* uint8 pad[2]; */ - - DOM_SID sid; - -} DOM_SID3; - -/* SAMR_Q_UNKNOWN_2E */ -typedef struct q_samr_unknown_2e_info -{ - POLICY_HND domain_pol; /* policy handle */ - uint16 switch_value; - -} SAMR_Q_UNKNOWN_2E; - -/* SAMR_R_UNKNOWN_2E */ -typedef struct r_samr_unknown_2e_info -{ - uint32 ptr_0; - uint16 switch_value; - SAM_UNK_CTR *ctr; - NTSTATUS status; /* return status */ - -} SAMR_R_UNKNOWN_2E; - -/* SAMR_Q_SET_DOMAIN_INFO */ -typedef struct q_samr_set_domain_info -{ - POLICY_HND domain_pol; /* policy handle */ - uint16 switch_value0; - uint16 switch_value; - SAM_UNK_CTR *ctr; - -} SAMR_Q_SET_DOMAIN_INFO; - -/* SAMR_R_SET_DOMAIN_INFO */ -typedef struct r_samr_set_domain_info -{ - NTSTATUS status; /* return status */ - -} SAMR_R_SET_DOMAIN_INFO; - -#endif /* _RPC_SAMR_H */ diff --git a/source/include/rpc_secdes.h b/source/include/rpc_secdes.h index 56145ac024c..dfcd906b7fa 100644 --- a/source/include/rpc_secdes.h +++ b/source/include/rpc_secdes.h @@ -131,8 +131,8 @@ typedef struct security_ace_info /* this stuff may be present when type is XXXX_TYPE_XXXX_OBJECT */ uint32 obj_flags; /* xxxx_ACE_OBJECT_xxxx e.g present/inherited present etc */ - struct uuid obj_guid; /* object GUID */ - struct uuid inh_guid; /* inherited object GUID */ + struct GUID obj_guid; /* object GUID */ + struct GUID inh_guid; /* inherited object GUID */ /* eof object stuff */ DOM_SID trustee; @@ -297,6 +297,14 @@ typedef struct standard_mapping { SA_RIGHT_FILE_READ_ATTRIBUTES | \ SA_RIGHT_FILE_EXECUTE) + +/* directory specific access rights */ +#define SA_RIGHT_DIR_LIST 0x0001 +#define SA_RIGHT_DIR_ADD_FILE 0x0002 +#define SA_RIGHT_DIR_ADD_SUBDIRECTORY 0x0004 +#define SA_RIGHT_DIR_TRAVERSE 0x0020 +#define SA_RIGHT_DIR_DELETE_CHILD 0x0040 + /* SAM server specific access rights */ diff --git a/source/include/rpc_shutdown.h b/source/include/rpc_shutdown.h deleted file mode 100644 index b8e50b835f5..00000000000 --- a/source/include/rpc_shutdown.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _RPC_SHUTDOWN_H /* _RPC_SHUTDOWN_H */ -#define _RPC_SHUTDOWN_H - - -/* Implemented */ -#define SHUTDOWN_INIT 0x00 -#define SHUTDOWN_ABORT 0x01 -/* NOT IMPLEMENTED -#define SHUTDOWN_INIT_EX 0x02 -*/ - -/* SHUTDOWN_Q_INIT */ -typedef struct q_shutodwn_init_info -{ - uint32 ptr_server; - uint16 server; - uint32 ptr_msg; - UNIHDR hdr_msg; /* shutdown message */ - UNISTR2 uni_msg; /* seconds */ - uint32 timeout; /* seconds */ - uint8 force; /* boolean: force shutdown */ - uint8 reboot; /* boolean: reboot on shutdown */ - -} SHUTDOWN_Q_INIT; - -/* SHUTDOWN_R_INIT */ -typedef struct r_shutdown_init_info -{ - NTSTATUS status; /* return status */ - -} SHUTDOWN_R_INIT; - -/* SHUTDOWN_Q_ABORT */ -typedef struct q_shutdown_abort_info -{ - uint32 ptr_server; - uint16 server; - -} SHUTDOWN_Q_ABORT; - -/* SHUTDOWN_R_ABORT */ -typedef struct r_shutdown_abort_info -{ - NTSTATUS status; /* return status */ - -} SHUTDOWN_R_ABORT; - - -#endif /* _RPC_SHUTDOWN_H */ - diff --git a/source/include/rpc_spoolss.h b/source/include/rpc_spoolss.h deleted file mode 100755 index d9fc0c6a6ab..00000000000 --- a/source/include/rpc_spoolss.h +++ /dev/null @@ -1,2234 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-2000, - Copyright (C) Luke Kenneth Casson Leighton 1996-2000, - Copyright (C) Jean Francois Micouleau 1998-2000. - Copyright (C) Gerald Carter 2001-2002. - - 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_SPOOLSS_H /* _RPC_SPOOLSS_H */ -#define _RPC_SPOOLSS_H - -/* spoolss pipe: this are the calls which are not implemented ... -#define SPOOLSS_GETPRINTERDRIVER 0x0b -#define SPOOLSS_READPRINTER 0x16 -#define SPOOLSS_WAITFORPRINTERCHANGE 0x1c -#define SPOOLSS_ADDPORT 0x25 -#define SPOOLSS_CONFIGUREPORT 0x26 -#define SPOOLSS_DELETEPORT 0x27 -#define SPOOLSS_CREATEPRINTERIC 0x28 -#define SPOOLSS_PLAYGDISCRIPTONPRINTERIC 0x29 -#define SPOOLSS_DELETEPRINTERIC 0x2a -#define SPOOLSS_ADDPRINTERCONNECTION 0x2b -#define SPOOLSS_DELETEPRINTERCONNECTION 0x2c -#define SPOOLSS_PRINTERMESSAGEBOX 0x2d -#define SPOOLSS_ADDMONITOR 0x2e -#define SPOOLSS_DELETEMONITOR 0x2f -#define SPOOLSS_DELETEPRINTPROCESSOR 0x30 -#define SPOOLSS_ADDPRINTPROVIDOR 0x31 -#define SPOOLSS_DELETEPRINTPROVIDOR 0x32 -#define SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION 0x36 -#define SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION 0x37 -#define SPOOLSS_ROUTERFINDFIRSTPRINTERNOTIFICATIONOLD 0x39 -#define SPOOLSS_ADDPORTEX 0x3d -#define SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFICATION0x3e -#define SPOOLSS_SPOOLERINIT 0x3f -#define SPOOLSS_RESETPRINTEREX 0x40 -*/ - -/* those are implemented */ -#define SPOOLSS_ENUMPRINTERS 0x00 -#define SPOOLSS_OPENPRINTER 0x01 -#define SPOOLSS_SETJOB 0x02 -#define SPOOLSS_GETJOB 0x03 -#define SPOOLSS_ENUMJOBS 0x04 -#define SPOOLSS_ADDPRINTER 0x05 -#define SPOOLSS_DELETEPRINTER 0x06 -#define SPOOLSS_SETPRINTER 0x07 -#define SPOOLSS_GETPRINTER 0x08 -#define SPOOLSS_ADDPRINTERDRIVER 0x09 -#define SPOOLSS_ENUMPRINTERDRIVERS 0x0a -#define SPOOLSS_GETPRINTERDRIVERDIRECTORY 0x0c -#define SPOOLSS_DELETEPRINTERDRIVER 0x0d -#define SPOOLSS_ADDPRINTPROCESSOR 0x0e -#define SPOOLSS_ENUMPRINTPROCESSORS 0x0f -#define SPOOLSS_GETPRINTPROCESSORDIRECTORY 0x10 -#define SPOOLSS_STARTDOCPRINTER 0x11 -#define SPOOLSS_STARTPAGEPRINTER 0x12 -#define SPOOLSS_WRITEPRINTER 0x13 -#define SPOOLSS_ENDPAGEPRINTER 0x14 -#define SPOOLSS_ABORTPRINTER 0x15 -#define SPOOLSS_ENDDOCPRINTER 0x17 -#define SPOOLSS_ADDJOB 0x18 -#define SPOOLSS_SCHEDULEJOB 0x19 -#define SPOOLSS_GETPRINTERDATA 0x1a -#define SPOOLSS_SETPRINTERDATA 0x1b -#define SPOOLSS_CLOSEPRINTER 0x1d -#define SPOOLSS_ADDFORM 0x1e -#define SPOOLSS_DELETEFORM 0x1f -#define SPOOLSS_GETFORM 0x20 -#define SPOOLSS_SETFORM 0x21 -#define SPOOLSS_ENUMFORMS 0x22 -#define SPOOLSS_ENUMPORTS 0x23 -#define SPOOLSS_ENUMMONITORS 0x24 -#define SPOOLSS_ENUMPRINTPROCDATATYPES 0x33 -#define SPOOLSS_RESETPRINTER 0x34 -#define SPOOLSS_GETPRINTERDRIVER2 0x35 -#define SPOOLSS_FCPN 0x38 /* FindClosePrinterNotify */ -#define SPOOLSS_REPLYOPENPRINTER 0x3a -#define SPOOLSS_ROUTERREPLYPRINTER 0x3b -#define SPOOLSS_REPLYCLOSEPRINTER 0x3c -#define SPOOLSS_RFFPCNEX 0x41 /* RemoteFindFirstPrinterChangeNotifyEx */ -#define SPOOLSS_RRPCN 0x42 /* RouteRefreshPrinterChangeNotification */ -#define SPOOLSS_RFNPCNEX 0x43 /* RemoteFindNextPrinterChangeNotifyEx */ -#define SPOOLSS_OPENPRINTEREX 0x45 -#define SPOOLSS_ADDPRINTEREX 0x46 -#define SPOOLSS_ENUMPRINTERDATA 0x48 -#define SPOOLSS_DELETEPRINTERDATA 0x49 -#define SPOOLSS_SETPRINTERDATAEX 0x4d -#define SPOOLSS_GETPRINTERDATAEX 0x4e -#define SPOOLSS_ENUMPRINTERDATAEX 0x4f -#define SPOOLSS_ENUMPRINTERKEY 0x50 -#define SPOOLSS_DELETEPRINTERDATAEX 0x51 -#define SPOOLSS_DELETEPRINTERKEY 0x52 -#define SPOOLSS_DELETEPRINTERDRIVEREX 0x54 -#define SPOOLSS_ADDPRINTERDRIVEREX 0x59 - - -#define PRINTER_CONTROL_UNPAUSE 0x00000000 -#define PRINTER_CONTROL_PAUSE 0x00000001 -#define PRINTER_CONTROL_RESUME 0x00000002 -#define PRINTER_CONTROL_PURGE 0x00000003 -#define PRINTER_CONTROL_SET_STATUS 0x00000004 - -#define PRINTER_STATUS_OK 0x00000000 -#define PRINTER_STATUS_PAUSED 0x00000001 -#define PRINTER_STATUS_ERROR 0x00000002 -#define PRINTER_STATUS_PENDING_DELETION 0x00000004 -#define PRINTER_STATUS_PAPER_JAM 0x00000008 - -#define PRINTER_STATUS_PAPER_OUT 0x00000010 -#define PRINTER_STATUS_MANUAL_FEED 0x00000020 -#define PRINTER_STATUS_PAPER_PROBLEM 0x00000040 -#define PRINTER_STATUS_OFFLINE 0x00000080 - -#define PRINTER_STATUS_IO_ACTIVE 0x00000100 -#define PRINTER_STATUS_BUSY 0x00000200 -#define PRINTER_STATUS_PRINTING 0x00000400 -#define PRINTER_STATUS_OUTPUT_BIN_FULL 0x00000800 - -#define PRINTER_STATUS_NOT_AVAILABLE 0x00001000 -#define PRINTER_STATUS_WAITING 0x00002000 -#define PRINTER_STATUS_PROCESSING 0x00004000 -#define PRINTER_STATUS_INITIALIZING 0x00008000 - -#define PRINTER_STATUS_WARMING_UP 0x00010000 -#define PRINTER_STATUS_TONER_LOW 0x00020000 -#define PRINTER_STATUS_NO_TONER 0x00040000 -#define PRINTER_STATUS_PAGE_PUNT 0x00080000 - -#define PRINTER_STATUS_USER_INTERVENTION 0x00100000 -#define PRINTER_STATUS_OUT_OF_MEMORY 0x00200000 -#define PRINTER_STATUS_DOOR_OPEN 0x00400000 -#define PRINTER_STATUS_SERVER_UNKNOWN 0x00800000 - -#define PRINTER_STATUS_POWER_SAVE 0x01000000 - -#define SERVER_ACCESS_ADMINISTER 0x00000001 -#define SERVER_ACCESS_ENUMERATE 0x00000002 -#define PRINTER_ACCESS_ADMINISTER 0x00000004 -#define PRINTER_ACCESS_USE 0x00000008 -#define JOB_ACCESS_ADMINISTER 0x00000010 - -/* JOB status codes. */ - -#define JOB_STATUS_QUEUED 0x0000 -#define JOB_STATUS_PAUSED 0x0001 -#define JOB_STATUS_ERROR 0x0002 -#define JOB_STATUS_DELETING 0x0004 -#define JOB_STATUS_SPOOLING 0x0008 -#define JOB_STATUS_PRINTING 0x0010 -#define JOB_STATUS_OFFLINE 0x0020 -#define JOB_STATUS_PAPEROUT 0x0040 -#define JOB_STATUS_PRINTED 0x0080 -#define JOB_STATUS_DELETED 0x0100 -#define JOB_STATUS_BLOCKED 0x0200 -#define JOB_STATUS_USER_INTERVENTION 0x0400 - -/* ACE masks for the various print permissions */ - -#define PRINTER_ACE_FULL_CONTROL GENERIC_ALL_ACCESS -#define PRINTER_ACE_MANAGE_DOCUMENTS READ_CONTROL_ACCESS -#define PRINTER_ACE_PRINT \ - (GENERIC_READ_ACCESS | GENERIC_WRITE_ACCESS | GENERIC_EXECUTE_ACCESS) - -/* Access rights for print servers */ -#define SERVER_ALL_ACCESS STANDARD_RIGHTS_REQUIRED_ACCESS|SERVER_ACCESS_ADMINISTER|SERVER_ACCESS_ENUMERATE -#define SERVER_READ STANDARD_RIGHTS_READ_ACCESS|SERVER_ACCESS_ENUMERATE -#define SERVER_WRITE STANDARD_RIGHTS_WRITE_ACCESS|SERVER_ACCESS_ADMINISTER|SERVER_ACCESS_ENUMERATE -#define SERVER_EXECUTE STANDARD_RIGHTS_EXECUTE_ACCESS|SERVER_ACCESS_ENUMERATE - -/* Access rights for printers */ -#define PRINTER_ALL_ACCESS STANDARD_RIGHTS_REQUIRED_ACCESS|PRINTER_ACCESS_ADMINISTER|PRINTER_ACCESS_USE -#define PRINTER_READ STANDARD_RIGHTS_READ_ACCESS|PRINTER_ACCESS_USE -#define PRINTER_WRITE STANDARD_RIGHTS_WRITE_ACCESS|PRINTER_ACCESS_USE -#define PRINTER_EXECUTE STANDARD_RIGHTS_EXECUTE_ACCESS|PRINTER_ACCESS_USE - -/* Access rights for jobs */ -#define JOB_ALL_ACCESS STANDARD_RIGHTS_REQUIRED_ACCESS|JOB_ACCESS_ADMINISTER -#define JOB_READ STANDARD_RIGHTS_READ_ACCESS|JOB_ACCESS_ADMINISTER -#define JOB_WRITE STANDARD_RIGHTS_WRITE_ACCESS|JOB_ACCESS_ADMINISTER -#define JOB_EXECUTE STANDARD_RIGHTS_EXECUTE_ACCESS|JOB_ACCESS_ADMINISTER - -/* Notify field types */ - -#define NOTIFY_ONE_VALUE 1 /* Notify data is stored in value1 */ -#define NOTIFY_TWO_VALUE 2 /* Notify data is stored in value2 */ -#define NOTIFY_POINTER 3 /* Data is a pointer to a buffer */ -#define NOTIFY_STRING 4 /* Data is a pointer to a buffer w/length */ -#define NOTIFY_SECDESC 5 /* Data is a security descriptor */ - -#define PRINTER_NOTIFY_TYPE 0x00 -#define JOB_NOTIFY_TYPE 0x01 - -#define MAX_PRINTER_NOTIFY 26 -#define MAX_JOB_NOTIFY 24 - -#define MAX_NOTIFY_TYPE_FOR_NOW 26 - -#define PRINTER_NOTIFY_SERVER_NAME 0x00 -#define PRINTER_NOTIFY_PRINTER_NAME 0x01 -#define PRINTER_NOTIFY_SHARE_NAME 0x02 -#define PRINTER_NOTIFY_PORT_NAME 0x03 -#define PRINTER_NOTIFY_DRIVER_NAME 0x04 -#define PRINTER_NOTIFY_COMMENT 0x05 -#define PRINTER_NOTIFY_LOCATION 0x06 -#define PRINTER_NOTIFY_DEVMODE 0x07 -#define PRINTER_NOTIFY_SEPFILE 0x08 -#define PRINTER_NOTIFY_PRINT_PROCESSOR 0x09 -#define PRINTER_NOTIFY_PARAMETERS 0x0A -#define PRINTER_NOTIFY_DATATYPE 0x0B -#define PRINTER_NOTIFY_SECURITY_DESCRIPTOR 0x0C -#define PRINTER_NOTIFY_ATTRIBUTES 0x0D -#define PRINTER_NOTIFY_PRIORITY 0x0E -#define PRINTER_NOTIFY_DEFAULT_PRIORITY 0x0F -#define PRINTER_NOTIFY_START_TIME 0x10 -#define PRINTER_NOTIFY_UNTIL_TIME 0x11 -#define PRINTER_NOTIFY_STATUS 0x12 -#define PRINTER_NOTIFY_STATUS_STRING 0x13 -#define PRINTER_NOTIFY_CJOBS 0x14 -#define PRINTER_NOTIFY_AVERAGE_PPM 0x15 -#define PRINTER_NOTIFY_TOTAL_PAGES 0x16 -#define PRINTER_NOTIFY_PAGES_PRINTED 0x17 -#define PRINTER_NOTIFY_TOTAL_BYTES 0x18 -#define PRINTER_NOTIFY_BYTES_PRINTED 0x19 - -#define JOB_NOTIFY_PRINTER_NAME 0x00 -#define JOB_NOTIFY_MACHINE_NAME 0x01 -#define JOB_NOTIFY_PORT_NAME 0x02 -#define JOB_NOTIFY_USER_NAME 0x03 -#define JOB_NOTIFY_NOTIFY_NAME 0x04 -#define JOB_NOTIFY_DATATYPE 0x05 -#define JOB_NOTIFY_PRINT_PROCESSOR 0x06 -#define JOB_NOTIFY_PARAMETERS 0x07 -#define JOB_NOTIFY_DRIVER_NAME 0x08 -#define JOB_NOTIFY_DEVMODE 0x09 -#define JOB_NOTIFY_STATUS 0x0A -#define JOB_NOTIFY_STATUS_STRING 0x0B -#define JOB_NOTIFY_SECURITY_DESCRIPTOR 0x0C -#define JOB_NOTIFY_DOCUMENT 0x0D -#define JOB_NOTIFY_PRIORITY 0x0E -#define JOB_NOTIFY_POSITION 0x0F -#define JOB_NOTIFY_SUBMITTED 0x10 -#define JOB_NOTIFY_START_TIME 0x11 -#define JOB_NOTIFY_UNTIL_TIME 0x12 -#define JOB_NOTIFY_TIME 0x13 -#define JOB_NOTIFY_TOTAL_PAGES 0x14 -#define JOB_NOTIFY_PAGES_PRINTED 0x15 -#define JOB_NOTIFY_TOTAL_BYTES 0x16 -#define JOB_NOTIFY_BYTES_PRINTED 0x17 - -#define PRINTER_NOTIFY_OPTIONS_REFRESH 0x01 - -#define PRINTER_CHANGE_ADD_PRINTER 0x00000001 -#define PRINTER_CHANGE_SET_PRINTER 0x00000002 -#define PRINTER_CHANGE_DELETE_PRINTER 0x00000004 -#define PRINTER_CHANGE_FAILED_CONNECTION_PRINTER 0x00000008 -#define PRINTER_CHANGE_PRINTER (PRINTER_CHANGE_ADD_PRINTER | \ - PRINTER_CHANGE_SET_PRINTER | \ - PRINTER_CHANGE_DELETE_PRINTER | \ - PRINTER_CHANGE_FAILED_CONNECTION_PRINTER ) - -#define PRINTER_CHANGE_ADD_JOB 0x00000100 -#define PRINTER_CHANGE_SET_JOB 0x00000200 -#define PRINTER_CHANGE_DELETE_JOB 0x00000400 -#define PRINTER_CHANGE_WRITE_JOB 0x00000800 -#define PRINTER_CHANGE_JOB (PRINTER_CHANGE_ADD_JOB | \ - PRINTER_CHANGE_SET_JOB | \ - PRINTER_CHANGE_DELETE_JOB | \ - PRINTER_CHANGE_WRITE_JOB ) - -#define PRINTER_CHANGE_ADD_FORM 0x00010000 -#define PRINTER_CHANGE_SET_FORM 0x00020000 -#define PRINTER_CHANGE_DELETE_FORM 0x00040000 -#define PRINTER_CHANGE_FORM (PRINTER_CHANGE_ADD_FORM | \ - PRINTER_CHANGE_SET_FORM | \ - PRINTER_CHANGE_DELETE_FORM ) - -#define PRINTER_CHANGE_ADD_PORT 0x00100000 -#define PRINTER_CHANGE_CONFIGURE_PORT 0x00200000 -#define PRINTER_CHANGE_DELETE_PORT 0x00400000 -#define PRINTER_CHANGE_PORT (PRINTER_CHANGE_ADD_PORT | \ - PRINTER_CHANGE_CONFIGURE_PORT | \ - PRINTER_CHANGE_DELETE_PORT ) - -#define PRINTER_CHANGE_ADD_PRINT_PROCESSOR 0x01000000 -#define PRINTER_CHANGE_DELETE_PRINT_PROCESSOR 0x04000000 -#define PRINTER_CHANGE_PRINT_PROCESSOR (PRINTER_CHANGE_ADD_PRINT_PROCESSOR | \ - PRINTER_CHANGE_DELETE_PRINT_PROCESSOR ) - -#define PRINTER_CHANGE_ADD_PRINTER_DRIVER 0x10000000 -#define PRINTER_CHANGE_SET_PRINTER_DRIVER 0x20000000 -#define PRINTER_CHANGE_DELETE_PRINTER_DRIVER 0x40000000 -#define PRINTER_CHANGE_PRINTER_DRIVER (PRINTER_CHANGE_ADD_PRINTER_DRIVER | \ - PRINTER_CHANGE_SET_PRINTER_DRIVER | \ - PRINTER_CHANGE_DELETE_PRINTER_DRIVER ) - -#define PRINTER_CHANGE_TIMEOUT 0x80000000 -#define PRINTER_CHANGE_ALL (PRINTER_CHANGE_JOB | \ - PRINTER_CHANGE_FORM | \ - PRINTER_CHANGE_PORT | \ - PRINTER_CHANGE_PRINT_PROCESSOR | \ - PRINTER_CHANGE_PRINTER_DRIVER ) - -#define PRINTER_NOTIFY_INFO_DISCARDED 0x1 - -/* - * Set of macros for flagging what changed in the PRINTER_INFO_2 struct - * when sending messages to other smbd's - */ -#define PRINTER_MESSAGE_NULL 0x00000000 -#define PRINTER_MESSAGE_DRIVER 0x00000001 -#define PRINTER_MESSAGE_COMMENT 0x00000002 -#define PRINTER_MESSAGE_PRINTERNAME 0x00000004 -#define PRINTER_MESSAGE_LOCATION 0x00000008 -#define PRINTER_MESSAGE_DEVMODE 0x00000010 /* not curently supported */ -#define PRINTER_MESSAGE_SEPFILE 0x00000020 -#define PRINTER_MESSAGE_PRINTPROC 0x00000040 -#define PRINTER_MESSAGE_PARAMS 0x00000080 -#define PRINTER_MESSAGE_DATATYPE 0x00000100 -#define PRINTER_MESSAGE_SECDESC 0x00000200 -#define PRINTER_MESSAGE_CJOBS 0x00000400 -#define PRINTER_MESSAGE_PORT 0x00000800 -#define PRINTER_MESSAGE_SHARENAME 0x00001000 -#define PRINTER_MESSAGE_ATTRIBUTES 0x00002000 - -typedef struct printer_message_info { - uint32 low; /* PRINTER_CHANGE_XXX */ - uint32 high; /* PRINTER_CHANGE_XXX */ - fstring printer_name; - uint32 flags; /* PRINTER_MESSAGE_XXX */ -} -PRINTER_MESSAGE_INFO; - -/* - * The printer attributes. - * I #defined all of them (grabbed form MSDN) - * I'm only using: - * ( SHARED | NETWORK | RAW_ONLY ) - * RAW_ONLY _MUST_ be present otherwise NT will send an EMF file - */ - -#define PRINTER_ATTRIBUTE_QUEUED 0x00000001 -#define PRINTER_ATTRIBUTE_DIRECT 0x00000002 -#define PRINTER_ATTRIBUTE_DEFAULT 0x00000004 -#define PRINTER_ATTRIBUTE_SHARED 0x00000008 - -#define PRINTER_ATTRIBUTE_NETWORK 0x00000010 -#define PRINTER_ATTRIBUTE_HIDDEN 0x00000020 -#define PRINTER_ATTRIBUTE_LOCAL 0x00000040 -#define PRINTER_ATTRIBUTE_ENABLE_DEVQ 0x00000080 - -#define PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS 0x00000100 -#define PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST 0x00000200 -#define PRINTER_ATTRIBUTE_WORK_OFFLINE 0x00000400 -#define PRINTER_ATTRIBUTE_ENABLE_BIDI 0x00000800 - -#define PRINTER_ATTRIBUTE_RAW_ONLY 0x00001000 -#define PRINTER_ATTRIBUTE_PUBLISHED 0x00002000 - -#define PRINTER_ATTRIBUTE_SAMBA (PRINTER_ATTRIBUTE_RAW_ONLY|\ - PRINTER_ATTRIBUTE_SHARED|\ - PRINTER_ATTRIBUTE_LOCAL) - -#define NO_PRIORITY 0 -#define MAX_PRIORITY 99 -#define MIN_PRIORITY 1 -#define DEF_PRIORITY 1 - -/* the flags of the query */ -#define PRINTER_ENUM_DEFAULT 0x00000001 -#define PRINTER_ENUM_LOCAL 0x00000002 -#define PRINTER_ENUM_CONNECTIONS 0x00000004 -#define PRINTER_ENUM_FAVORITE 0x00000004 -#define PRINTER_ENUM_NAME 0x00000008 -#define PRINTER_ENUM_REMOTE 0x00000010 -#define PRINTER_ENUM_SHARED 0x00000020 -#define PRINTER_ENUM_NETWORK 0x00000040 - -/* the flags of each printers */ -#define PRINTER_ENUM_UNKNOWN_8 0x00000008 -#define PRINTER_ENUM_EXPAND 0x00004000 -#define PRINTER_ENUM_CONTAINER 0x00008000 -#define PRINTER_ENUM_ICONMASK 0x00ff0000 -#define PRINTER_ENUM_ICON1 0x00010000 -#define PRINTER_ENUM_ICON2 0x00020000 -#define PRINTER_ENUM_ICON3 0x00040000 -#define PRINTER_ENUM_ICON4 0x00080000 -#define PRINTER_ENUM_ICON5 0x00100000 -#define PRINTER_ENUM_ICON6 0x00200000 -#define PRINTER_ENUM_ICON7 0x00400000 -#define PRINTER_ENUM_ICON8 0x00800000 - -/* FLAGS for SPOOLSS_DELETEPRINTERDRIVEREX */ - -#define DPD_DELETE_UNUSED_FILES 0x00000001 -#define DPD_DELETE_SPECIFIC_VERSION 0x00000002 -#define DPD_DELETE_ALL_FILES 0x00000004 - -#define DRIVER_ANY_VERSION 0xffffffff -#define DRIVER_MAX_VERSION 4 - -/* FLAGS for SPOOLSS_ADDPRINTERDRIVEREX */ - -#define APD_STRICT_UPGRADE 0x00000001 -#define APD_STRICT_DOWNGRADE 0x00000002 -#define APD_COPY_ALL_FILES 0x00000004 -#define APD_COPY_NEW_FILES 0x00000008 - - -/* this struct is undocumented */ -/* thanks to the ddk ... */ -typedef struct spool_user_1 -{ - uint32 size; /* length of user_name & client_name + 2? */ - uint32 client_name_ptr; - uint32 user_name_ptr; - uint32 build; - uint32 major; - uint32 minor; - uint32 processor; - UNISTR2 client_name; - UNISTR2 user_name; -} -SPOOL_USER_1; - -typedef struct spool_user_ctr_info -{ - uint32 level; - uint32 ptr; - SPOOL_USER_1 user1; -} -SPOOL_USER_CTR; - -/* - * various bits in the DEVICEMODE.fields member - */ - -#define DEVMODE_ORIENTATION 0x00000001 -#define DEVMODE_PAPERSIZE 0x00000002 -#define DEVMODE_PAPERLENGTH 0x00000004 -#define DEVMODE_PAPERWIDTH 0x00000008 -#define DEVMODE_SCALE 0x00000010 -#define DEVMODE_POSITION 0x00000020 -#define DEVMODE_NUP 0x00000040 -#define DEVMODE_COPIES 0x00000100 -#define DEVMODE_DEFAULTSOURCE 0x00000200 -#define DEVMODE_PRINTQUALITY 0x00000400 -#define DEVMODE_COLOR 0x00000800 -#define DEVMODE_DUPLEX 0x00001000 -#define DEVMODE_YRESOLUTION 0x00002000 -#define DEVMODE_TTOPTION 0x00004000 -#define DEVMODE_COLLATE 0x00008000 -#define DEVMODE_FORMNAME 0x00010000 -#define DEVMODE_LOGPIXELS 0x00020000 -#define DEVMODE_BITSPERPEL 0x00040000 -#define DEVMODE_PELSWIDTH 0x00080000 -#define DEVMODE_PELSHEIGHT 0x00100000 -#define DEVMODE_DISPLAYFLAGS 0x00200000 -#define DEVMODE_DISPLAYFREQUENCY 0x00400000 -#define DEVMODE_ICMMETHOD 0x00800000 -#define DEVMODE_ICMINTENT 0x01000000 -#define DEVMODE_MEDIATYPE 0x02000000 -#define DEVMODE_DITHERTYPE 0x04000000 -#define DEVMODE_PANNINGWIDTH 0x08000000 -#define DEVMODE_PANNINGHEIGHT 0x10000000 - - -/* - * Devicemode structure - */ - -typedef struct devicemode -{ - UNISTR devicename; - uint16 specversion; - uint16 driverversion; - uint16 size; - uint16 driverextra; - uint32 fields; - uint16 orientation; - uint16 papersize; - uint16 paperlength; - uint16 paperwidth; - uint16 scale; - uint16 copies; - uint16 defaultsource; - uint16 printquality; - uint16 color; - uint16 duplex; - uint16 yresolution; - uint16 ttoption; - uint16 collate; - UNISTR formname; - uint16 logpixels; - uint32 bitsperpel; - uint32 pelswidth; - uint32 pelsheight; - uint32 displayflags; - uint32 displayfrequency; - uint32 icmmethod; - uint32 icmintent; - uint32 mediatype; - uint32 dithertype; - uint32 reserved1; - uint32 reserved2; - uint32 panningwidth; - uint32 panningheight; - uint8 *private; -} -DEVICEMODE; - -typedef struct _devmode_cont -{ - uint32 size; - uint32 devmode_ptr; - DEVICEMODE *devmode; -} -DEVMODE_CTR; - -typedef struct _printer_default -{ - uint32 datatype_ptr; - UNISTR2 datatype; - DEVMODE_CTR devmode_cont; - uint32 access_required; -} -PRINTER_DEFAULT; - -/* SPOOL_Q_OPEN_PRINTER request to open a printer */ -typedef struct spool_q_open_printer -{ - uint32 printername_ptr; - UNISTR2 printername; - PRINTER_DEFAULT printer_default; -} -SPOOL_Q_OPEN_PRINTER; - -/* SPOOL_R_OPEN_PRINTER reply to an open printer */ -typedef struct spool_r_open_printer -{ - POLICY_HND handle; /* handle used along all transactions (20*uint8) */ - WERROR status; -} -SPOOL_R_OPEN_PRINTER; - -/* SPOOL_Q_OPEN_PRINTER_EX request to open a printer */ -typedef struct spool_q_open_printer_ex -{ - uint32 printername_ptr; - UNISTR2 printername; - PRINTER_DEFAULT printer_default; - uint32 user_switch; - SPOOL_USER_CTR user_ctr; -} -SPOOL_Q_OPEN_PRINTER_EX; - -/* SPOOL_R_OPEN_PRINTER_EX reply to an open printer */ -typedef struct spool_r_open_printer_ex -{ - POLICY_HND handle; /* handle used along all transactions (20*uint8) */ - WERROR status; -} -SPOOL_R_OPEN_PRINTER_EX; - -typedef struct spool_notify_option_type -{ - uint16 type; - uint16 reserved0; - uint32 reserved1; - uint32 reserved2; - uint32 count; - uint32 fields_ptr; - uint32 count2; - uint16 fields[MAX_NOTIFY_TYPE_FOR_NOW]; -} -SPOOL_NOTIFY_OPTION_TYPE; - -typedef struct spool_notify_option_type_ctr -{ - uint32 count; - SPOOL_NOTIFY_OPTION_TYPE *type; -} -SPOOL_NOTIFY_OPTION_TYPE_CTR; - - - -typedef struct s_header_type -{ - uint32 type; - union - { - uint32 value; - UNISTR string; - } - data; -} -HEADER_TYPE; - -typedef struct new_buffer -{ - uint32 ptr; - uint32 size; - prs_struct prs; - uint32 struct_start; - uint32 string_at_end; -} -NEW_BUFFER; - -typedef struct spool_q_getprinterdata -{ - POLICY_HND handle; - UNISTR2 valuename; - uint32 size; -} -SPOOL_Q_GETPRINTERDATA; - -typedef struct spool_r_getprinterdata -{ - uint32 type; - uint32 size; - uint8 *data; - uint32 needed; - WERROR status; -} -SPOOL_R_GETPRINTERDATA; - -typedef struct spool_q_deleteprinterdata -{ - POLICY_HND handle; - UNISTR2 valuename; -} -SPOOL_Q_DELETEPRINTERDATA; - -typedef struct spool_r_deleteprinterdata -{ - WERROR status; -} -SPOOL_R_DELETEPRINTERDATA; - -typedef struct spool_q_closeprinter -{ - POLICY_HND handle; -} -SPOOL_Q_CLOSEPRINTER; - -typedef struct spool_r_closeprinter -{ - POLICY_HND handle; - WERROR status; -} -SPOOL_R_CLOSEPRINTER; - -typedef struct spool_q_startpageprinter -{ - POLICY_HND handle; -} -SPOOL_Q_STARTPAGEPRINTER; - -typedef struct spool_r_startpageprinter -{ - WERROR status; -} -SPOOL_R_STARTPAGEPRINTER; - -typedef struct spool_q_endpageprinter -{ - POLICY_HND handle; -} -SPOOL_Q_ENDPAGEPRINTER; - -typedef struct spool_r_endpageprinter -{ - WERROR status; -} -SPOOL_R_ENDPAGEPRINTER; - - -typedef struct spool_q_deleteprinterdriver -{ - uint32 server_ptr; - UNISTR2 server; - UNISTR2 arch; - UNISTR2 driver; -} -SPOOL_Q_DELETEPRINTERDRIVER; - -typedef struct spool_r_deleteprinterdriver -{ - WERROR status; -} -SPOOL_R_DELETEPRINTERDRIVER; - -typedef struct spool_q_deleteprinterdriverex -{ - uint32 server_ptr; - UNISTR2 server; - UNISTR2 arch; - UNISTR2 driver; - uint32 delete_flags; - uint32 version; -} -SPOOL_Q_DELETEPRINTERDRIVEREX; - -typedef struct spool_r_deleteprinterdriverex -{ - WERROR status; -} -SPOOL_R_DELETEPRINTERDRIVEREX; - - -typedef struct spool_doc_info_1 -{ - uint32 p_docname; - uint32 p_outputfile; - uint32 p_datatype; - UNISTR2 docname; - UNISTR2 outputfile; - UNISTR2 datatype; -} -DOC_INFO_1; - -typedef struct spool_doc_info -{ - uint32 switch_value; - DOC_INFO_1 doc_info_1; -} -DOC_INFO; - -typedef struct spool_doc_info_container -{ - uint32 level; - DOC_INFO docinfo; -} -DOC_INFO_CONTAINER; - -typedef struct spool_q_startdocprinter -{ - POLICY_HND handle; - DOC_INFO_CONTAINER doc_info_container; -} -SPOOL_Q_STARTDOCPRINTER; - -typedef struct spool_r_startdocprinter -{ - uint32 jobid; - WERROR status; -} -SPOOL_R_STARTDOCPRINTER; - -typedef struct spool_q_enddocprinter -{ - POLICY_HND handle; -} -SPOOL_Q_ENDDOCPRINTER; - -typedef struct spool_r_enddocprinter -{ - WERROR status; -} -SPOOL_R_ENDDOCPRINTER; - -typedef struct spool_q_writeprinter -{ - POLICY_HND handle; - uint32 buffer_size; - uint8 *buffer; - uint32 buffer_size2; -} -SPOOL_Q_WRITEPRINTER; - -typedef struct spool_r_writeprinter -{ - uint32 buffer_written; - WERROR status; -} -SPOOL_R_WRITEPRINTER; - -typedef struct spool_notify_option -{ - uint32 version; - uint32 flags; - uint32 count; - uint32 option_type_ptr; - SPOOL_NOTIFY_OPTION_TYPE_CTR ctr; -} -SPOOL_NOTIFY_OPTION; - -typedef struct spool_notify_info_data -{ - uint16 type; - uint16 field; - uint32 reserved; - uint32 id; - union { - uint32 value[2]; - struct { - uint32 length; - uint16 *string; - } data; - struct { - uint32 size; - SEC_DESC *desc; - } sd; - } - notify_data; - uint32 size; - BOOL enc_type; -} SPOOL_NOTIFY_INFO_DATA; - -typedef struct spool_notify_info -{ - uint32 version; - uint32 flags; - uint32 count; - SPOOL_NOTIFY_INFO_DATA *data; -} -SPOOL_NOTIFY_INFO; - -/* If the struct name looks obscure, yes it is ! */ -/* RemoteFindFirstPrinterChangeNotificationEx query struct */ -typedef struct spoolss_q_rffpcnex -{ - POLICY_HND handle; - uint32 flags; - uint32 options; - uint32 localmachine_ptr; - UNISTR2 localmachine; - uint32 printerlocal; - uint32 option_ptr; - SPOOL_NOTIFY_OPTION *option; -} -SPOOL_Q_RFFPCNEX; - -typedef struct spool_r_rffpcnex -{ - WERROR status; -} -SPOOL_R_RFFPCNEX; - -/* Remote Find Next Printer Change Notify Ex */ -typedef struct spool_q_rfnpcnex -{ - POLICY_HND handle; - uint32 change; - uint32 option_ptr; - SPOOL_NOTIFY_OPTION *option; -} -SPOOL_Q_RFNPCNEX; - -typedef struct spool_r_rfnpcnex -{ - uint32 info_ptr; - SPOOL_NOTIFY_INFO info; - WERROR status; -} -SPOOL_R_RFNPCNEX; - -/* Find Close Printer Notify */ -typedef struct spool_q_fcpn -{ - POLICY_HND handle; -} -SPOOL_Q_FCPN; - -typedef struct spool_r_fcpn -{ - WERROR status; -} -SPOOL_R_FCPN; - - -typedef struct printer_info_0 -{ - UNISTR printername; - UNISTR servername; - uint32 cjobs; - uint32 total_jobs; - uint32 total_bytes; - - uint16 year; - uint16 month; - uint16 dayofweek; - uint16 day; - uint16 hour; - uint16 minute; - uint16 second; - uint16 milliseconds; - - uint32 global_counter; - uint32 total_pages; - - uint16 major_version; - uint16 build_version; - - uint32 unknown7; - uint32 unknown8; - uint32 unknown9; - uint32 session_counter; - uint32 unknown11; - uint32 printer_errors; - uint32 unknown13; - uint32 unknown14; - uint32 unknown15; - uint32 unknown16; - uint32 change_id; - uint32 unknown18; - uint32 status; - uint32 unknown20; - uint32 c_setprinter; - - uint16 unknown22; - uint16 unknown23; - uint16 unknown24; - uint16 unknown25; - uint16 unknown26; - uint16 unknown27; - uint16 unknown28; - uint16 unknown29; -} PRINTER_INFO_0; - -typedef struct printer_info_1 -{ - uint32 flags; - UNISTR description; - UNISTR name; - UNISTR comment; -} -PRINTER_INFO_1; - -typedef struct printer_info_2 -{ - UNISTR servername; - UNISTR printername; - UNISTR sharename; - UNISTR portname; - UNISTR drivername; - UNISTR comment; - UNISTR location; - DEVICEMODE *devmode; - UNISTR sepfile; - UNISTR printprocessor; - UNISTR datatype; - UNISTR parameters; - SEC_DESC *secdesc; - uint32 attributes; - uint32 priority; - uint32 defaultpriority; - uint32 starttime; - uint32 untiltime; - uint32 status; - uint32 cjobs; - uint32 averageppm; -} -PRINTER_INFO_2; - -typedef struct printer_info_3 -{ - uint32 flags; - SEC_DESC *secdesc; -} -PRINTER_INFO_3; - -typedef struct printer_info_4 -{ - UNISTR printername; - UNISTR servername; - uint32 attributes; -} -PRINTER_INFO_4; - -typedef struct printer_info_5 -{ - UNISTR printername; - UNISTR portname; - uint32 attributes; - uint32 device_not_selected_timeout; - uint32 transmission_retry_timeout; -} -PRINTER_INFO_5; - -#define SPOOL_DS_PUBLISH 1 -#define SPOOL_DS_UPDATE 2 -#define SPOOL_DS_UNPUBLISH 4 -#define SPOOL_DS_PENDING 0x80000000 - -typedef struct printer_info_7 -{ - UNISTR guid; /* text form of printer guid */ - uint32 action; -} -PRINTER_INFO_7; - -typedef struct spool_q_enumprinters -{ - uint32 flags; - uint32 servername_ptr; - UNISTR2 servername; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMPRINTERS; - -typedef struct printer_info_ctr_info -{ - PRINTER_INFO_0 *printers_0; - PRINTER_INFO_1 *printers_1; - PRINTER_INFO_2 *printers_2; - PRINTER_INFO_3 *printers_3; - PRINTER_INFO_4 *printers_4; - PRINTER_INFO_5 *printers_5; -} -PRINTER_INFO_CTR; - -typedef struct spool_r_enumprinters -{ - NEW_BUFFER *buffer; - uint32 needed; /* bytes needed */ - uint32 returned; /* number of printers */ - WERROR status; -} -SPOOL_R_ENUMPRINTERS; - - -typedef struct spool_q_getprinter -{ - POLICY_HND handle; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_GETPRINTER; - -typedef struct printer_info_info -{ - union - { - PRINTER_INFO_0 *info0; - PRINTER_INFO_1 *info1; - PRINTER_INFO_2 *info2; - void *info; - } printer; -} PRINTER_INFO; - -typedef struct spool_r_getprinter -{ - NEW_BUFFER *buffer; - uint32 needed; - WERROR status; -} SPOOL_R_GETPRINTER; - -typedef struct driver_info_1 -{ - UNISTR name; -} DRIVER_INFO_1; - -typedef struct driver_info_2 -{ - uint32 version; - UNISTR name; - UNISTR architecture; - UNISTR driverpath; - UNISTR datafile; - UNISTR configfile; -} DRIVER_INFO_2; - -typedef struct driver_info_3 -{ - uint32 version; - UNISTR name; - UNISTR architecture; - UNISTR driverpath; - UNISTR datafile; - UNISTR configfile; - UNISTR helpfile; - uint16 *dependentfiles; - UNISTR monitorname; - UNISTR defaultdatatype; -} -DRIVER_INFO_3; - -typedef struct driver_info_6 -{ - uint32 version; - UNISTR name; - UNISTR architecture; - UNISTR driverpath; - UNISTR datafile; - UNISTR configfile; - UNISTR helpfile; - uint16 *dependentfiles; - UNISTR monitorname; - UNISTR defaultdatatype; - uint16* previousdrivernames; - NTTIME driver_date; - uint32 padding; - uint32 driver_version_low; - uint32 driver_version_high; - UNISTR mfgname; - UNISTR oem_url; - UNISTR hardware_id; - UNISTR provider; -} -DRIVER_INFO_6; - -typedef struct driver_info_info -{ - DRIVER_INFO_1 *info1; - DRIVER_INFO_2 *info2; - DRIVER_INFO_3 *info3; - DRIVER_INFO_6 *info6; -} -PRINTER_DRIVER_CTR; - -typedef struct spool_q_getprinterdriver2 -{ - POLICY_HND handle; - uint32 architecture_ptr; - UNISTR2 architecture; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; - uint32 clientmajorversion; - uint32 clientminorversion; -} -SPOOL_Q_GETPRINTERDRIVER2; - -typedef struct spool_r_getprinterdriver2 -{ - NEW_BUFFER *buffer; - uint32 needed; - uint32 servermajorversion; - uint32 serverminorversion; - WERROR status; -} -SPOOL_R_GETPRINTERDRIVER2; - - -typedef struct add_jobinfo_1 -{ - UNISTR path; - uint32 job_number; -} -ADD_JOBINFO_1; - - -typedef struct spool_q_addjob -{ - POLICY_HND handle; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ADDJOB; - -typedef struct spool_r_addjob -{ - NEW_BUFFER *buffer; - uint32 needed; - WERROR status; -} -SPOOL_R_ADDJOB; - -/* - * I'm really wondering how many different time formats - * I will have to cope with - * - * JFM, 09/13/98 In a mad mood ;-( -*/ -typedef struct systemtime -{ - uint16 year; - uint16 month; - uint16 dayofweek; - uint16 day; - uint16 hour; - uint16 minute; - uint16 second; - uint16 milliseconds; -} -SYSTEMTIME; - -typedef struct s_job_info_1 -{ - uint32 jobid; - UNISTR printername; - UNISTR machinename; - UNISTR username; - UNISTR document; - UNISTR datatype; - UNISTR text_status; - uint32 status; - uint32 priority; - uint32 position; - uint32 totalpages; - uint32 pagesprinted; - SYSTEMTIME submitted; -} -JOB_INFO_1; - -typedef struct s_job_info_2 -{ - uint32 jobid; - UNISTR printername; - UNISTR machinename; - UNISTR username; - UNISTR document; - UNISTR notifyname; - UNISTR datatype; - UNISTR printprocessor; - UNISTR parameters; - UNISTR drivername; - DEVICEMODE *devmode; - UNISTR text_status; -/* SEC_DESC sec_desc;*/ - uint32 status; - uint32 priority; - uint32 position; - uint32 starttime; - uint32 untiltime; - uint32 totalpages; - uint32 size; - SYSTEMTIME submitted; - uint32 timeelapsed; - uint32 pagesprinted; -} -JOB_INFO_2; - -typedef struct spool_q_enumjobs -{ - POLICY_HND handle; - uint32 firstjob; - uint32 numofjobs; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMJOBS; - -typedef struct job_info_ctr_info -{ - union - { - JOB_INFO_1 *job_info_1; - JOB_INFO_2 *job_info_2; - void *info; - } job; - -} JOB_INFO_CTR; - -typedef struct spool_r_enumjobs -{ - NEW_BUFFER *buffer; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMJOBS; - -typedef struct spool_q_schedulejob -{ - POLICY_HND handle; - uint32 jobid; -} -SPOOL_Q_SCHEDULEJOB; - -typedef struct spool_r_schedulejob -{ - WERROR status; -} -SPOOL_R_SCHEDULEJOB; - -typedef struct s_port_info_1 -{ - UNISTR port_name; -} -PORT_INFO_1; - -typedef struct s_port_info_2 -{ - UNISTR port_name; - UNISTR monitor_name; - UNISTR description; - uint32 port_type; - uint32 reserved; -} -PORT_INFO_2; - -/* Port Type bits */ -#define PORT_TYPE_WRITE 0x0001 -#define PORT_TYPE_READ 0x0002 -#define PORT_TYPE_REDIRECTED 0x0004 -#define PORT_TYPE_NET_ATTACHED 0x0008 - -typedef struct spool_q_enumports -{ - uint32 name_ptr; - UNISTR2 name; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMPORTS; - -typedef struct port_info_ctr_info -{ - union - { - PORT_INFO_1 *info_1; - PORT_INFO_2 *info_2; - } - port; - -} -PORT_INFO_CTR; - -typedef struct spool_r_enumports -{ - NEW_BUFFER *buffer; - uint32 needed; /* bytes needed */ - uint32 returned; /* number of printers */ - WERROR status; -} -SPOOL_R_ENUMPORTS; - -#define JOB_CONTROL_PAUSE 1 -#define JOB_CONTROL_RESUME 2 -#define JOB_CONTROL_CANCEL 3 -#define JOB_CONTROL_RESTART 4 -#define JOB_CONTROL_DELETE 5 - -typedef struct job_info_info -{ - union - { - JOB_INFO_1 job_info_1; - JOB_INFO_2 job_info_2; - } - job; - -} -JOB_INFO; - -typedef struct spool_q_setjob -{ - POLICY_HND handle; - uint32 jobid; - uint32 level; - JOB_INFO ctr; - uint32 command; - -} -SPOOL_Q_SETJOB; - -typedef struct spool_r_setjob -{ - WERROR status; - -} -SPOOL_R_SETJOB; - -typedef struct spool_q_enumprinterdrivers -{ - uint32 name_ptr; - UNISTR2 name; - uint32 environment_ptr; - UNISTR2 environment; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMPRINTERDRIVERS; - -typedef struct spool_r_enumprinterdrivers -{ - NEW_BUFFER *buffer; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMPRINTERDRIVERS; - -#define FORM_USER 0 -#define FORM_BUILTIN 1 -#define FORM_PRINTER 2 - -typedef struct spool_form_1 -{ - uint32 flag; - UNISTR name; - uint32 width; - uint32 length; - uint32 left; - uint32 top; - uint32 right; - uint32 bottom; -} -FORM_1; - -typedef struct spool_q_enumforms -{ - POLICY_HND handle; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMFORMS; - -typedef struct spool_r_enumforms -{ - NEW_BUFFER *buffer; - uint32 needed; - uint32 numofforms; - WERROR status; -} -SPOOL_R_ENUMFORMS; - -typedef struct spool_q_getform -{ - POLICY_HND handle; - UNISTR2 formname; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_GETFORM; - -typedef struct spool_r_getform -{ - NEW_BUFFER *buffer; - uint32 needed; - WERROR status; -} -SPOOL_R_GETFORM; - -typedef struct spool_printer_info_level_1 -{ - uint32 flags; - uint32 description_ptr; - uint32 name_ptr; - uint32 comment_ptr; - UNISTR2 description; - UNISTR2 name; - UNISTR2 comment; -} SPOOL_PRINTER_INFO_LEVEL_1; - -typedef struct spool_printer_info_level_2 -{ - uint32 servername_ptr; - uint32 printername_ptr; - uint32 sharename_ptr; - uint32 portname_ptr; - uint32 drivername_ptr; - uint32 comment_ptr; - uint32 location_ptr; - uint32 devmode_ptr; - uint32 sepfile_ptr; - uint32 printprocessor_ptr; - uint32 datatype_ptr; - uint32 parameters_ptr; - uint32 secdesc_ptr; - uint32 attributes; - uint32 priority; - uint32 default_priority; - uint32 starttime; - uint32 untiltime; - uint32 status; - uint32 cjobs; - uint32 averageppm; - UNISTR2 servername; - UNISTR2 printername; - UNISTR2 sharename; - UNISTR2 portname; - UNISTR2 drivername; - UNISTR2 comment; - UNISTR2 location; - UNISTR2 sepfile; - UNISTR2 printprocessor; - UNISTR2 datatype; - UNISTR2 parameters; -} -SPOOL_PRINTER_INFO_LEVEL_2; - -typedef struct spool_printer_info_level_3 -{ - uint32 secdesc_ptr; -} -SPOOL_PRINTER_INFO_LEVEL_3; - -typedef struct spool_printer_info_level_7 -{ - uint32 guid_ptr; - uint32 action; - UNISTR2 guid; -} -SPOOL_PRINTER_INFO_LEVEL_7; - -typedef struct spool_printer_info_level -{ - uint32 level; - uint32 info_ptr; - SPOOL_PRINTER_INFO_LEVEL_1 *info_1; - SPOOL_PRINTER_INFO_LEVEL_2 *info_2; - SPOOL_PRINTER_INFO_LEVEL_3 *info_3; - SPOOL_PRINTER_INFO_LEVEL_7 *info_7; -} -SPOOL_PRINTER_INFO_LEVEL; - -typedef struct spool_printer_driver_info_level_3 -{ - uint32 cversion; - uint32 name_ptr; - uint32 environment_ptr; - uint32 driverpath_ptr; - uint32 datafile_ptr; - uint32 configfile_ptr; - uint32 helpfile_ptr; - uint32 monitorname_ptr; - uint32 defaultdatatype_ptr; - uint32 dependentfilessize; - uint32 dependentfiles_ptr; - - UNISTR2 name; - UNISTR2 environment; - UNISTR2 driverpath; - UNISTR2 datafile; - UNISTR2 configfile; - UNISTR2 helpfile; - UNISTR2 monitorname; - UNISTR2 defaultdatatype; - BUFFER5 dependentfiles; - -} -SPOOL_PRINTER_DRIVER_INFO_LEVEL_3; - -/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ -typedef struct { - uint32 version; - uint32 name_ptr; - uint32 environment_ptr; - uint32 driverpath_ptr; - uint32 datafile_ptr; - uint32 configfile_ptr; - uint32 helpfile_ptr; - uint32 monitorname_ptr; - uint32 defaultdatatype_ptr; - uint32 dependentfiles_len; - uint32 dependentfiles_ptr; - uint32 previousnames_len; - uint32 previousnames_ptr; - NTTIME driverdate; - UINT64_S driverversion; - uint32 dummy4; - uint32 mfgname_ptr; - uint32 oemurl_ptr; - uint32 hardwareid_ptr; - uint32 provider_ptr; - UNISTR2 name; - UNISTR2 environment; - UNISTR2 driverpath; - UNISTR2 datafile; - UNISTR2 configfile; - UNISTR2 helpfile; - UNISTR2 monitorname; - UNISTR2 defaultdatatype; - BUFFER5 dependentfiles; - BUFFER5 previousnames; - UNISTR2 mfgname; - UNISTR2 oemurl; - UNISTR2 hardwareid; - UNISTR2 provider; -} SPOOL_PRINTER_DRIVER_INFO_LEVEL_6; - - -typedef struct spool_printer_driver_info_level -{ - uint32 level; - uint32 ptr; - SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; - SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; -} -SPOOL_PRINTER_DRIVER_INFO_LEVEL; - - -/* this struct is undocumented */ -/* thanks to the ddk ... */ -typedef struct spool_user_level_1 -{ - uint32 size; - uint32 client_name_ptr; - uint32 user_name_ptr; - uint32 build; - uint32 major; - uint32 minor; - uint32 processor; - UNISTR2 client_name; - UNISTR2 user_name; -} -SPOOL_USER_LEVEL_1; - -typedef struct spool_user_level -{ - SPOOL_USER_LEVEL_1 *user_level_1; -} -SPOOL_USER_LEVEL; - -typedef struct spool_q_setprinter -{ - POLICY_HND handle; - uint32 level; - SPOOL_PRINTER_INFO_LEVEL info; - SEC_DESC_BUF *secdesc_ctr; - DEVMODE_CTR devmode_ctr; - - uint32 command; - -} -SPOOL_Q_SETPRINTER; - -typedef struct spool_r_setprinter -{ - WERROR status; -} -SPOOL_R_SETPRINTER; - -typedef struct spool_q_addprinter -{ - UNISTR2 server_name; - uint32 level; - SPOOL_PRINTER_INFO_LEVEL info; - DEVMODE_CTR devmode_ctr; - SEC_DESC_BUF *secdesc_ctr; - uint32 user_level; - SPOOL_USER_LEVEL user; -} -SPOOL_Q_ADDPRINTER; - -typedef struct spool_r_addprinter -{ - WERROR status; -} -SPOOL_R_ADDPRINTER; - -typedef struct spool_q_deleteprinter -{ - POLICY_HND handle; -} -SPOOL_Q_DELETEPRINTER; - -typedef struct spool_r_deleteprinter -{ - POLICY_HND handle; - WERROR status; -} -SPOOL_R_DELETEPRINTER; - -typedef struct spool_q_abortprinter -{ - POLICY_HND handle; -} -SPOOL_Q_ABORTPRINTER; - -typedef struct spool_r_abortprinter -{ - WERROR status; -} -SPOOL_R_ABORTPRINTER; - - -typedef struct spool_q_addprinterex -{ - uint32 server_name_ptr; - UNISTR2 server_name; - uint32 level; - SPOOL_PRINTER_INFO_LEVEL info; - DEVMODE_CTR devmode_ctr; - SEC_DESC_BUF *secdesc_ctr; - uint32 user_switch; - SPOOL_USER_CTR user_ctr; -} -SPOOL_Q_ADDPRINTEREX; - -typedef struct spool_r_addprinterex -{ - POLICY_HND handle; - WERROR status; -} -SPOOL_R_ADDPRINTEREX; - - -typedef struct spool_q_addprinterdriver -{ - uint32 server_name_ptr; - UNISTR2 server_name; - uint32 level; - SPOOL_PRINTER_DRIVER_INFO_LEVEL info; -} -SPOOL_Q_ADDPRINTERDRIVER; - -typedef struct spool_r_addprinterdriver -{ - WERROR status; -} -SPOOL_R_ADDPRINTERDRIVER; - -typedef struct spool_q_addprinterdriverex -{ - uint32 server_name_ptr; - UNISTR2 server_name; - uint32 level; - SPOOL_PRINTER_DRIVER_INFO_LEVEL info; - uint32 copy_flags; -} -SPOOL_Q_ADDPRINTERDRIVEREX; - -typedef struct spool_r_addprinterdriverex -{ - WERROR status; -} -SPOOL_R_ADDPRINTERDRIVEREX; - - -typedef struct driver_directory_1 -{ - UNISTR name; -} -DRIVER_DIRECTORY_1; - -typedef struct driver_info_ctr_info -{ - DRIVER_DIRECTORY_1 *info1; -} -DRIVER_DIRECTORY_CTR; - -typedef struct spool_q_getprinterdriverdirectory -{ - uint32 name_ptr; - UNISTR2 name; - uint32 environment_ptr; - UNISTR2 environment; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_GETPRINTERDRIVERDIR; - -typedef struct spool_r_getprinterdriverdirectory -{ - NEW_BUFFER *buffer; - uint32 needed; - WERROR status; -} -SPOOL_R_GETPRINTERDRIVERDIR; - -typedef struct spool_q_addprintprocessor -{ - uint32 server_ptr; - UNISTR2 server; - UNISTR2 environment; - UNISTR2 path; - UNISTR2 name; -} -SPOOL_Q_ADDPRINTPROCESSOR; - -typedef struct spool_r_addprintprocessor -{ - WERROR status; -} -SPOOL_R_ADDPRINTPROCESSOR; - - -typedef struct spool_q_enumprintprocessors -{ - uint32 name_ptr; - UNISTR2 name; - uint32 environment_ptr; - UNISTR2 environment; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMPRINTPROCESSORS; - -typedef struct printprocessor_1 -{ - UNISTR name; -} -PRINTPROCESSOR_1; - -typedef struct spool_r_enumprintprocessors -{ - NEW_BUFFER *buffer; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMPRINTPROCESSORS; - -typedef struct spool_q_enumprintprocdatatypes -{ - uint32 name_ptr; - UNISTR2 name; - uint32 processor_ptr; - UNISTR2 processor; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMPRINTPROCDATATYPES; - -typedef struct ppdatatype_1 -{ - UNISTR name; -} -PRINTPROCDATATYPE_1; - -typedef struct spool_r_enumprintprocdatatypes -{ - NEW_BUFFER *buffer; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMPRINTPROCDATATYPES; - -typedef struct printmonitor_1 -{ - UNISTR name; -} -PRINTMONITOR_1; - -typedef struct printmonitor_2 -{ - UNISTR name; - UNISTR environment; - UNISTR dll_name; -} -PRINTMONITOR_2; - -typedef struct spool_q_enumprintmonitors -{ - uint32 name_ptr; - UNISTR2 name; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMPRINTMONITORS; - -typedef struct spool_r_enumprintmonitors -{ - NEW_BUFFER *buffer; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMPRINTMONITORS; - - -typedef struct spool_q_enumprinterdata -{ - POLICY_HND handle; - uint32 index; - uint32 valuesize; - uint32 datasize; -} -SPOOL_Q_ENUMPRINTERDATA; - -typedef struct spool_r_enumprinterdata -{ - uint32 valuesize; - uint16 *value; - uint32 realvaluesize; - uint32 type; - uint32 datasize; - uint8 *data; - uint32 realdatasize; - WERROR status; -} -SPOOL_R_ENUMPRINTERDATA; - -typedef struct spool_q_setprinterdata -{ - POLICY_HND handle; - UNISTR2 value; - uint32 type; - uint32 max_len; - uint8 *data; - uint32 real_len; - uint32 numeric_data; -} -SPOOL_Q_SETPRINTERDATA; - -typedef struct spool_r_setprinterdata -{ - WERROR status; -} -SPOOL_R_SETPRINTERDATA; - -typedef struct spool_q_resetprinter -{ - POLICY_HND handle; - uint32 datatype_ptr; - UNISTR2 datatype; - DEVMODE_CTR devmode_ctr; - -} SPOOL_Q_RESETPRINTER; - -typedef struct spool_r_resetprinter -{ - WERROR status; -} -SPOOL_R_RESETPRINTER; - - - -typedef struct _form -{ - uint32 flags; - uint32 name_ptr; - uint32 size_x; - uint32 size_y; - uint32 left; - uint32 top; - uint32 right; - uint32 bottom; - UNISTR2 name; -} -FORM; - -typedef struct spool_q_addform -{ - POLICY_HND handle; - uint32 level; - uint32 level2; /* This should really be part of the FORM structure */ - FORM form; -} -SPOOL_Q_ADDFORM; - -typedef struct spool_r_addform -{ - WERROR status; -} -SPOOL_R_ADDFORM; - -typedef struct spool_q_setform -{ - POLICY_HND handle; - UNISTR2 name; - uint32 level; - uint32 level2; - FORM form; -} -SPOOL_Q_SETFORM; - -typedef struct spool_r_setform -{ - WERROR status; -} -SPOOL_R_SETFORM; - -typedef struct spool_q_deleteform -{ - POLICY_HND handle; - UNISTR2 name; -} -SPOOL_Q_DELETEFORM; - -typedef struct spool_r_deleteform -{ - WERROR status; -} -SPOOL_R_DELETEFORM; - -typedef struct spool_q_getjob -{ - POLICY_HND handle; - uint32 jobid; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_GETJOB; - -typedef struct pjob_info_info -{ - union - { - JOB_INFO_1 *job_info_1; - JOB_INFO_2 *job_info_2; - void *info; - } - job; - -} -PJOB_INFO; - -typedef struct spool_r_getjob -{ - NEW_BUFFER *buffer; - uint32 needed; - WERROR status; -} -SPOOL_R_GETJOB; - -typedef struct spool_q_replyopenprinter -{ - UNISTR2 string; - uint32 printer; - uint32 type; - uint32 unknown0; - uint32 unknown1; -} -SPOOL_Q_REPLYOPENPRINTER; - -typedef struct spool_r_replyopenprinter -{ - POLICY_HND handle; - WERROR status; -} -SPOOL_R_REPLYOPENPRINTER; - -typedef struct spool_q_routerreplyprinter -{ - POLICY_HND handle; - uint32 condition; - uint32 unknown1; /* 0x00000001 */ - uint32 change_id; - uint8 unknown2[5]; /* 0x0000000001 */ -} -SPOOL_Q_ROUTERREPLYPRINTER; - -typedef struct spool_r_routerreplyprinter -{ - WERROR status; -} -SPOOL_R_ROUTERREPLYPRINTER; - -typedef struct spool_q_replycloseprinter -{ - POLICY_HND handle; -} -SPOOL_Q_REPLYCLOSEPRINTER; - -typedef struct spool_r_replycloseprinter -{ - POLICY_HND handle; - WERROR status; -} -SPOOL_R_REPLYCLOSEPRINTER; - -typedef struct spool_q_rrpcn -{ - POLICY_HND handle; - uint32 change_low; - uint32 change_high; - uint32 unknown0; - uint32 unknown1; - uint32 info_ptr; - SPOOL_NOTIFY_INFO info; -} -SPOOL_Q_REPLY_RRPCN; - -typedef struct spool_r_rrpcn -{ - uint32 unknown0; - WERROR status; -} -SPOOL_R_REPLY_RRPCN; - -typedef struct spool_q_getprinterdataex -{ - POLICY_HND handle; - UNISTR2 keyname; - UNISTR2 valuename; - uint32 size; -} -SPOOL_Q_GETPRINTERDATAEX; - -typedef struct spool_r_getprinterdataex -{ - uint32 type; - uint32 size; - uint8 *data; - uint32 needed; - WERROR status; -} -SPOOL_R_GETPRINTERDATAEX; - -typedef struct spool_q_setprinterdataex -{ - POLICY_HND handle; - UNISTR2 key; - UNISTR2 value; - uint32 type; - uint32 max_len; - uint8 *data; - uint32 real_len; - uint32 numeric_data; -} -SPOOL_Q_SETPRINTERDATAEX; - -typedef struct spool_r_setprinterdataex -{ - WERROR status; -} -SPOOL_R_SETPRINTERDATAEX; - - -typedef struct spool_q_deleteprinterdataex -{ - POLICY_HND handle; - UNISTR2 keyname; - UNISTR2 valuename; -} -SPOOL_Q_DELETEPRINTERDATAEX; - -typedef struct spool_r_deleteprinterdataex -{ - WERROR status; -} -SPOOL_R_DELETEPRINTERDATAEX; - - -typedef struct spool_q_enumprinterkey -{ - POLICY_HND handle; - UNISTR2 key; - uint32 size; -} -SPOOL_Q_ENUMPRINTERKEY; - -typedef struct spool_r_enumprinterkey -{ - BUFFER5 keys; - uint32 needed; /* in bytes */ - WERROR status; -} -SPOOL_R_ENUMPRINTERKEY; - -typedef struct spool_q_deleteprinterkey -{ - POLICY_HND handle; - UNISTR2 keyname; -} -SPOOL_Q_DELETEPRINTERKEY; - -typedef struct spool_r_deleteprinterkey -{ - WERROR status; -} -SPOOL_R_DELETEPRINTERKEY; - -typedef struct printer_enum_values -{ - UNISTR valuename; - uint32 value_len; - uint32 type; - uint8 *data; - uint32 data_len; - -} -PRINTER_ENUM_VALUES; - -typedef struct printer_enum_values_ctr -{ - uint32 size; - uint32 size_of_array; - PRINTER_ENUM_VALUES *values; -} -PRINTER_ENUM_VALUES_CTR; - -typedef struct spool_q_enumprinterdataex -{ - POLICY_HND handle; - UNISTR2 key; - uint32 size; -} -SPOOL_Q_ENUMPRINTERDATAEX; - -typedef struct spool_r_enumprinterdataex -{ - PRINTER_ENUM_VALUES_CTR ctr; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMPRINTERDATAEX; - -typedef struct printprocessor_directory_1 -{ - UNISTR name; -} -PRINTPROCESSOR_DIRECTORY_1; - -typedef struct spool_q_getprintprocessordirectory -{ - UNISTR2 name; - UNISTR2 environment; - uint32 level; - NEW_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_GETPRINTPROCESSORDIRECTORY; - -typedef struct spool_r_getprintprocessordirectory -{ - NEW_BUFFER *buffer; - uint32 needed; - WERROR status; -} -SPOOL_R_GETPRINTPROCESSORDIRECTORY; - -#define PRINTER_DRIVER_VERSION 2 -#define PRINTER_DRIVER_ARCHITECTURE "Windows NT x86" - -#endif /* _RPC_SPOOLSS_H */ - diff --git a/source/include/rpc_srvsvc.h b/source/include/rpc_srvsvc.h deleted file mode 100644 index 5ebb77a8c21..00000000000 --- a/source/include/rpc_srvsvc.h +++ /dev/null @@ -1,954 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - Copyright (C) Nigel Williams 2001 - - 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_SRVSVC_H /* _RPC_SRVSVC_H */ -#define _RPC_SRVSVC_H - -/* srvsvc pipe */ -#define SRV_NET_CONN_ENUM 0x08 -#define SRV_NET_FILE_ENUM 0x09 -#define SRV_NET_FILE_CLOSE 0x0b -#define SRV_NET_SESS_ENUM 0x0c -#define SRV_NET_SHARE_ADD 0x0e -#define SRV_NET_SHARE_ENUM_ALL 0x0f -#define SRV_NET_SHARE_GET_INFO 0x10 -#define SRV_NET_SHARE_SET_INFO 0x11 -#define SRV_NET_SHARE_DEL 0x12 -#define SRV_NET_SHARE_DEL_STICKY 0x13 -#define SRV_NET_SRV_GET_INFO 0x15 -#define SRV_NET_SRV_SET_INFO 0x16 -#define SRV_NET_DISK_ENUM 0x17 -#define SRV_NET_REMOTE_TOD 0x1c -#define SRV_NET_NAME_VALIDATE 0x21 -#define SRV_NET_SHARE_ENUM 0x24 -#define SRV_NET_FILE_QUERY_SECDESC 0x27 -#define SRV_NET_FILE_SET_SECDESC 0x28 - -#define MAX_SERVER_DISK_ENTRIES 15 - -typedef struct disk_info { - uint32 unknown; - UNISTR3 disk_name; -} DISK_INFO; - -typedef struct disk_enum_container { - uint32 level; - uint32 entries_read; - uint32 unknown; - uint32 disk_info_ptr; - DISK_INFO *disk_info; -} DISK_ENUM_CONTAINER; - -typedef struct net_srv_disk_enum { - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* server name */ - - DISK_ENUM_CONTAINER disk_enum_ctr; - - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - uint32 total_entries; /* total number of entries */ - ENUM_HND enum_hnd; - WERROR status; /* return status */ -} SRV_Q_NET_DISK_ENUM, SRV_R_NET_DISK_ENUM; - -typedef struct net_name_validate { - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - UNISTR2 uni_name; /*name to validate*/ - uint32 type; - uint32 flags; - WERROR status; -} SRV_Q_NET_NAME_VALIDATE, SRV_R_NET_NAME_VALIDATE; - -/* SESS_INFO_0 (pointers to level 0 session info strings) */ -typedef struct ptr_sess_info0 -{ - uint32 ptr_name; /* pointer to name. */ - -} SESS_INFO_0; - -/* SESS_INFO_0_STR (level 0 session info strings) */ -typedef struct str_sess_info0 -{ - UNISTR2 uni_name; /* unicode string of name */ - -} SESS_INFO_0_STR; - -/* oops - this is going to take up a *massive* amount of stack. */ -/* the UNISTR2s already have 1024 uint16 chars in them... */ -#define MAX_SESS_ENTRIES 32 - -/* SRV_SESS_INFO_0 */ -typedef struct srv_sess_info_0_info -{ - uint32 num_entries_read; /* EntriesRead */ - uint32 ptr_sess_info; /* Buffer */ - uint32 num_entries_read2; /* EntriesRead */ - - SESS_INFO_0 info_0 [MAX_SESS_ENTRIES]; /* session entry pointers */ - SESS_INFO_0_STR info_0_str[MAX_SESS_ENTRIES]; /* session entry strings */ - -} SRV_SESS_INFO_0; - -/* SESS_INFO_1 (pointers to level 1 session info strings) */ -typedef struct ptr_sess_info1 -{ - uint32 ptr_name; /* pointer to name. */ - uint32 ptr_user; /* pointer to user name. */ - - uint32 num_opens; - uint32 open_time; - uint32 idle_time; - uint32 user_flags; - -} SESS_INFO_1; - -/* SESS_INFO_1_STR (level 1 session info strings) */ -typedef struct str_sess_info1 -{ - UNISTR2 uni_name; /* unicode string of name */ - UNISTR2 uni_user; /* unicode string of user */ - -} SESS_INFO_1_STR; - -/* SRV_SESS_INFO_1 */ -typedef struct srv_sess_info_1_info -{ - uint32 num_entries_read; /* EntriesRead */ - uint32 ptr_sess_info; /* Buffer */ - uint32 num_entries_read2; /* EntriesRead */ - - SESS_INFO_1 info_1 [MAX_SESS_ENTRIES]; /* session entry pointers */ - SESS_INFO_1_STR info_1_str[MAX_SESS_ENTRIES]; /* session entry strings */ - -} SRV_SESS_INFO_1; - -/* SRV_SESS_INFO_CTR */ -typedef struct srv_sess_info_ctr_info -{ - uint32 switch_value; /* switch value */ - uint32 ptr_sess_ctr; /* pointer to sess info union */ - union - { - SRV_SESS_INFO_0 info0; /* session info level 0 */ - SRV_SESS_INFO_1 info1; /* session info level 1 */ - - } sess; - -} SRV_SESS_INFO_CTR; - - -/* SRV_Q_NET_SESS_ENUM */ -typedef struct q_net_sess_enum_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* server name */ - - uint32 ptr_qual_name; /* pointer (to qualifier name) */ - UNISTR2 uni_qual_name; /* qualifier name "\\qualifier" */ - - uint32 ptr_user_name; /* pointer (to user name */ - UNISTR2 uni_user_name; /* user name */ - - uint32 sess_level; /* session level */ - - SRV_SESS_INFO_CTR *ctr; - - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - ENUM_HND enum_hnd; - -} SRV_Q_NET_SESS_ENUM; - -/* SRV_R_NET_SESS_ENUM */ -typedef struct r_net_sess_enum_info -{ - uint32 sess_level; /* share level */ - - SRV_SESS_INFO_CTR *ctr; - - uint32 total_entries; /* total number of entries */ - ENUM_HND enum_hnd; - - WERROR status; /* return status */ - -} SRV_R_NET_SESS_ENUM; - -/* CONN_INFO_0 (pointers to level 0 connection info strings) */ -typedef struct ptr_conn_info0 -{ - uint32 id; /* connection id. */ - -} CONN_INFO_0; - -/* oops - this is going to take up a *massive* amount of stack. */ -/* the UNISTR2s already have 1024 uint16 chars in them... */ -#define MAX_CONN_ENTRIES 32 - -/* SRV_CONN_INFO_0 */ -typedef struct srv_conn_info_0_info -{ - uint32 num_entries_read; /* EntriesRead */ - uint32 ptr_conn_info; /* Buffer */ - uint32 num_entries_read2; /* EntriesRead */ - - CONN_INFO_0 info_0 [MAX_CONN_ENTRIES]; /* connection entry pointers */ - -} SRV_CONN_INFO_0; - -/* CONN_INFO_1 (pointers to level 1 connection info strings) */ -typedef struct ptr_conn_info1 -{ - uint32 id; /* connection id */ - uint32 type; /* 0x3 */ - uint32 num_opens; - uint32 num_users; - uint32 open_time; - - uint32 ptr_usr_name; /* pointer to user name. */ - uint32 ptr_net_name; /* pointer to network name (e.g IPC$). */ - -} CONN_INFO_1; - -/* CONN_INFO_1_STR (level 1 connection info strings) */ -typedef struct str_conn_info1 -{ - UNISTR2 uni_usr_name; /* unicode string of user */ - UNISTR2 uni_net_name; /* unicode string of name */ - -} CONN_INFO_1_STR; - -/* SRV_CONN_INFO_1 */ -typedef struct srv_conn_info_1_info -{ - uint32 num_entries_read; /* EntriesRead */ - uint32 ptr_conn_info; /* Buffer */ - uint32 num_entries_read2; /* EntriesRead */ - - CONN_INFO_1 info_1 [MAX_CONN_ENTRIES]; /* connection entry pointers */ - CONN_INFO_1_STR info_1_str[MAX_CONN_ENTRIES]; /* connection entry strings */ - -} SRV_CONN_INFO_1; - -/* SRV_CONN_INFO_CTR */ -typedef struct srv_conn_info_ctr_info -{ - uint32 switch_value; /* switch value */ - uint32 ptr_conn_ctr; /* pointer to conn info union */ - union - { - SRV_CONN_INFO_0 info0; /* connection info level 0 */ - SRV_CONN_INFO_1 info1; /* connection info level 1 */ - - } conn; - -} SRV_CONN_INFO_CTR; - - -/* SRV_Q_NET_CONN_ENUM */ -typedef struct q_net_conn_enum_info -{ - uint32 ptr_srv_name; /* pointer (to server name) */ - UNISTR2 uni_srv_name; /* server name "\\server" */ - - uint32 ptr_qual_name; /* pointer (to qualifier name) */ - UNISTR2 uni_qual_name; /* qualifier name "\\qualifier" */ - - uint32 conn_level; /* connection level */ - - SRV_CONN_INFO_CTR *ctr; - - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - ENUM_HND enum_hnd; - -} SRV_Q_NET_CONN_ENUM; - -/* SRV_R_NET_CONN_ENUM */ -typedef struct r_net_conn_enum_info -{ - uint32 conn_level; /* share level */ - - SRV_CONN_INFO_CTR *ctr; - - uint32 total_entries; /* total number of entries */ - ENUM_HND enum_hnd; - - WERROR status; /* return status */ - -} SRV_R_NET_CONN_ENUM; - -/* SH_INFO_0 */ -typedef struct ptr_share_info0 -{ - uint32 ptr_netname; /* pointer to net name. */ -} SH_INFO_0; - -/* SH_INFO_0_STR (level 0 share info strings) */ -typedef struct str_share_info0 -{ - SH_INFO_0 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name */ - -} SH_INFO_0_STR; - -/* SRV_SHARE_INFO_0 */ -typedef struct share_info_0_info -{ - SH_INFO_0 info_0; - SH_INFO_0_STR info_0_str; - -} SRV_SHARE_INFO_0; - -/* SH_INFO_1 (pointers to level 1 share info strings) */ -typedef struct ptr_share_info1 -{ - uint32 ptr_netname; /* pointer to net name. */ - uint32 type; /* ipc, print, disk ... */ - uint32 ptr_remark; /* pointer to comment. */ - -} SH_INFO_1; - -/* SH_INFO_1_STR (level 1 share info strings) */ -typedef struct str_share_info1 -{ - SH_INFO_1 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name */ - UNISTR2 uni_remark; /* unicode string of comment */ - -} SH_INFO_1_STR; - -/* SRV_SHARE_INFO_1 */ -typedef struct share_info_1_info -{ - SH_INFO_1 info_1; - SH_INFO_1_STR info_1_str; - -} SRV_SHARE_INFO_1; - -/* SH_INFO_2 (pointers to level 2 share info strings) */ -typedef struct ptr_share_info2 -{ - uint32 ptr_netname; /* pointer to net name. */ - uint32 type; /* ipc, print, disk ... */ - uint32 ptr_remark; /* pointer to comment. */ - uint32 perms; /* permissions */ - uint32 max_uses; /* maximum uses */ - uint32 num_uses; /* current uses */ - uint32 ptr_path; /* pointer to path name */ - uint32 ptr_passwd; /* pointer to password */ - -} SH_INFO_2; - -/* SH_INFO_2_STR (level 2 share info strings) */ -typedef struct str_share_info2 -{ - SH_INFO_2 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name (e.g NETLOGON) */ - UNISTR2 uni_remark; /* unicode string of comment (e.g "Logon server share") */ - UNISTR2 uni_path; /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */ - UNISTR2 uni_passwd; /* unicode string of password - presumably for share level security (e.g NULL) */ - -} SH_INFO_2_STR; - -/* SRV_SHARE_INFO_2 */ -typedef struct share_info_2_info -{ - SH_INFO_2 info_2; - SH_INFO_2_STR info_2_str; - -} SRV_SHARE_INFO_2; - -typedef struct ptr_share_info501 -{ - uint32 ptr_netname; /* pointer to net name */ - uint32 type; /* ipc, print, disk */ - uint32 ptr_remark; /* pointer to comment */ - uint32 csc_policy; /* client-side offline caching policy << 4 */ -} SH_INFO_501; - -typedef struct str_share_info501 -{ - UNISTR2 uni_netname; /* unicode string of net name */ - UNISTR2 uni_remark; /* unicode string of comment */ -} SH_INFO_501_STR; - -/* SRV_SHARE_INFO_501 */ -typedef struct share_info_501_info -{ - SH_INFO_501 info_501; - SH_INFO_501_STR info_501_str; -} SRV_SHARE_INFO_501; - -/* SH_INFO_502 (pointers to level 502 share info strings) */ -typedef struct ptr_share_info502 -{ - uint32 ptr_netname; /* pointer to net name. */ - uint32 type; /* ipc, print, disk ... */ - uint32 ptr_remark; /* pointer to comment. */ - uint32 perms; /* permissions */ - uint32 max_uses; /* maximum uses */ - uint32 num_uses; /* current uses */ - uint32 ptr_path; /* pointer to path name */ - uint32 ptr_passwd; /* pointer to password */ - uint32 reserved; /* this holds the space taken by the sd in the rpc packet */ - uint32 reserved_offset; /* required for _post operation when marshalling */ - uint32 sd_size; /* size of security descriptor */ - uint32 ptr_sd; /* pointer to security descriptor */ - -} SH_INFO_502; - -/* SH_INFO_502_STR (level 502 share info strings) */ -typedef struct str_share_info502 -{ - SH_INFO_502 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name (e.g NETLOGON) */ - UNISTR2 uni_remark; /* unicode string of comment (e.g "Logon server share") */ - UNISTR2 uni_path; /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */ - UNISTR2 uni_passwd; /* unicode string of password - presumably for share level security (e.g NULL) */ - - uint32 reserved; - uint32 sd_size; - SEC_DESC *sd; - -} SH_INFO_502_STR; - -/* SRV_SHARE_INFO_502 */ -typedef struct share_info_502_info -{ - SH_INFO_502 info_502; - SH_INFO_502_STR info_502_str; - -} SRV_SHARE_INFO_502; - -typedef struct ptr_share_info1004 -{ - uint32 ptr_remark; - -} SH_INFO_1004; - -typedef struct str_share_info1004 -{ - SH_INFO_1004 *ptrs; - - UNISTR2 uni_remark; - -} SH_INFO_1004_STR; - -typedef struct ptr_info_1004_info -{ - SH_INFO_1004 info_1004; - SH_INFO_1004_STR info_1004_str; -} SRV_SHARE_INFO_1004; - -#define SHARE_1005_IN_DFS 0x00000001 -#define SHARE_1005_DFS_ROOT 0x00000002 -/* use the CSC policy mask and shift to match up with the smb.conf parm */ -#define SHARE_1005_CSC_POLICY_MASK 0x00000030 -#define SHARE_1005_CSC_POLICY_SHIFT 4 - -typedef struct share_info_1005_info -{ - uint32 share_info_flags; -} SRV_SHARE_INFO_1005; - -typedef struct share_info_1006_info -{ - uint32 max_uses; -} SRV_SHARE_INFO_1006; - -typedef struct ptr_share_info1007 -{ - uint32 flags; - uint32 ptr_AlternateDirectoryName; - -} SH_INFO_1007; - -typedef struct str_share_info1007 -{ - SH_INFO_1007 *ptrs; - - UNISTR2 uni_AlternateDirectoryName; - -} SH_INFO_1007_STR; - -typedef struct ptr_info_1007_info -{ - SH_INFO_1007 info_1007; - SH_INFO_1007_STR info_1007_str; -} SRV_SHARE_INFO_1007; - -/* SRV_SHARE_INFO_1501 */ -typedef struct share_info_1501_info -{ - SEC_DESC_BUF *sdb; -} SRV_SHARE_INFO_1501; - -/* SRV_SHARE_INFO_CTR */ -typedef struct srv_share_info_ctr_info -{ - uint32 info_level; - uint32 switch_value; - uint32 ptr_share_info; - - uint32 num_entries; - uint32 ptr_entries; - uint32 num_entries2; - - union { - SRV_SHARE_INFO_0 *info0; - SRV_SHARE_INFO_1 *info1; /* share info level 1 */ - SRV_SHARE_INFO_2 *info2; /* share info level 2 */ - SRV_SHARE_INFO_501 *info501; /* share info level 501 */ - SRV_SHARE_INFO_502 *info502; /* share info level 502 */ - SRV_SHARE_INFO_1004 *info1004; - SRV_SHARE_INFO_1005 *info1005; - SRV_SHARE_INFO_1006 *info1006; - SRV_SHARE_INFO_1007 *info1007; - SRV_SHARE_INFO_1501 *info1501; - void *info; - - } share; - -} SRV_SHARE_INFO_CTR; - -/* SRV_Q_NET_SHARE_ENUM */ -typedef struct q_net_share_enum_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* server name */ - - SRV_SHARE_INFO_CTR ctr; /* share info container */ - - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - - ENUM_HND enum_hnd; - -} SRV_Q_NET_SHARE_ENUM; - - -/* SRV_R_NET_SHARE_ENUM */ -typedef struct r_net_share_enum_info -{ - SRV_SHARE_INFO_CTR ctr; /* share info container */ - - uint32 total_entries; /* total number of entries */ - ENUM_HND enum_hnd; - - WERROR status; /* return status */ - -} SRV_R_NET_SHARE_ENUM; - - -/* SRV_Q_NET_SHARE_GET_INFO */ -typedef struct q_net_share_get_info_info -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - - UNISTR2 uni_share_name; - uint32 info_level; - -} SRV_Q_NET_SHARE_GET_INFO; - -/* SRV_SHARE_INFO */ -typedef struct srv_share_info { - uint32 switch_value; - uint32 ptr_share_ctr; - - union { - SRV_SHARE_INFO_0 info0; - SRV_SHARE_INFO_1 info1; - SRV_SHARE_INFO_2 info2; - SRV_SHARE_INFO_501 info501; - SRV_SHARE_INFO_502 info502; - SRV_SHARE_INFO_1004 info1004; - SRV_SHARE_INFO_1005 info1005; - SRV_SHARE_INFO_1006 info1006; - SRV_SHARE_INFO_1007 info1007; - SRV_SHARE_INFO_1501 info1501; - } share; -} SRV_SHARE_INFO; - -/* SRV_R_NET_SHARE_GET_INFO */ -typedef struct r_net_share_get_info_info -{ - SRV_SHARE_INFO info; - WERROR status; - -} SRV_R_NET_SHARE_GET_INFO; - -/* SRV_Q_NET_SHARE_SET_INFO */ -typedef struct q_net_share_set_info_info -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - - UNISTR2 uni_share_name; - uint32 info_level; - - SRV_SHARE_INFO info; - - uint32 ptr_parm_error; - uint32 parm_error; - -} SRV_Q_NET_SHARE_SET_INFO; - -/* SRV_R_NET_SHARE_SET_INFO */ -typedef struct r_net_share_set_info -{ - uint32 ptr_parm_error; - uint32 parm_error; - - WERROR status; /* return status */ - -} SRV_R_NET_SHARE_SET_INFO; - -/* SRV_Q_NET_SHARE_ADD */ -typedef struct q_net_share_add -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - - uint32 info_level; - - SRV_SHARE_INFO info; - - uint32 ptr_err_index; /* pointer to error index */ - uint32 err_index; /* index in info to field in error */ - -} SRV_Q_NET_SHARE_ADD; - -/* SRV_R_NET_SHARE_ADD */ -typedef struct r_net_share_add -{ - - uint32 ptr_parm_error; - uint32 parm_error; - - WERROR status; /* return status */ - -} SRV_R_NET_SHARE_ADD; - -/* SRV_Q_NET_SHARE_DEL */ -typedef struct q_net_share_del -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - UNISTR2 uni_share_name; - uint32 reserved; - -} SRV_Q_NET_SHARE_DEL; - -/* SRV_R_NET_SHARE_DEL */ -typedef struct r_net_share_del -{ - WERROR status; /* return status */ - -} SRV_R_NET_SHARE_DEL; - -/* FILE_INFO_3 (level 3 file info strings) */ -typedef struct file_info3_info -{ - uint32 id; /* file index */ - uint32 perms; /* file permissions. don't know what format */ - uint32 num_locks; /* file locks */ - uint32 ptr_path_name; /* file name */ - uint32 ptr_user_name; /* file owner */ - -} FILE_INFO_3; - -/* FILE_INFO_3_STR (level 3 file info strings) */ -typedef struct str_file_info3_info -{ - UNISTR2 uni_path_name; /* unicode string of file name */ - UNISTR2 uni_user_name; /* unicode string of file owner. */ - -} FILE_INFO_3_STR; - -/* SRV_FILE_INFO_3 */ -typedef struct srv_file_info_3 -{ - uint32 num_entries_read; /* EntriesRead */ - uint32 ptr_file_info; /* Buffer */ - - uint32 num_entries_read2; /* EntriesRead */ - FILE_INFO_3 info_3; /* file entry details */ - FILE_INFO_3_STR info_3_str; /* file entry strings */ -} SRV_FILE_INFO_3; - -/* SRV_FILE_INFO_CTR */ -typedef struct srv_file_info_3_info -{ - uint32 switch_value; /* switch value */ - uint32 ptr_file_info; /* pointer to file info union */ - - uint32 num_entries; - uint32 ptr_entries; - uint32 num_entries2; - union - { - SRV_FILE_INFO_3 *info3; - } file; - -} SRV_FILE_INFO_CTR; - - -/* SRV_Q_NET_FILE_ENUM */ -typedef struct q_net_file_enum_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* server name */ - - uint32 ptr_qual_name; /* pointer (to qualifier name) */ - UNISTR2 uni_qual_name; /* qualifier name "\\qualifier" */ - - uint32 ptr_user_name; /* pointer (to user name) */ - UNISTR2 uni_user_name; /* user name */ - - uint32 file_level; /* file level */ - - SRV_FILE_INFO_CTR ctr; - - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - ENUM_HND enum_hnd; - -} SRV_Q_NET_FILE_ENUM; - - -/* SRV_R_NET_FILE_ENUM */ -typedef struct r_net_file_enum_info -{ - uint32 file_level; /* file level */ - - SRV_FILE_INFO_CTR ctr; - - uint32 total_entries; /* total number of files */ - ENUM_HND enum_hnd; - - WERROR status; /* return status */ - -} SRV_R_NET_FILE_ENUM; - -/* SRV_Q_NET_FILE_CLOSE */ -typedef struct q_net_file_close -{ - uint32 ptr_srv_name; /* pointer to server name */ - UNISTR2 uni_srv_name; /* server name */ - - uint32 file_id; -} SRV_Q_NET_FILE_CLOSE; - -/* SRV_R_NET_FILE_CLOSE */ -typedef struct r_net_file_close -{ - WERROR status; /* return status */ -} SRV_R_NET_FILE_CLOSE; - -/* SRV_INFO_100 */ -typedef struct srv_info_100_info -{ - uint32 platform_id; /* 0x500 */ - uint32 ptr_name; /* pointer to server name */ - - UNISTR2 uni_name; /* server name "server" */ - -} SRV_INFO_100; - -/* SRV_INFO_101 */ -typedef struct srv_info_101_info -{ - uint32 platform_id; /* 0x500 */ - uint32 ptr_name; /* pointer to server name */ - uint32 ver_major; /* 0x4 */ - uint32 ver_minor; /* 0x2 */ - uint32 srv_type; /* browse etc type */ - uint32 ptr_comment; /* pointer to server comment */ - - UNISTR2 uni_name; /* server name "server" */ - UNISTR2 uni_comment; /* server comment "samba x.x.x blah" */ - -} SRV_INFO_101; - -/* SRV_INFO_102 */ -typedef struct srv_info_102_info -{ - uint32 platform_id; /* 0x500 */ - uint32 ptr_name; /* pointer to server name */ - uint32 ver_major; /* 0x4 */ - uint32 ver_minor; /* 0x2 */ - uint32 srv_type; /* browse etc type */ - uint32 ptr_comment; /* pointer to server comment */ - uint32 users; /* 0xffff ffff*/ - uint32 disc; /* 0xf */ - uint32 hidden; /* 0x0 */ - uint32 announce; /* 240 */ - uint32 ann_delta; /* 3000 */ - uint32 licenses; /* 0 */ - uint32 ptr_usr_path; /* pointer to user path */ - - UNISTR2 uni_name; /* server name "server" */ - UNISTR2 uni_comment; /* server comment "samba x.x.x blah" */ - UNISTR2 uni_usr_path; /* "c:\" (eh?) */ - -} SRV_INFO_102; - - -/* SRV_INFO_CTR */ -typedef struct srv_info_ctr_info -{ - uint32 switch_value; /* switch value */ - uint32 ptr_srv_ctr; /* pointer to server info */ - union - { - SRV_INFO_102 sv102; /* server info level 102 */ - SRV_INFO_101 sv101; /* server info level 101 */ - SRV_INFO_100 sv100; /* server info level 100 */ - - } srv; - -} SRV_INFO_CTR; - -/* SRV_Q_NET_SRV_GET_INFO */ -typedef struct q_net_srv_get_info -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; /* "\\server" */ - uint32 switch_value; - -} SRV_Q_NET_SRV_GET_INFO; - -/* SRV_R_NET_SRV_GET_INFO */ -typedef struct r_net_srv_get_info -{ - SRV_INFO_CTR *ctr; - - WERROR status; /* return status */ - -} SRV_R_NET_SRV_GET_INFO; - -/* SRV_Q_NET_SRV_SET_INFO */ -typedef struct q_net_srv_set_info -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; /* "\\server" */ - uint32 switch_value; - - SRV_INFO_CTR *ctr; - -} SRV_Q_NET_SRV_SET_INFO; - - -/* SRV_R_NET_SRV_SET_INFO */ -typedef struct r_net_srv_set_info -{ - uint32 switch_value; /* switch value */ - - WERROR status; /* return status */ - -} SRV_R_NET_SRV_SET_INFO; - -/* SRV_Q_NET_REMOTE_TOD */ -typedef struct q_net_remote_tod -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; /* "\\server" */ - -} SRV_Q_NET_REMOTE_TOD; - -/* TIME_OF_DAY_INFO */ -typedef struct time_of_day_info -{ - uint32 elapsedt; - uint32 msecs; - uint32 hours; - uint32 mins; - uint32 secs; - uint32 hunds; - uint32 zone; - uint32 tintervals; - uint32 day; - uint32 month; - uint32 year; - uint32 weekday; - -} TIME_OF_DAY_INFO; - -/* SRV_R_NET_REMOTE_TOD */ -typedef struct r_net_remote_tod -{ - uint32 ptr_srv_tod; /* pointer to TOD */ - TIME_OF_DAY_INFO *tod; - - WERROR status; /* return status */ - -} SRV_R_NET_REMOTE_TOD; - -/* SRV_Q_NET_FILE_QUERY_SECDESC */ -typedef struct q_net_file_query_secdesc -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - uint32 ptr_qual_name; - UNISTR2 uni_qual_name; - UNISTR2 uni_file_name; - uint32 unknown1; - uint32 unknown2; - uint32 unknown3; -} SRV_Q_NET_FILE_QUERY_SECDESC; - -/* SRV_R_NET_FILE_QUERY_SECDESC */ -typedef struct r_net_file_query_secdesc -{ - uint32 ptr_response; - uint32 size_response; - uint32 ptr_secdesc; - uint32 size_secdesc; - SEC_DESC *sec_desc; - WERROR status; -} SRV_R_NET_FILE_QUERY_SECDESC; - -/* SRV_Q_NET_FILE_SET_SECDESC */ -typedef struct q_net_file_set_secdesc -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - uint32 ptr_qual_name; - UNISTR2 uni_qual_name; - UNISTR2 uni_file_name; - uint32 sec_info; - uint32 size_set; - uint32 ptr_secdesc; - uint32 size_secdesc; - SEC_DESC *sec_desc; -} SRV_Q_NET_FILE_SET_SECDESC; - -/* SRV_R_NET_FILE_SET_SECDESC */ -typedef struct r_net_file_set_secdesc -{ - WERROR status; -} SRV_R_NET_FILE_SET_SECDESC; - -#endif /* _RPC_SRVSVC_H */ diff --git a/source/include/rpc_wkssvc.h b/source/include/rpc_wkssvc.h deleted file mode 100644 index adc37c255b2..00000000000 --- a/source/include/rpc_wkssvc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - - 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_WKS_H /* _RPC_WKS_H */ -#define _RPC_WKS_H - - -/* wkssvc pipe */ -#define WKS_QUERY_INFO 0x00 - - -/* WKS_Q_QUERY_INFO - probably a capabilities request */ -typedef struct q_wks_query_info_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */ - - uint16 switch_value; /* info level 100 (0x64) */ - -} WKS_Q_QUERY_INFO; - - -/* WKS_INFO_100 - level 100 info */ -typedef struct wks_info_100_info -{ - uint32 platform_id; /* 0x0000 01f4 - unknown */ - uint32 ptr_compname; /* pointer to server name */ - uint32 ptr_lan_grp ; /* pointer to domain name */ - uint32 ver_major; /* 4 - unknown */ - uint32 ver_minor; /* 0 - unknown */ - - UNISTR2 uni_compname; /* unicode server name */ - UNISTR2 uni_lan_grp ; /* unicode domain name */ - -} WKS_INFO_100; - - -/* WKS_R_QUERY_INFO - probably a capabilities request */ -typedef struct r_wks_query_info_info -{ - uint16 switch_value; /* 100 (0x64) - switch value */ - - /* for now, only level 100 is supported. this should be an enum container */ - uint32 ptr_1; /* pointer 1 */ - WKS_INFO_100 *wks100; /* workstation info level 100 */ - - NTSTATUS status; /* return status */ - -} WKS_R_QUERY_INFO; - - -#endif /* _RPC_WKS_H */ - diff --git a/source/include/safe_string.h b/source/include/safe_string.h index b22c5efcc99..431dc400aa1 100644 --- a/source/include/safe_string.h +++ b/source/include/safe_string.h @@ -2,7 +2,6 @@ Unix SMB/CIFS implementation. Safe string handling routines. Copyright (C) Andrew Tridgell 1994-1998 - Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,72 +46,31 @@ #endif /* sprintf */ #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__; -/* - * strcasecmp/strncasecmp aren't an error, but it means you're not thinking about - * multibyte. Don't use them. JRA. - */ -#ifdef strcasecmp -#undef strcasecmp -#endif -#define strcasecmp __ERROR__XX__NEVER_USE_STRCASECMP__; - -#ifdef strncasecmp -#undef strncasecmp -#endif -#define strncasecmp __ERROR__XX__NEVER_USE_STRCASECMP__; - #endif /* !_SPLINT_ */ -#ifdef DEVELOPER -#define SAFE_STRING_FUNCTION_NAME FUNCTION_MACRO -#define SAFE_STRING_LINE __LINE__ -#else -#define SAFE_STRING_FUNCTION_NAME ("") -#define SAFE_STRING_LINE (0) -#endif - -/* We need a number of different prototypes for our - non-existant fuctions */ char * __unsafe_string_function_usage_here__(void); -size_t __unsafe_string_function_usage_here_size_t__(void); - -size_t __unsafe_string_function_usage_here_char__(void); - -#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS +#if 0 && defined __GNUC__ && __GNUC__ >= 2 && defined __OPTIMIZE__ -/* if the compiler will optimize out function calls, then use this to tell if we are - have the correct types (this works only where sizeof() returns the size of the buffer, not - the size of the pointer). */ +#define pstrcpy(d,s) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcpy((d), (s),sizeof(pstring)-1)) +#define pstrcat(d,s) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcat((d), (s),sizeof(pstring)-1)) +#define fstrcpy(d,s) ((sizeof(d) != sizeof(fstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcpy((d),(s),sizeof(fstring)-1)) +#define fstrcat(d,s) ((sizeof(d) != sizeof(fstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcat((d),(s),sizeof(fstring)-1)) -#define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *)) +#define fstrterminate(d) ((sizeof(d) != sizeof(fstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : (((d)[sizeof(fstring)-1]) = '\0')) +#define pstrterminate(d) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : (((d)[sizeof(pstring)-1]) = '\0')) -#define fstrterminate(d) (CHECK_STRING_SIZE(d, sizeof(fstring)) \ - ? __unsafe_string_function_usage_here_char__() \ - : (((d)[sizeof(fstring)-1]) = '\0')) -#define pstrterminate(d) (CHECK_STRING_SIZE(d, sizeof(pstring)) \ - ? __unsafe_string_function_usage_here_char__() \ - : (((d)[sizeof(pstring)-1]) = '\0')) +#define wpstrcpy(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcpy_w((d),(s),sizeof(wpstring))) +#define wpstrcat(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcat_w((d),(s),sizeof(wpstring))) +#define wfstrcpy(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcpy_w((d),(s),sizeof(wfstring))) +#define wfstrcat(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcat_w((d),(s),sizeof(wfstring))) -#define wpstrcpy(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ - ? __unsafe_string_function_usage_here__() \ - : safe_strcpy_w((d),(s),sizeof(wpstring))) -#define wpstrcat(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ - ? __unsafe_string_function_usage_here__() \ - : safe_strcat_w((d),(s),sizeof(wpstring))) -#define wfstrcpy(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ - ? __unsafe_string_function_usage_here__() \ - : safe_strcpy_w((d),(s),sizeof(wfstring))) -#define wfstrcat(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ - ? __unsafe_string_function_usage_here__() \ - : safe_strcat_w((d),(s),sizeof(wfstring))) - -#define push_pstring_base(dest, src, pstring_base) \ - (CHECK_STRING_SIZE(pstring_base, sizeof(pstring)) \ - ? __unsafe_string_function_usage_here_size_t__() \ - : push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE)) +#else -#else /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */ +#define pstrcpy(d,s) safe_strcpy((d), (s),sizeof(pstring)-1) +#define pstrcat(d,s) safe_strcat((d), (s),sizeof(pstring)-1) +#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1) +#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1) #define fstrterminate(d) (((d)[sizeof(fstring)-1]) = '\0') #define pstrterminate(d) (((d)[sizeof(pstring)-1]) = '\0') @@ -122,24 +80,12 @@ size_t __unsafe_string_function_usage_here_char__(void); #define wfstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wfstring)) #define wfstrcat(d,s) safe_strcat_w((d),(s),sizeof(wfstring)) -#define push_pstring_base(dest, src, pstring_base) \ - push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE) - -#endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */ - -#define safe_strcpy_base(dest, src, base, size) \ - safe_strcpy(dest, src, size-PTR_DIFF(dest,base)-1) - -/* String copy functions - macro hell below adds 'type checking' (limited, - but the best we can do in C) and may tag with function name/number to - record the last 'clobber region' on that string */ +#endif -#define pstrcpy(d,s) safe_strcpy((d), (s),sizeof(pstring)-1) -#define pstrcat(d,s) safe_strcat((d), (s),sizeof(pstring)-1) -#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1) -#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1) -#define nstrcpy(d,s) safe_strcpy((d), (s),sizeof(nstring)-1) -#define unstrcpy(d,s) safe_strcpy((d), (s),sizeof(unstring)-1) +/* replace some string functions with multi-byte + versions */ +#define strlower(s) strlower_m(s) +#define strupper(s) strupper_m(s) /* the addition of the DEVELOPER checks in safe_strcpy means we must * update a lot of code. To make this a little easier here are some @@ -147,82 +93,7 @@ size_t __unsafe_string_function_usage_here_char__(void); #define pstrcpy_base(dest, src, pstring_base) \ safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1) - -/* Inside the _fn variants of these is a call to clobber_region(), - - * which might destroy the stack on a buggy function. We help the - * debugging process by putting the function and line who last caused - * a clobbering into a static buffer. If the program crashes at - * address 0xf1f1f1f1 then this function is probably, but not - * necessarily, to blame. */ - -/* overmalloc_safe_strcpy: DEPRECATED! Used when you know the - * destination buffer is longer than maxlength, but you don't know how - * long. This is not a good situation, because we can't do the normal - * sanity checks. Don't use in new code! */ - -#define overmalloc_safe_strcpy(dest,src,maxlength) safe_strcpy_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE,dest,src,maxlength) -#define safe_strcpy(dest,src,maxlength) safe_strcpy_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE,dest,src,maxlength) -#define safe_strcat(dest,src,maxlength) safe_strcat_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE,dest,src,maxlength) -#define push_string(base_ptr, dest, src, dest_len, flags) push_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, base_ptr, dest, src, dest_len, flags) -#define pull_string(base_ptr, dest, src, dest_len, src_len, flags) pull_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, base_ptr, dest, src, dest_len, src_len, flags) -#define clistr_push(cli, dest, src, dest_len, flags) clistr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, cli, dest, src, dest_len, flags) -#define clistr_pull(cli, dest, src, dest_len, src_len, flags) clistr_pull_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, cli, dest, src, dest_len, src_len, flags) -#define srvstr_push(base_ptr, dest, src, dest_len, flags) srvstr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, base_ptr, dest, src, dest_len, flags) - -#define alpha_strcpy(dest,src,other_safe_chars,maxlength) alpha_strcpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE,dest,src,other_safe_chars,maxlength) -#define StrnCpy(dest,src,n) StrnCpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE,dest,src,n) - -#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS - -/* if the compiler will optimize out function calls, then use this to tell if we are - have the correct types (this works only where sizeof() returns the size of the buffer, not - the size of the pointer). */ - -#define safe_strcpy_fn2(fn_name, fn_line, d, s, max_len) \ - (CHECK_STRING_SIZE(d, max_len+1) \ - ? __unsafe_string_function_usage_here__() \ - : safe_strcpy_fn(fn_name, fn_line, (d), (s), (max_len))) - -#define safe_strcat_fn2(fn_name, fn_line, d, s, max_len) \ - (CHECK_STRING_SIZE(d, max_len+1) \ - ? __unsafe_string_function_usage_here__() \ - : safe_strcat_fn(fn_name, fn_line, (d), (s), (max_len))) - -#define push_string_fn2(fn_name, fn_line, base_ptr, dest, src, dest_len, flags) \ - (CHECK_STRING_SIZE(dest, dest_len) \ - ? __unsafe_string_function_usage_here_size_t__() \ - : push_string_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, flags)) - -#define pull_string_fn2(fn_name, fn_line, base_ptr, dest, src, dest_len, src_len, flags) \ - (CHECK_STRING_SIZE(dest, dest_len) \ - ? __unsafe_string_function_usage_here_size_t__() \ - : pull_string_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, src_len, flags)) - -#define clistr_push_fn2(fn_name, fn_line, cli, dest, src, dest_len, flags) \ - (CHECK_STRING_SIZE(dest, dest_len) \ - ? __unsafe_string_function_usage_here_size_t__() \ - : clistr_push_fn(fn_name, fn_line, cli, dest, src, dest_len, flags)) - -#define clistr_pull_fn2(fn_name, fn_line, cli, dest, src, dest_len, srclen, flags) \ - (CHECK_STRING_SIZE(dest, dest_len) \ - ? __unsafe_string_function_usage_here_size_t__() \ - : clistr_pull_fn(fn_name, fn_line, cli, dest, src, dest_len, srclen, flags)) - -#define srvstr_push_fn2(fn_name, fn_line, base_ptr, dest, src, dest_len, flags) \ - (CHECK_STRING_SIZE(dest, dest_len) \ - ? __unsafe_string_function_usage_here_size_t__() \ - : srvstr_push_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, flags)) - -#else - -#define safe_strcpy_fn2 safe_strcpy_fn -#define safe_strcat_fn2 safe_strcat_fn -#define push_string_fn2 push_string_fn -#define pull_string_fn2 pull_string_fn -#define clistr_push_fn2 clistr_push_fn -#define clistr_pull_fn2 clistr_pull_fn -#define srvstr_push_fn2 srvstr_push_fn - -#endif +#define push_pstring_base(dest, src, pstring_base) \ + push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE) #endif diff --git a/source/include/samba_linux_quota.h b/source/include/samba_linux_quota.h deleted file mode 100644 index 02b3e5169b1..00000000000 --- a/source/include/samba_linux_quota.h +++ /dev/null @@ -1,336 +0,0 @@ -#ifndef _SAMBA_LINUX_QUOTA_H_ -#define _SAMBA_LINUX_QUOTA_H_ -/* - Unix SMB/CIFS implementation. - Copyright (C) Andrew Tridgell 1994-2002 - - 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. -*/ - -/* - This file is needed because Quota support on Linux has - been broken since Linus kernel 2.4.x. It will only get - better (and this file be removed) when all the distributions - ship a glibc with a working quota.h file. This is very - bad. JRA. - - Original file came from Christoph Hellwig <hch@infradead.org>. - Massaged into one nasty include file (to stop us having to - add multiple files into Samba just for Linux braindamage) - by JRA. -*/ - -#undef QUOTABLOCK_SIZE - -#ifndef _QUOTAIO_LINUX_V1 -#define _QUOTAIO_LINUX_V1 - -/* - * Headerfile for old quotafile format - */ - -#include <sys/types.h> - -#define V1_DQBLK_SIZE_BITS 10 -#define V1_DQBLK_SIZE (1 << V1_DQBLK_SIZE_BITS) /* Size of one quota block in bytes in old format */ - -#define V1_DQOFF(__id) ((loff_t) ((__id) * sizeof(struct v1_disk_dqblk))) - -/* Structure of quota on disk */ -struct v1_disk_dqblk { - u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ - u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ - u_int32_t dqb_curblocks; /* current block count */ - u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ - u_int32_t dqb_isoftlimit; /* preferred limit on inodes */ - u_int32_t dqb_curinodes; /* current # allocated inodes */ - time_t dqb_btime; /* time limit for excessive disk use */ - time_t dqb_itime; /* time limit for excessive files */ -} __attribute__ ((packed)); - -/* Structure used for communication with kernel */ -struct v1_kern_dqblk { - u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ - u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ - u_int32_t dqb_curblocks; /* current block count */ - u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ - u_int32_t dqb_isoftlimit; /* preferred inode limit */ - u_int32_t dqb_curinodes; /* current # allocated inodes */ - time_t dqb_btime; /* time limit for excessive disk use */ - time_t dqb_itime; /* time limit for excessive files */ -}; - -struct v1_dqstats { - u_int32_t lookups; - u_int32_t drops; - u_int32_t reads; - u_int32_t writes; - u_int32_t cache_hits; - u_int32_t allocated_dquots; - u_int32_t free_dquots; - u_int32_t syncs; -}; - -#ifndef Q_V1_GETQUOTA -#define Q_V1_GETQUOTA 0x300 -#endif -#ifndef Q_V1_SETQUOTA -#define Q_V1_SETQUOTA 0x400 -#endif - -#endif /* _QUOTAIO_LINUX_V1 */ - -/* - * - * Header file for disk format of new quotafile format - * - */ - -#ifndef _QUOTAIO_LINUX_V2 -#define _QUOTAIO_LINUX_V2 - -#include <sys/types.h> - -#ifndef _QUOTA_LINUX -#define _QUOTA_LINUX - -#include <sys/types.h> - -typedef u_int32_t qid_t; /* Type in which we store ids in memory */ -typedef u_int64_t qsize_t; /* Type in which we store size limitations */ - -#define MAXQUOTAS 2 -#define USRQUOTA 0 /* element used for user quotas */ -#define GRPQUOTA 1 /* element used for group quotas */ - -/* - * Definitions for the default names of the quotas files. - */ -#define INITQFNAMES { \ - "user", /* USRQUOTA */ \ - "group", /* GRPQUOTA */ \ - "undefined", \ -} - -/* - * Definitions of magics and versions of current quota files - */ -#define INITQMAGICS {\ - 0xd9c01f11, /* USRQUOTA */\ - 0xd9c01927 /* GRPQUOTA */\ -} - -/* Size of blocks in which are counted size limits in generic utility parts */ -#define QUOTABLOCK_BITS 10 -#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) - -/* Conversion routines from and to quota blocks */ -#define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10)) -#define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10)) -#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) - -/* - * Command definitions for the 'quotactl' system call. - * The commands are broken into a main command defined below - * and a subcommand that is used to convey the type of - * quota that is being manipulated (see above). - */ -#define SUBCMDMASK 0x00ff -#define SUBCMDSHIFT 8 -#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) - -#define Q_6_5_QUOTAON 0x0100 /* enable quotas */ -#define Q_6_5_QUOTAOFF 0x0200 /* disable quotas */ -#define Q_6_5_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ - -#define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ -#define Q_QUOTAON 0x800002 /* turn quotas on */ -#define Q_QUOTAOFF 0x800003 /* turn quotas off */ -#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ -#define Q_GETINFO 0x800005 /* get information about quota files */ -#define Q_SETINFO 0x800006 /* set information about quota files */ -#define Q_GETQUOTA 0x800007 /* get user quota structure */ -#define Q_SETQUOTA 0x800008 /* set user quota structure */ - -/* - * Quota structure used for communication with userspace via quotactl - * Following flags are used to specify which fields are valid - */ -#define QIF_BLIMITS 1 -#define QIF_SPACE 2 -#define QIF_ILIMITS 4 -#define QIF_INODES 8 -#define QIF_BTIME 16 -#define QIF_ITIME 32 -#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) -#define QIF_USAGE (QIF_SPACE | QIF_INODES) -#define QIF_TIMES (QIF_BTIME | QIF_ITIME) -#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) - -struct if_dqblk { - u_int64_t dqb_bhardlimit; - u_int64_t dqb_bsoftlimit; - u_int64_t dqb_curspace; - u_int64_t dqb_ihardlimit; - u_int64_t dqb_isoftlimit; - u_int64_t dqb_curinodes; - u_int64_t dqb_btime; - u_int64_t dqb_itime; - u_int32_t dqb_valid; -}; - -/* - * Structure used for setting quota information about file via quotactl - * Following flags are used to specify which fields are valid - */ -#define IIF_BGRACE 1 -#define IIF_IGRACE 2 -#define IIF_FLAGS 4 -#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) - -struct if_dqinfo { - u_int64_t dqi_bgrace; - u_int64_t dqi_igrace; - u_int32_t dqi_flags; - u_int32_t dqi_valid; -}; - -/* Quota format identifiers */ -#define QFMT_VFS_OLD 1 -#define QFMT_VFS_V0 2 - -/* Flags supported by kernel */ -#define V1_DQF_RSQUASH 1 - -/* Ioctl for getting quota size */ -#include <sys/ioctl.h> -#ifndef FIOQSIZE - #if defined(__alpha__) || defined(__powerpc__) || defined(__sh__) || defined(__sparc__) || defined(__sparc64__) - #define FIOQSIZE _IOR('f', 128, loff_t) - #elif defined(__arm__) || defined(__mc68000__) || defined(__s390__) - #define FIOQSIZE 0x545E - #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__ia64__) || defined(__parisc__) || defined(__cris__) || defined(__hppa__) - #define FIOQSIZE 0x5460 - #elif defined(__mips__) || defined(__mips64__) - #define FIOQSIZE 0x6667 - #endif -#endif - -long quotactl __P((int, const char *, qid_t, caddr_t)); - -#endif /* _QUOTA_LINUX */ - -#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */ -#define V2_DQBLKSIZE_BITS 10 -#define V2_DQBLKSIZE (1 << V2_DQBLKSIZE_BITS) /* Size of block with quota structures */ -#define V2_DQTREEOFF 1 /* Offset of tree in file in blOcks */ -#define V2_DQTREEDEPTH 4 /* Depth of quota tree */ -#define V2_DQSTRINBLK ((V2_DQBLKSIZE - sizeof(struct v2_disk_dqdbheader)) / sizeof(struct v2_disk_dqblk)) /* Number of entries in one blocks */ -#define V2_GETIDINDEX(id, depth) (((id) >> ((V2_DQTREEDEPTH-(depth)-1)*8)) & 0xff) -#define V2_GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)(buf)) + sizeof(struct v2_disk_dqdbheader))) -#define INIT_V2_VERSIONS { 0, 0} - -struct v2_disk_dqheader { - u_int32_t dqh_magic; /* Magic number identifying file */ - u_int32_t dqh_version; /* File version */ -} __attribute__ ((packed)); - -/* Flags for version specific files */ -#define V2_DQF_MASK 0x0000 /* Mask for all valid ondisk flags */ - -/* Header with type and version specific information */ -struct v2_disk_dqinfo { - u_int32_t dqi_bgrace; /* Time before block soft limit becomes hard limit */ - u_int32_t dqi_igrace; /* Time before inode soft limit becomes hard limit */ - u_int32_t dqi_flags; /* Flags for quotafile (DQF_*) */ - u_int32_t dqi_blocks; /* Number of blocks in file */ - u_int32_t dqi_free_blk; /* Number of first free block in the list */ - u_int32_t dqi_free_entry; /* Number of block with at least one free entry */ -} __attribute__ ((packed)); - -/* - * Structure of header of block with quota structures. It is padded to 16 bytes so - * there will be space for exactly 18 quota-entries in a block - */ -struct v2_disk_dqdbheader { - u_int32_t dqdh_next_free; /* Number of next block with free entry */ - u_int32_t dqdh_prev_free; /* Number of previous block with free entry */ - u_int16_t dqdh_entries; /* Number of valid entries in block */ - u_int16_t dqdh_pad1; - u_int32_t dqdh_pad2; -} __attribute__ ((packed)); - -/* Structure of quota for one user on disk */ -struct v2_disk_dqblk { - u_int32_t dqb_id; /* id this quota applies to */ - u_int32_t dqb_ihardlimit; /* absolute limit on allocated inodes */ - u_int32_t dqb_isoftlimit; /* preferred inode limit */ - u_int32_t dqb_curinodes; /* current # allocated inodes */ - u_int32_t dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */ - u_int32_t dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */ - u_int64_t dqb_curspace; /* current space occupied (in bytes) */ - u_int64_t dqb_btime; /* time limit for excessive disk use */ - u_int64_t dqb_itime; /* time limit for excessive inode use */ -} __attribute__ ((packed)); - -/* Structure of quota for communication with kernel */ -struct v2_kern_dqblk { - unsigned int dqb_ihardlimit; - unsigned int dqb_isoftlimit; - unsigned int dqb_curinodes; - unsigned int dqb_bhardlimit; - unsigned int dqb_bsoftlimit; - qsize_t dqb_curspace; - time_t dqb_btime; - time_t dqb_itime; -}; - -/* Structure of quotafile info for communication with kernel */ -struct v2_kern_dqinfo { - unsigned int dqi_bgrace; - unsigned int dqi_igrace; - unsigned int dqi_flags; - unsigned int dqi_blocks; - unsigned int dqi_free_blk; - unsigned int dqi_free_entry; -}; - -/* Structure with gathered statistics from kernel */ -struct v2_dqstats { - u_int32_t lookups; - u_int32_t drops; - u_int32_t reads; - u_int32_t writes; - u_int32_t cache_hits; - u_int32_t allocated_dquots; - u_int32_t free_dquots; - u_int32_t syncs; - u_int32_t version; -}; - -#ifndef Q_V2_GETQUOTA -#define Q_V2_GETQUOTA 0x0D00 -#endif -#ifndef Q_V2_SETQUOTA -#define Q_V2_SETQUOTA 0x0E00 -#endif - -#endif /* _QUOTAIO_LINUX_V2 */ - -#ifndef QUOTABLOCK_SIZE -#define QUOTABLOCK_SIZE 1024 -#endif - -#endif /* _SAMBA_LINUX_QUOTA_H_ */ diff --git a/source/include/samba_xfs_quota.h b/source/include/samba_xfs_quota.h deleted file mode 100644 index 1db435064a6..00000000000 --- a/source/include/samba_xfs_quota.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef _SAMBA_LINUX_XFS_H_ -#define _SAMBA_LINUX_XFS_H_ - -#ifndef _QUOTAIO_LINUX_XFS -#define _QUOTAIO_LINUX_XFS - -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ - */ - -#include <linux/types.h> - -#define XQM_CMD(cmd) ( ('X'<<8)+(cmd) ) -#define IS_XQM_CMD(cmd) ( ((int)(cmd)>>8) == 'X' ) - -/* - * Disk quota - quotactl(2) commands for XFS Quota Manager (XQM). - */ -#define Q_XQUOTAON XQM_CMD(0x1) /* enable quota accounting/enforcement */ -#define Q_XQUOTAOFF XQM_CMD(0x2) /* disable quota accounting/enforcement */ -#define Q_XGETQUOTA XQM_CMD(0x3) /* get disk limits & usage */ -#define Q_XSETQLIM XQM_CMD(0x4) /* set disk limits only */ -#define Q_XGETQSTAT XQM_CMD(0x5) /* returns fs_quota_stat_t struct */ -#define Q_XQUOTARM XQM_CMD(0x6) /* free quota files' space */ - -/* - * fs_disk_quota structure: - * - * This contains the current quota information regarding a user/proj/group. - * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of - * 512 bytes. - */ -#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ -typedef struct fs_disk_quota { - u_int8_t d_version; /* version of this structure */ - u_int8_t d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ - u_int16_t d_fieldmask; /* field specifier */ - u_int32_t d_id; /* user, project, or group ID */ - u_int64_t d_blk_hardlimit; /* absolute limit on disk blks */ - u_int64_t d_blk_softlimit; /* preferred limit on disk blks */ - u_int64_t d_ino_hardlimit; /* maximum # allocated inodes */ - u_int64_t d_ino_softlimit; /* preferred inode limit */ - u_int64_t d_bcount; /* # disk blocks owned by the user */ - u_int64_t d_icount; /* # inodes owned by the user */ - int32_t d_itimer; /* zero if within inode limits */ - /* if not, we refuse service */ - int32_t d_btimer; /* similar to above; for disk blocks */ - u_int16_t d_iwarns; /* # warnings issued wrt num inodes */ - u_int16_t d_bwarns; /* # warnings issued wrt disk blocks */ - int32_t d_padding2; /* padding2 - for future use */ - u_int64_t d_rtb_hardlimit; /* absolute limit on realtime blks */ - u_int64_t d_rtb_softlimit; /* preferred limit on RT disk blks */ - u_int64_t d_rtbcount; /* # realtime blocks owned */ - int32_t d_rtbtimer; /* similar to above; for RT disk blks */ - u_int16_t d_rtbwarns; /* # warnings issued wrt RT disk blks */ - int16_t d_padding3; /* padding3 - for future use */ - char d_padding4[8]; /* yet more padding */ -} fs_disk_quota_t; - -/* - * These fields are sent to Q_XSETQLIM to specify fields that need to change. - */ -#define FS_DQ_ISOFT (1<<0) -#define FS_DQ_IHARD (1<<1) -#define FS_DQ_BSOFT (1<<2) -#define FS_DQ_BHARD (1<<3) -#define FS_DQ_RTBSOFT (1<<4) -#define FS_DQ_RTBHARD (1<<5) -#define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ - FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) -/* - * These timers can only be set in super user's dquot. For others, timers are - * automatically started and stopped. Superusers timer values set the limits - * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values - * defined below are used. - * These values also apply only to the d_fieldmask field for Q_XSETQLIM. - */ -#define FS_DQ_BTIMER (1<<6) -#define FS_DQ_ITIMER (1<<7) -#define FS_DQ_RTBTIMER (1<<8) -#define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) - -/* - * The following constants define the default amount of time given a user - * before the soft limits are treated as hard limits (usually resulting - * in an allocation failure). These may be modified by the quotactl(2) - * system call with the Q_XSETQLIM command. - */ -#define DQ_FTIMELIMIT (7 * 24*60*60) /* 1 week */ -#define DQ_BTIMELIMIT (7 * 24*60*60) /* 1 week */ - -/* - * Various flags related to quotactl(2). Only relevant to XFS filesystems. - */ -#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ -#define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ -#define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ -#define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ - -#define XFS_USER_QUOTA (1<<0) /* user quota type */ -#define XFS_PROJ_QUOTA (1<<1) /* (IRIX) project quota type */ -#define XFS_GROUP_QUOTA (1<<2) /* group quota type */ - -/* - * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. - * Provides a centralized way to get meta infomation about the quota subsystem. - * eg. space taken up for user and group quotas, number of dquots currently - * incore. - */ -#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ - -/* - * Some basic infomation about 'quota files'. - */ -typedef struct fs_qfilestat { - u_int64_t qfs_ino; /* inode number */ - u_int64_t qfs_nblks; /* number of BBs 512-byte-blks */ - u_int32_t qfs_nextents; /* number of extents */ -} fs_qfilestat_t; - -typedef struct fs_quota_stat { - u_int8_t qs_version; /* version number for future changes */ - u_int16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ - u_int8_t qs_pad; /* unused */ - fs_qfilestat_t qs_uquota; /* user quota storage information */ - fs_qfilestat_t qs_gquota; /* group quota storage information */ - u_int32_t qs_incoredqs; /* number of dquots incore */ - int32_t qs_btimelimit; /* limit for blks timer */ - int32_t qs_itimelimit; /* limit for inodes timer */ - int32_t qs_rtbtimelimit; /* limit for rt blks timer */ - u_int16_t qs_bwarnlimit; /* limit for num warnings */ - u_int16_t qs_iwarnlimit; /* limit for num warnings */ -} fs_quota_stat_t; - -#endif /* _QUOTAIO_LINUX_XFS */ - -#endif /* _SAMBA_LINUX_XFS_H_ */ diff --git a/source/include/secrets.h b/source/include/secrets.h index 8c393940586..183b29d7a8a 100644 --- a/source/include/secrets.h +++ b/source/include/secrets.h @@ -26,9 +26,7 @@ */ #define SECRETS_MACHINE_ACCT_PASS "SECRETS/$MACHINE.ACC" #define SECRETS_MACHINE_PASSWORD "SECRETS/MACHINE_PASSWORD" -#define SECRETS_MACHINE_LAST_CHANGE_TIME "SECRETS/MACHINE_LAST_CHANGE_TIME" -#define SECRETS_MACHINE_SEC_CHANNEL_TYPE "SECRETS/MACHINE_SEC_CHANNEL_TYPE" -#define SECRETS_MACHINE_TRUST_ACCOUNT_NAME "SECRETS/SECRETS_MACHINE_TRUST_ACCOUNT_NAME" + /* this one is for storing trusted domain account password */ #define SECRETS_DOMTRUST_ACCT_PASS "SECRETS/$DOMTRUST.ACC" @@ -49,13 +47,6 @@ #define SECRETS_AUTH_DOMAIN "SECRETS/AUTH_DOMAIN" #define SECRETS_AUTH_PASSWORD "SECRETS/AUTH_PASSWORD" -/* Trust password type flags */ -#define PASS_MACHINE_TRUST_NT 0x0001 -#define PASS_SERVER_TRUST_NT 0x0002 -#define PASS_DOMAIN_TRUST_NT 0x0004 -#define PASS_MACHINE_TRUST_ADS 0x0008 -#define PASS_DOMAIN_TRUST_ADS 0x0010 - /* structure for storing machine account password (ie. when samba server is member of a domain */ struct machine_acct_pass { @@ -66,14 +57,14 @@ struct machine_acct_pass { /* * storage structure for trusted domain */ -typedef struct trusted_dom_pass { +struct trusted_dom_pass { size_t uni_name_len; smb_ucs2_t uni_name[32]; /* unicode domain name */ size_t pass_len; fstring pass; /* trust relationship's password */ time_t mod_time; DOM_SID domain_sid; /* remote domain's sid */ -} TRUSTED_DOM_PASS; +}; /* * trusted domain entry/entries returned by secrets_get_trusted_domains @@ -84,22 +75,5 @@ typedef struct trustdom { DOM_SID sid; } TRUSTDOM; -/* - * Format of an OpenAFS keyfile - */ - -#define SECRETS_AFS_MAXKEYS 8 - -struct afs_key { - uint32 kvno; - char key[8]; -}; - -struct afs_keyfile { - uint32 nkeys; - struct afs_key entry[SECRETS_AFS_MAXKEYS]; -}; - -#define SECRETS_AFS_KEYFILE "SECRETS/AFS_KEYFILE" #endif /* _SECRETS_H */ diff --git a/source/include/session.h b/source/include/session.h deleted file mode 100644 index f613afee09a..00000000000 --- a/source/include/session.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Unix SMB/CIFS implementation. - session handling for recording currently vailid vuids - Copyright (C) tridge@samba.org 2001 - Copyright (C) Andew Bartlett <abartlet@samba.org> 2001 - - 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. -*/ - -/* a "session" is claimed when we do a SessionSetupX operation - and is yielded when the corresponding vuid is destroyed. - - sessions are used to populate utmp and PAM session structures -*/ - -struct sessionid { - uid_t uid; - gid_t gid; - fstring username; - fstring hostname; - fstring netbios_name; - fstring remote_machine; - fstring id_str; - uint32 id_num; - uint32 pid; - fstring ip_addr; -}; - diff --git a/source/include/smb.h b/source/include/smb.h index 6de50c8afa1..e5e7e26444a 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -27,35 +27,21 @@ #ifndef _SMB_H #define _SMB_H -#if defined(LARGE_SMB_OFF_T) -#define BUFFER_SIZE (128*1024) -#else /* no large readwrite possible */ -#define BUFFER_SIZE (0xFFFF) -#endif - -#define SAFETY_MARGIN 1024 -#define LARGE_WRITEX_HDR_SIZE 65 - #define NMB_PORT 137 #define DGRAM_PORT 138 #define SMB_PORT1 445 #define SMB_PORT2 139 #define SMB_PORTS "445 139" -#define Undefined (-1) #define False (0) #define True (1) #define Auto (2) -#define Required (3) #ifndef _BOOL typedef int BOOL; #define _BOOL /* So we don't typedef BOOL again in vfs.h */ #endif -/* limiting size of ipc replies */ -#define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024)) - #define SIZEOFWORD 2 #ifndef DEF_CREATE_MASK @@ -68,30 +54,20 @@ typedef int BOOL; #define STR_ASCII 4 #define STR_UNICODE 8 #define STR_NOALIGN 16 -#define STR_TERMINATE_ASCII 128 - -/* how long to wait for secondary SMB packets (milli-seconds) */ -#define SMB_SECONDARY_WAIT (60*1000) +#define STR_NO_RANGE_CHECK 32 +#define STR_LEN8BIT 64 +#define STR_TERMINATE_ASCII 128 /* only terminate if ascii */ +#define STR_LEN_NOTERM 256 /* the length field is the unterminated length */ /* Debugging stuff */ #include "debug.h" -/* this defines the error codes that receive_smb can put in smb_read_error */ -#define READ_TIMEOUT 1 -#define READ_EOF 2 -#define READ_ERROR 3 -#define WRITE_ERROR 4 /* This error code can go into the client smb_rw_error. */ -#define READ_BAD_SIG 5 - -#define DIR_STRUCT_SIZE 43 - -/* these define the attribute byte as seen by DOS */ -#define aRONLY (1L<<0) /* 0x01 */ -#define aHIDDEN (1L<<1) /* 0x02 */ -#define aSYSTEM (1L<<2) /* 0x04 */ -#define aVOLID (1L<<3) /* 0x08 */ -#define aDIR (1L<<4) /* 0x10 */ -#define aARCH (1L<<5) /* 0x20 */ +/* types of socket errors */ +enum socket_error {SOCKET_READ_TIMEOUT, + SOCKET_READ_EOF, + SOCKET_READ_ERROR, + SOCKET_WRITE_ERROR, + SOCKET_READ_BAD_SIG}; /* deny modes */ #define DENY_DOS 0 @@ -107,45 +83,139 @@ typedef int BOOL; #define DOS_OPEN_RDWR 2 #define DOS_OPEN_FCB 0xF -/* define shifts and masks for share and open modes. */ -#define OPEN_MODE_MASK 0xF -#define SHARE_MODE_SHIFT 4 -#define SHARE_MODE_MASK 0x7 -#define GET_OPEN_MODE(x) ((x) & OPEN_MODE_MASK) -#define SET_OPEN_MODE(x) ((x) & OPEN_MODE_MASK) -#define GET_DENY_MODE(x) (((x)>>SHARE_MODE_SHIFT) & SHARE_MODE_MASK) -#define SET_DENY_MODE(x) (((x) & SHARE_MODE_MASK) <<SHARE_MODE_SHIFT) - -/* Sync on open file (not sure if used anymore... ?) */ -#define FILE_SYNC_OPENMODE (1<<14) -#define GET_FILE_SYNC_OPENMODE(x) (((x) & FILE_SYNC_OPENMODE) ? True : False) -/* allow delete on open file mode (used by NT SMB's). */ -#define ALLOW_SHARE_DELETE (1<<15) -#define GET_ALLOW_SHARE_DELETE(x) (((x) & ALLOW_SHARE_DELETE) ? True : False) -#define SET_ALLOW_SHARE_DELETE(x) ((x) ? ALLOW_SHARE_DELETE : 0) +/**********************************/ +/* SMBopen field definitions */ +#define OPEN_FLAGS_DENY_MASK 0x70 +#define OPEN_FLAGS_DENY_DOS 0x00 +#define OPEN_FLAGS_DENY_ALL 0x10 +#define OPEN_FLAGS_DENY_WRITE 0x20 +#define OPEN_FLAGS_DENY_READ 0x30 +#define OPEN_FLAGS_DENY_NONE 0x40 + +#define OPEN_FLAGS_MODE_MASK 0x0F +#define OPEN_FLAGS_OPEN_READ 0 +#define OPEN_FLAGS_OPEN_WRITE 1 +#define OPEN_FLAGS_OPEN_RDWR 2 +#define OPEN_FLAGS_FCB 0xFF + + +/**********************************/ +/* SMBopenX field definitions */ + +/* OpenX Flags field. */ +#define OPENX_FLAGS_ADDITIONAL_INFO 0x01 +#define OPENX_FLAGS_REQUEST_OPLOCK 0x02 +#define OPENX_FLAGS_REQUEST_BATCH_OPLOCK 0x04 +#define OPENX_FLAGS_EA_LEN 0x08 +#define OPENX_FLAGS_EXTENDED_RETURN 0x10 + +/* desired access (open_mode), split info 4 4-bit nibbles */ +#define OPENX_MODE_ACCESS_MASK 0x000F +#define OPENX_MODE_ACCESS_READ 0x0000 +#define OPENX_MODE_ACCESS_WRITE 0x0001 +#define OPENX_MODE_ACCESS_RDWR 0x0002 +#define OPENX_MODE_ACCESS_EXEC 0x0003 +#define OPENX_MODE_ACCESS_FCB 0x000F + +#define OPENX_MODE_DENY_SHIFT 4 +#define OPENX_MODE_DENY_MASK (0xF << OPENX_MODE_DENY_SHIFT) +#define OPENX_MODE_DENY_DOS (DENY_DOS << OPENX_MODE_DENY_SHIFT) +#define OPENX_MODE_DENY_ALL (DENY_ALL << OPENX_MODE_DENY_SHIFT) +#define OPENX_MODE_DENY_WRITE (DENY_WRITE << OPENX_MODE_DENY_SHIFT) +#define OPENX_MODE_DENY_READ (DENY_READ << OPENX_MODE_DENY_SHIFT) +#define OPENX_MODE_DENY_NONE (DENY_NONE << OPENX_MODE_DENY_SHIFT) +#define OPENX_MODE_DENY_FCB (0xF << OPENX_MODE_DENY_SHIFT) + +#define OPENX_MODE_LOCALITY_MASK 0x0F00 /* what does this do? */ + +#define OPENX_MODE_NO_CACHE 0x1000 +#define OPENX_MODE_WRITE_THRU 0x4000 + +/* open function values */ +#define OPENX_OPEN_FUNC_MASK 0x3 +#define OPENX_OPEN_FUNC_FAIL 0x0 +#define OPENX_OPEN_FUNC_OPEN 0x1 +#define OPENX_OPEN_FUNC_TRUNC 0x2 -/* delete on close flag (used by NT SMB's). */ -#define DELETE_ON_CLOSE_FLAG (1<<16) -#define GET_DELETE_ON_CLOSE_FLAG(x) (((x) & DELETE_ON_CLOSE_FLAG) ? True : False) -#define SET_DELETE_ON_CLOSE_FLAG(x) ((x) ? DELETE_ON_CLOSE_FLAG : 0) +/* The above can be OR'ed with... */ +#define OPENX_OPEN_FUNC_CREATE 0x10 + +/* openx action in reply */ +#define OPENX_ACTION_EXISTED 1 +#define OPENX_ACTION_CREATED 2 +#define OPENX_ACTION_TRUNCATED 3 + + +/**********************************/ +/* SMBntcreateX field definitions */ + +/* ntcreatex flags field. */ +#define NTCREATEX_FLAGS_REQUEST_OPLOCK 0x02 +#define NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK 0x04 +#define NTCREATEX_FLAGS_OPEN_DIRECTORY 0x08 +#define NTCREATEX_FLAGS_EXTENDED 0x10 + +/* the ntcreatex access_mask field + this is split into 4 pieces + AAAABBBBCCCCCCCCDDDDDDDDDDDDDDDD + A -> GENERIC_RIGHT_* + B -> SEC_RIGHT_* + C -> STD_RIGHT_* + D -> SA_RIGHT_* + + which set of SA_RIGHT_* bits is applicable depends on the type + of object. +*/ -/* open disposition values */ -#define FILE_EXISTS_FAIL 0 -#define FILE_EXISTS_OPEN 1 -#define FILE_EXISTS_TRUNCATE 2 -/* mask for open disposition. */ -#define FILE_OPEN_MASK 0x3 -#define GET_FILE_OPEN_DISPOSITION(x) ((x) & FILE_OPEN_MASK) -#define SET_FILE_OPEN_DISPOSITION(x) ((x) & FILE_OPEN_MASK) +/* ntcreatex share_access field */ +#define NTCREATEX_SHARE_ACCESS_NONE 0 +#define NTCREATEX_SHARE_ACCESS_READ 1 +#define NTCREATEX_SHARE_ACCESS_WRITE 2 +#define NTCREATEX_SHARE_ACCESS_DELETE 4 + +/* ntcreatex open_disposition field */ +#define NTCREATEX_DISP_SUPERSEDE 0 /* supersede existing file (if it exists) */ +#define NTCREATEX_DISP_OPEN 1 /* if file exists open it, else fail */ +#define NTCREATEX_DISP_CREATE 2 /* if file exists fail, else create it */ +#define NTCREATEX_DISP_OPEN_IF 3 /* if file exists open it, else create it */ +#define NTCREATEX_DISP_OVERWRITE 4 /* if exists overwrite, else fail */ +#define NTCREATEX_DISP_OVERWRITE_IF 5 /* if exists overwrite, else create */ + +/* ntcreatex create_options field */ +#define NTCREATEX_OPTIONS_DIRECTORY 0x0001 +#define NTCREATEX_OPTIONS_WRITE_THROUGH 0x0002 +#define NTCREATEX_OPTIONS_SEQUENTIAL_ONLY 0x0004 +#define NTCREATEX_OPTIONS_SYNC_ALERT 0x0010 +#define NTCREATEX_OPTIONS_ASYNC_ALERT 0x0020 +#define NTCREATEX_OPTIONS_NON_DIRECTORY_FILE 0x0040 +#define NTCREATEX_OPTIONS_NO_EA_KNOWLEDGE 0x0200 +#define NTCREATEX_OPTIONS_EIGHT_DOT_THREE_ONLY 0x0400 +#define NTCREATEX_OPTIONS_RANDOM_ACCESS 0x0800 +#define NTCREATEX_OPTIONS_DELETE_ON_CLOSE 0x1000 +#define NTCREATEX_OPTIONS_OPEN_BY_FILE_ID 0x2000 + +/* ntcreatex impersonation field */ +#define NTCREATEX_IMPERSONATION_ANONYMOUS 0 +#define NTCREATEX_IMPERSONATION_IDENTIFICATION 1 +#define NTCREATEX_IMPERSONATION_IMPERSONATION 2 +#define NTCREATEX_IMPERSONATION_DELEGATION 3 + +/* ntcreatex security flags bit field */ +#define NTCREATEX_SECURITY_DYNAMIC 1 +#define NTCREATEX_SECURITY_ALL 2 + +/* ntcreatex create_action in reply */ +#define NTCREATEX_ACTION_EXISTED 1 +#define NTCREATEX_ACTION_CREATED 2 +#define NTCREATEX_ACTION_TRUNCATED 3 +/* the value 5 can also be returned when you try to create a directory with + incorrect parameters - what does it mean? maybe created temporary file? */ +#define NTCREATEX_ACTION_UNKNOWN 5 -/* The above can be OR'ed with... */ -#define FILE_CREATE_IF_NOT_EXIST 0x10 -#define FILE_FAIL_IF_NOT_EXIST 0 -#define GET_FILE_CREATE_DISPOSITION(x) ((x) & (FILE_CREATE_IF_NOT_EXIST|FILE_FAIL_IF_NOT_EXIST)) /* share types */ #define STYPE_DISKTREE 0 /* Disk drive */ @@ -156,11 +226,6 @@ typedef int BOOL; #include "doserr.h" -typedef union unid_t { - uid_t uid; - gid_t gid; -} unid_t; - /* * SMB UCS2 (16-bit unicode) internal type. */ @@ -180,47 +245,6 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; /* turn a 7 bit character into a ucs2 character */ #define UCS2_CHAR(c) ((c) << UCS2_SHIFT) -/* pipe string names */ -#define PIPE_LANMAN "\\PIPE\\LANMAN" -#define PIPE_SRVSVC "\\PIPE\\srvsvc" -#define PIPE_SAMR "\\PIPE\\samr" -#define PIPE_WINREG "\\PIPE\\winreg" -#define PIPE_WKSSVC "\\PIPE\\wkssvc" -#define PIPE_NETLOGON "\\PIPE\\NETLOGON" -#define PIPE_NTLSA "\\PIPE\\ntlsa" -#define PIPE_NTSVCS "\\PIPE\\ntsvcs" -#define PIPE_LSASS "\\PIPE\\lsass" -#define PIPE_LSARPC "\\PIPE\\lsarpc" -#define PIPE_SPOOLSS "\\PIPE\\spoolss" -#define PIPE_NETDFS "\\PIPE\\netdfs" -#define PIPE_ECHO "\\PIPE\\rpcecho" -#define PIPE_SHUTDOWN "\\PIPE\\initshutdown" -#define PIPE_EPM "\\PIPE\\epmapper" - -#define PIPE_NETLOGON_PLAIN "\\NETLOGON" - -#define PI_LSARPC 0 -#define PI_LSARPC_DS 1 -#define PI_SAMR 2 -#define PI_NETLOGON 3 -#define PI_SRVSVC 4 -#define PI_WKSSVC 5 -#define PI_WINREG 6 -#define PI_SPOOLSS 7 -#define PI_NETDFS 8 -#define PI_ECHO 9 -#define PI_SHUTDOWN 10 -#define PI_EPM 11 -#define PI_MAX_PIPES 12 - -/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ -typedef struct nttime_info -{ - uint32 low; - uint32 high; -} NTTIME; - - /* Allowable account control bits */ #define ACB_DISABLED 0x0001 /* 1 = User account disabled */ #define ACB_HOMDIRREQ 0x0002 /* 1 = Home directory required */ @@ -236,33 +260,22 @@ typedef struct nttime_info #define MAX_HOURS_LEN 32 -/* - * window during which we must talk to the PDC to avoid - * sam sync delays; expressed in seconds (15 minutes is the - * default period for SAM replication under Windows NT 4.0 - */ -#define SAM_SYNC_WINDOW 900 - - #ifndef MAXSUBAUTHS #define MAXSUBAUTHS 15 /* max sub authorities in a SID */ #endif -#define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4))) - /* SID Types */ enum SID_NAME_USE { - SID_NAME_USE_NONE = 0, + SID_NAME_USE_NONE = 0,/* NOTUSED */ SID_NAME_USER = 1, /* user */ - SID_NAME_DOM_GRP, /* domain group */ - SID_NAME_DOMAIN, /* domain sid */ - SID_NAME_ALIAS, /* local group */ - SID_NAME_WKN_GRP, /* well-known group */ - SID_NAME_DELETED, /* deleted account: needed for c2 rating */ - SID_NAME_INVALID, /* invalid account */ - SID_NAME_UNKNOWN, /* unknown sid type */ - SID_NAME_COMPUTER /* sid for a computer */ + SID_NAME_DOM_GRP = 2, /* domain group */ + SID_NAME_DOMAIN = 3, /* domain: don't know what this is */ + SID_NAME_ALIAS = 4, /* local group */ + SID_NAME_WKN_GRP = 5, /* well-known group */ + SID_NAME_DELETED = 6, /* deleted account: needed for c2 rating */ + SID_NAME_INVALID = 7, /* invalid account */ + SID_NAME_UNKNOWN = 8 /* oops. */ }; /** @@ -298,269 +311,37 @@ typedef struct sid_info #define PRIMARY_USER_SID_INDEX 0 #define PRIMARY_GROUP_SID_INDEX 1 -typedef struct _nt_user_token { +typedef struct nt_user_token { size_t num_sids; DOM_SID *user_sids; } NT_USER_TOKEN; -/*** query a local group, get a list of these: shows who is in that group ***/ - -/* local group member info */ -typedef struct local_grp_member_info -{ - DOM_SID sid ; /* matches with name */ - uint8 sid_use; /* usr=1 grp=2 dom=3 alias=4 wkng=5 del=6 inv=7 unk=8 */ - fstring name ; /* matches with sid: must be of the form "DOMAIN\account" */ - -} LOCAL_GRP_MEMBER; - -/* enumerate these to get list of local groups */ - -/* local group info */ -typedef struct local_grp_info -{ - fstring name; - fstring comment; - -} LOCAL_GRP; - -/*** enumerate these to get list of domain groups ***/ - -/* domain group member info */ -typedef struct domain_grp_info -{ - fstring name; - fstring comment; - uint32 rid; /* group rid */ - uint8 attr; /* attributes forced to be set to 0x7: SE_GROUP_xxx */ - -} DOMAIN_GRP; - -/*** query a domain group, get a list of these: shows who is in that group ***/ - -/* domain group info */ -typedef struct domain_grp_member_info -{ - fstring name; - uint8 attr; /* attributes forced to be set to 0x7: SE_GROUP_xxx */ - -} DOMAIN_GRP_MEMBER; - /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ typedef struct time_info { uint32 time; } UTIME; -/* Structure used when SMBwritebmpx is active */ -typedef struct -{ - size_t wr_total_written; /* So we know when to discard this */ - int32 wr_timeout; - int32 wr_errclass; - int32 wr_error; /* Cached errors */ - BOOL wr_mode; /* write through mode) */ - BOOL wr_discard; /* discard all further data */ -} write_bmpx_struct; - -typedef struct write_cache -{ - SMB_OFF_T file_size; - SMB_OFF_T offset; - size_t alloc_size; - size_t data_size; - char *data; -} write_cache; - -typedef struct -{ - smb_ucs2_t *origname; - smb_ucs2_t *filename; - SMB_STRUCT_STAT *statinfo; -} smb_filename; - -#include "fake_file.h" - -typedef struct files_struct -{ - struct files_struct *next, *prev; - int fnum; - struct connection_struct *conn; - int fd; - uint16 rap_print_jobid; - SMB_DEV_T dev; - SMB_INO_T inode; - BOOL delete_on_close; - SMB_OFF_T pos; - SMB_BIG_UINT size; - SMB_BIG_UINT initial_allocation_size; /* Faked up initial allocation on disk. */ - SMB_BIG_UINT position_information; - mode_t mode; - uint16 file_pid; - uint16 vuid; - write_bmpx_struct *wbmpx_ptr; - write_cache *wcp; - struct timeval open_time; - int share_mode; - uint32 desired_access; - time_t pending_modtime; - int oplock_type; - int sent_oplock_break; - unsigned long file_id; - BOOL can_lock; - BOOL can_read; - BOOL can_write; - BOOL print_file; - BOOL modified; - BOOL is_directory; - BOOL is_stat; - BOOL directory_delete_on_close; - char *fsp_name; - FAKE_FILE_HANDLE *fake_file_handle; -} files_struct; - -#include "ntquotas.h" -#include "sysquotas.h" - /* used to hold an arbitrary blob of data */ -typedef struct data_blob -{ +typedef struct data_blob { uint8 *data; size_t length; void (*free)(struct data_blob *data_blob); } DATA_BLOB; -/* - * Structure used to keep directory state information around. - * Used in NT change-notify code. - */ - -typedef struct -{ - time_t modify_time; - time_t status_time; -} dir_status_struct; - -struct vuid_cache_entry -{ - uint16 vuid; - BOOL read_only; - BOOL admin_user; -}; - -struct vuid_cache -{ - unsigned int entries; - struct vuid_cache_entry array[VUID_CACHE_SIZE]; -}; - -typedef struct -{ - char *name; - BOOL is_wild; -} name_compare_entry; - -/* Include VFS stuff */ - -#include "smb_acls.h" -#include "vfs.h" - -typedef struct connection_struct -{ - struct connection_struct *next, *prev; - TALLOC_CTX *mem_ctx; - unsigned cnum; /* an index passed over the wire */ - int service; - BOOL force_user; - BOOL force_group; - struct vuid_cache vuid_cache; - void *dirptr; - BOOL printer; - BOOL ipc; - BOOL read_only; /* Attributes for the current user of the share. */ - BOOL admin_user; /* Attributes for the current user of the share. */ - char *dirpath; - char *connectpath; - char *origpath; - - struct vfs_ops vfs; /* Filesystem operations */ - struct vfs_ops vfs_opaque; /* OPAQUE Filesystem operations */ - struct vfs_handle_struct *vfs_handles; /* for the new plugins */ - - char *user; /* name of user who *opened* this connection */ - uid_t uid; /* uid of user who *opened* this connection */ - gid_t gid; /* gid of user who *opened* this connection */ - char client_address[18]; /* String version of client IP address. */ - - uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ - - /* following groups stuff added by ih */ - - /* This groups info is valid for the user that *opened* the connection */ - int ngroups; - gid_t *groups; - NT_USER_TOKEN *nt_user_token; - PRIVILEGE_SET *privs; - - time_t lastused; - BOOL used; - int num_files_open; - name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */ - name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */ - name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */ - -} connection_struct; - -struct current_user -{ - connection_struct *conn; - uint16 vuid; - uid_t uid; - gid_t gid; - int ngroups; - gid_t *groups; - NT_USER_TOKEN *nt_user_token; - PRIVILEGE_SET *privs; -}; - -/* Defines for the sent_oplock_break field above. */ -#define NO_BREAK_SENT 0 -#define EXCLUSIVE_BREAK_SENT 1 -#define LEVEL_II_BREAK_SENT 2 +#include "enums.h" +#include "events.h" +#include "librpc/gen_ndr/ndr_misc.h" +#include "smb_interfaces.h" +#include "librpc/ndr/libndr.h" -typedef struct { +typedef struct userdom_struct { fstring smb_name; /* user name from the client */ fstring unix_name; /* unix user name of a validated user */ fstring full_name; /* to store full name (such as "Joe Bloggs") from gecos field of password file */ fstring domain; /* domain that the client specified */ } userdom_struct; -/* Extra fields above "LPQ_PRINTING" are used to map extra NT status codes. */ - -enum {LPQ_QUEUED=0,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING,LPQ_ERROR,LPQ_DELETING, - LPQ_OFFLINE,LPQ_PAPEROUT,LPQ_PRINTED,LPQ_DELETED,LPQ_BLOCKED,LPQ_USER_INTERVENTION}; - -typedef struct _print_queue_struct -{ - int job; /* normally the SMB jobid -- see note in - printing.c:traverse_fn_delete() */ - int size; - int page_count; - int status; - int priority; - time_t time; - fstring fs_user; - fstring fs_file; -} print_queue_struct; - -enum {LPSTAT_OK, LPSTAT_STOPPED, LPSTAT_ERROR}; - -typedef struct -{ - fstring message; - int qcount; - int status; -} print_status_struct; /* used for server information: client, nameserv and ipc */ struct server_info_struct @@ -606,6 +387,122 @@ typedef struct { #define LM_HASH_LEN 16 /* + * bit flags representing initialized fields in SAM_ACCOUNT + */ +enum pdb_elements { + PDB_UNINIT, + PDB_UID, + PDB_GID, + PDB_SMBHOME, + PDB_PROFILE, + PDB_DRIVE, + PDB_LOGONSCRIPT, + PDB_LOGONTIME, + PDB_LOGOFFTIME, + PDB_KICKOFFTIME, + PDB_CANCHANGETIME, + PDB_MUSTCHANGETIME, + PDB_PLAINTEXT_PW, + PDB_USERNAME, + PDB_FULLNAME, + PDB_DOMAIN, + PDB_NTUSERNAME, + PDB_HOURSLEN, + PDB_LOGONDIVS, + PDB_USERSID, + PDB_GROUPSID, + PDB_ACCTCTRL, + PDB_PASSLASTSET, + PDB_UNIXHOMEDIR, + PDB_ACCTDESC, + PDB_WORKSTATIONS, + PDB_UNKNOWNSTR, + PDB_MUNGEDDIAL, + PDB_HOURS, + PDB_UNKNOWN3, + PDB_UNKNOWN5, + PDB_UNKNOWN6, + PDB_LMPASSWD, + PDB_NTPASSWD, + + /* this must be the last element */ + PDB_COUNT, +}; + +enum pdb_value_state { + PDB_DEFAULT=0, + PDB_SET, + PDB_CHANGED +}; + +#define IS_SAM_UNIX_USER(x) \ + (( pdb_get_init_flags(x, PDB_UID) != PDB_DEFAULT ) \ + && ( pdb_get_init_flags(x,PDB_GID) != PDB_DEFAULT )) + +#define IS_SAM_SET(x, flag) (pdb_get_init_flags(x, flag) == PDB_SET) +#define IS_SAM_CHANGED(x, flag) (pdb_get_init_flags(x, flag) == PDB_CHANGED) +#define IS_SAM_DEFAULT(x, flag) (pdb_get_init_flags(x, flag) == PDB_DEFAULT) + +typedef struct sam_passwd +{ + TALLOC_CTX *mem_ctx; + + void (*free_fn)(struct sam_passwd **); + + struct pdb_methods *methods; + + struct user_data { + /* initiailization flags */ + struct bitmap *change_flags; + struct bitmap *set_flags; + + time_t logon_time; /* logon time */ + time_t logoff_time; /* logoff time */ + time_t kickoff_time; /* kickoff time */ + time_t pass_last_set_time; /* password last set time */ + time_t pass_can_change_time; /* password can change time */ + time_t pass_must_change_time; /* password must change time */ + + const char * username; /* UNIX username string */ + const char * domain; /* Windows Domain name */ + const char * nt_username; /* Windows username string */ + const char * full_name; /* user's full name string */ + const char * unix_home_dir; /* UNIX home directory string */ + const char * home_dir; /* home directory string */ + const char * dir_drive; /* home directory drive string */ + const char * logon_script; /* logon script string */ + const char * profile_path; /* profile path string */ + const char * acct_desc ; /* user description string */ + const char * workstations; /* login from workstations string */ + const char * unknown_str ; /* don't know what this is, yet. */ + const char * munged_dial ; /* munged path name and dial-back tel number */ + + uid_t uid; /* this is a unix uid_t */ + gid_t gid; /* this is a unix gid_t */ + DOM_SID user_sid; /* Primary User SID */ + DOM_SID group_sid; /* Primary Group SID */ + + DATA_BLOB lm_pw; /* .data is Null if no password */ + DATA_BLOB nt_pw; /* .data is Null if no password */ + char* plaintext_pw; /* is Null if not available */ + + uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ + uint32 unknown_3; /* 0x00ff ffff */ + + uint16 logon_divs; /* 168 - number of hours in a week */ + uint32 hours_len; /* normally 21 bytes */ + uint8 hours[MAX_HOURS_LEN]; + + uint32 unknown_5; /* 0x0002 0000 */ + uint32 unknown_6; /* 0x0000 04ec */ + } private; + + /* Lets see if the remaining code can get the hint that you + are meant to use the pdb_...() functions. */ + +} SAM_ACCOUNT; + +/* * Flags for account policy. */ #define AP_MIN_PASSWORD_LEN 1 @@ -654,30 +551,11 @@ struct connections_data { uint32 bcast_msg_flags; }; - -/* key and data records in the tdb locking database */ -struct locking_key { - SMB_DEV_T dev; - SMB_INO_T inode; -}; - -struct locking_data { - union { - int num_share_mode_entries; - share_mode_entry dummy; /* Needed for alignment. */ - } u; - /* the following two entries are implicit - share_mode_entry modes[num_share_mode_entries]; - char file_name[]; - */ -}; - - /* the following are used by loadparm for option lists */ typedef enum { P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, - P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP + P_STRING,P_USTRING,P_ENUM,P_SEP } parm_type; typedef enum @@ -685,22 +563,11 @@ typedef enum P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE } parm_class; -/* passed to br lock code */ -enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_LOCK}; - struct enum_list { int value; const char *name; }; -#define BRLOCK_FN_CAST() \ - void (*)(SMB_DEV_T dev, SMB_INO_T ino, int 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, \ - enum brl_type lock_type, \ - br_off start, br_off size) struct parm_struct { const char *label; @@ -724,59 +591,53 @@ struct bitmap { unsigned int n; }; -/* The following flags are used in SWAT */ -#define FLAG_BASIC 0x0001 /* Display only in BASIC view */ +#define FLAG_BASIC 0x0001 /* fundamental options */ #define FLAG_SHARE 0x0002 /* file sharing options */ #define FLAG_PRINT 0x0004 /* printing options */ #define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */ #define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */ -#define FLAG_ADVANCED 0x0020 /* Parameters that will be visible in advanced view */ -#define FLAG_DEVELOPER 0x0040 /* No longer used */ +#define FLAG_ADVANCED 0x0020 /* Parameters that the wizard will operate on */ +#define FLAG_DEVELOPER 0x0040 /* Parameters that the wizard will operate on */ #define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */ #define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */ #define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */ +#define FLAG_CMDLINE 0x8000 /* this option was set from the command line */ #ifndef LOCKING_VERSION #define LOCKING_VERSION 4 #endif /* LOCKING_VERSION */ -/* the basic packet size, assuming no words or bytes */ -#define smb_size 39 - -/* offsets into message for common items */ -#define smb_com 8 -#define smb_rcls 9 -#define smb_reh 10 -#define smb_err 11 -#define smb_flg 13 -#define smb_flg2 14 -#define smb_pidhigh 16 -#define smb_ss_field 18 -#define smb_tid 28 -#define smb_pid 30 -#define smb_uid 32 -#define smb_mid 34 -#define smb_wct 36 -#define smb_vwv 37 -#define smb_vwv0 37 -#define smb_vwv1 39 -#define smb_vwv2 41 -#define smb_vwv3 43 -#define smb_vwv4 45 -#define smb_vwv5 47 -#define smb_vwv6 49 -#define smb_vwv7 51 -#define smb_vwv8 53 -#define smb_vwv9 55 -#define smb_vwv10 57 -#define smb_vwv11 59 -#define smb_vwv12 61 -#define smb_vwv13 63 -#define smb_vwv14 65 -#define smb_vwv15 67 -#define smb_vwv16 69 -#define smb_vwv17 71 +/* the basic packet size, assuming no words or bytes. Does not include the NBT header */ +#define MIN_SMB_SIZE 35 + +/* when using NBT encapsulation every packet has a 4 byte header */ +#define NBT_HDR_SIZE 4 + +/* offsets into message header for common items - NOTE: These have + changed from being offsets from the base of the NBT packet to the base of the SMB packet. + this has reduced all these values by 4 +*/ +#define HDR_COM 4 +#define HDR_RCLS 5 +#define HDR_REH 6 +#define HDR_ERR 7 +#define HDR_FLG 9 +#define HDR_FLG2 10 +#define HDR_PIDHIGH 12 +#define HDR_SS_FIELD 14 +#define HDR_TID 24 +#define HDR_PID 26 +#define HDR_UID 28 +#define HDR_MID 30 +#define HDR_WCT 32 +#define HDR_VWV 33 + + +/* types of buffers in core SMB protocol */ +#define SMB_DATA_BLOCK 0x1 +#define SMB_ASCII4 0x4 + /* flag defines. CIFS spec 3.1.1 */ #define FLAG_SUPPORT_LOCKREAD 0x01 @@ -829,7 +690,7 @@ struct bitmap { /* Core+ protocol */ #define SMBlockread 0x13 /* Lock a range and read */ -#define SMBwriteunlock 0x14 /* Unlock a range then write */ +#define SMBwriteunlock 0x14 /* write then range then unlock it */ #define SMBreadbraw 0x1a /* read a block of data with no smb header */ #define SMBwritebraw 0x1d /* write a block of data with no smb header */ #define SMBwritec 0x20 /* secondary write request */ @@ -877,30 +738,14 @@ struct bitmap { #define SMBntcancel 0xA4 /* NT cancel */ #define SMBntrename 0xA5 /* NT rename */ +/* used to indicate end of chain */ +#define SMB_CHAIN_NONE 0xFF + /* These are the trans subcommands */ #define TRANSACT_SETNAMEDPIPEHANDLESTATE 0x01 #define TRANSACT_DCERPCCMD 0x26 #define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53 -/* These are the TRANS2 sub commands */ -#define TRANSACT2_OPEN 0x00 -#define TRANSACT2_FINDFIRST 0x01 -#define TRANSACT2_FINDNEXT 0x02 -#define TRANSACT2_QFSINFO 0x03 -#define TRANSACT2_SETFSINFO 0x04 -#define TRANSACT2_QPATHINFO 0x05 -#define TRANSACT2_SETPATHINFO 0x06 -#define TRANSACT2_QFILEINFO 0x07 -#define TRANSACT2_SETFILEINFO 0x08 -#define TRANSACT2_FSCTL 0x09 -#define TRANSACT2_IOCTL 0x0A -#define TRANSACT2_FINDNOTIFYFIRST 0x0B -#define TRANSACT2_FINDNOTIFYNEXT 0x0C -#define TRANSACT2_MKDIR 0x0D -#define TRANSACT2_SESSION_SETUP 0x0E -#define TRANSACT2_GET_DFS_REFERRAL 0x10 -#define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11 - /* These are the NT transact sub commands. */ #define NT_TRANSACT_CREATE 1 #define NT_TRANSACT_IOCTL 2 @@ -908,101 +753,6 @@ struct bitmap { #define NT_TRANSACT_NOTIFY_CHANGE 4 #define NT_TRANSACT_RENAME 5 #define NT_TRANSACT_QUERY_SECURITY_DESC 6 -#define NT_TRANSACT_GET_USER_QUOTA 7 -#define NT_TRANSACT_SET_USER_QUOTA 8 - -/* These are the NT transact_get_user_quota sub commands */ -#define TRANSACT_GET_USER_QUOTA_LIST_CONTINUE 0x0000 -#define TRANSACT_GET_USER_QUOTA_LIST_START 0x0100 -#define TRANSACT_GET_USER_QUOTA_FOR_SID 0x0101 - -/* Relevant IOCTL codes */ -#define IOCTL_QUERY_JOB_INFO 0x530060 - -/* these are the trans2 sub fields for primary requests */ -#define smb_tpscnt smb_vwv0 -#define smb_tdscnt smb_vwv1 -#define smb_mprcnt smb_vwv2 -#define smb_mdrcnt smb_vwv3 -#define smb_msrcnt smb_vwv4 -#define smb_flags smb_vwv5 -#define smb_timeout smb_vwv6 -#define smb_pscnt smb_vwv9 -#define smb_psoff smb_vwv10 -#define smb_dscnt smb_vwv11 -#define smb_dsoff smb_vwv12 -#define smb_suwcnt smb_vwv13 -#define smb_setup smb_vwv14 -#define smb_setup0 smb_setup -#define smb_setup1 (smb_setup+2) -#define smb_setup2 (smb_setup+4) - -/* these are for the secondary requests */ -#define smb_spscnt smb_vwv2 -#define smb_spsoff smb_vwv3 -#define smb_spsdisp smb_vwv4 -#define smb_sdscnt smb_vwv5 -#define smb_sdsoff smb_vwv6 -#define smb_sdsdisp smb_vwv7 -#define smb_sfid smb_vwv8 - -/* and these for responses */ -#define smb_tprcnt smb_vwv0 -#define smb_tdrcnt smb_vwv1 -#define smb_prcnt smb_vwv3 -#define smb_proff smb_vwv4 -#define smb_prdisp smb_vwv5 -#define smb_drcnt smb_vwv6 -#define smb_droff smb_vwv7 -#define smb_drdisp smb_vwv8 - -/* these are for the NT trans primary request. */ -#define smb_nt_MaxSetupCount smb_vwv0 -#define smb_nt_Flags (smb_vwv0 + 1) -#define smb_nt_TotalParameterCount (smb_vwv0 + 3) -#define smb_nt_TotalDataCount (smb_vwv0 + 7) -#define smb_nt_MaxParameterCount (smb_vwv0 + 11) -#define smb_nt_MaxDataCount (smb_vwv0 + 15) -#define smb_nt_ParameterCount (smb_vwv0 + 19) -#define smb_nt_ParameterOffset (smb_vwv0 + 23) -#define smb_nt_DataCount (smb_vwv0 + 27) -#define smb_nt_DataOffset (smb_vwv0 + 31) -#define smb_nt_SetupCount (smb_vwv0 + 35) -#define smb_nt_Function (smb_vwv0 + 36) -#define smb_nt_SetupStart (smb_vwv0 + 38) - -/* these are for the NT trans secondary request. */ -#define smb_nts_TotalParameterCount (smb_vwv0 + 3) -#define smb_nts_TotalDataCount (smb_vwv0 + 7) -#define smb_nts_ParameterCount (smb_vwv0 + 11) -#define smb_nts_ParameterOffset (smb_vwv0 + 15) -#define smb_nts_ParameterDisplacement (smb_vwv0 + 19) -#define smb_nts_DataCount (smb_vwv0 + 23) -#define smb_nts_DataOffset (smb_vwv0 + 27) -#define smb_nts_DataDisplacement (smb_vwv0 + 31) - -/* these are for the NT trans reply. */ -#define smb_ntr_TotalParameterCount (smb_vwv0 + 3) -#define smb_ntr_TotalDataCount (smb_vwv0 + 7) -#define smb_ntr_ParameterCount (smb_vwv0 + 11) -#define smb_ntr_ParameterOffset (smb_vwv0 + 15) -#define smb_ntr_ParameterDisplacement (smb_vwv0 + 19) -#define smb_ntr_DataCount (smb_vwv0 + 23) -#define smb_ntr_DataOffset (smb_vwv0 + 27) -#define smb_ntr_DataDisplacement (smb_vwv0 + 31) - -/* these are for the NT create_and_X */ -#define smb_ntcreate_NameLength (smb_vwv0 + 5) -#define smb_ntcreate_Flags (smb_vwv0 + 7) -#define smb_ntcreate_RootDirectoryFid (smb_vwv0 + 11) -#define smb_ntcreate_DesiredAccess (smb_vwv0 + 15) -#define smb_ntcreate_AllocationSize (smb_vwv0 + 19) -#define smb_ntcreate_FileAttributes (smb_vwv0 + 27) -#define smb_ntcreate_ShareAccess (smb_vwv0 + 31) -#define smb_ntcreate_CreateDisposition (smb_vwv0 + 35) -#define smb_ntcreate_CreateOptions (smb_vwv0 + 39) -#define smb_ntcreate_ImpersonationLevel (smb_vwv0 + 43) -#define smb_ntcreate_SecurityFlags (smb_vwv0 + 47) /* this is used on a TConX. I'm not sure the name is very helpful though */ #define SMB_SUPPORT_SEARCH_BITS 0x0001 @@ -1012,103 +762,39 @@ struct bitmap { #define PIPE_RAW_MODE 0x4 #define PIPE_START_MESSAGE 0x8 -/* File Specific access rights */ -#define FILE_READ_DATA 0x00000001 -#define FILE_WRITE_DATA 0x00000002 -#define FILE_APPEND_DATA 0x00000004 -#define FILE_READ_EA 0x00000008 /* File and directory */ -#define FILE_WRITE_EA 0x00000010 /* File and directory */ -#define FILE_EXECUTE 0x00000020 -#define FILE_DELETE_CHILD 0x00000040 -#define FILE_READ_ATTRIBUTES 0x00000080 -#define FILE_WRITE_ATTRIBUTES 0x00000100 - -#define FILE_ALL_ACCESS 0x000001FF - -/* Directory specific access rights */ -#define FILE_LIST_DIRECTORY 0x00000001 -#define FILE_ADD_FILE 0x00000002 -#define FILE_ADD_SUBDIRECTORY 0x00000004 -#define FILE_TRAVERSE 0x00000020 -#define FILE_DELETE_CHILD 0x00000040 - /* the desired access to use when opening a pipe */ #define DESIRED_ACCESS_PIPE 0x2019f -/* Generic access masks & rights. */ -#define DELETE_ACCESS (1L<<16) /* 0x00010000 */ -#define READ_CONTROL_ACCESS (1L<<17) /* 0x00020000 */ -#define WRITE_DAC_ACCESS (1L<<18) /* 0x00040000 */ -#define WRITE_OWNER_ACCESS (1L<<19) /* 0x00080000 */ -#define SYNCHRONIZE_ACCESS (1L<<20) /* 0x00100000 */ - -#define SYSTEM_SECURITY_ACCESS (1L<<24) /* 0x01000000 */ -#define MAXIMUM_ALLOWED_ACCESS (1L<<25) /* 0x02000000 */ -#define GENERIC_ALL_ACCESS (1<<28) /* 0x10000000 */ -#define GENERIC_EXECUTE_ACCESS (1<<29) /* 0x20000000 */ -#define GENERIC_WRITE_ACCESS (1<<30) /* 0x40000000 */ -#define GENERIC_READ_ACCESS (((unsigned)1)<<31) /* 0x80000000 */ /* Mapping of generic access rights for files to specific rights. */ - -#define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS| SYNCHRONIZE_ACCESS|FILE_ALL_ACCESS) +#define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS| NT_ACCESS_SYNCHRONIZE_ACCESS|FILE_ALL_ACCESS) #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|FILE_READ_DATA|FILE_READ_ATTRIBUTES|\ - FILE_READ_EA|SYNCHRONIZE_ACCESS) + FILE_READ_EA|NT_ACCESS_SYNCHRONIZE_ACCESS) #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE_ACCESS|FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|\ - FILE_WRITE_EA|FILE_APPEND_DATA|SYNCHRONIZE_ACCESS) + FILE_WRITE_EA|FILE_APPEND_DATA|NT_ACCESS_SYNCHRONIZE_ACCESS) #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|FILE_READ_ATTRIBUTES|\ - FILE_EXECUTE|SYNCHRONIZE_ACCESS) - -/* Mapping of access rights to UNIX perms. */ -#define UNIX_ACCESS_RWX FILE_GENERIC_ALL -#define UNIX_ACCESS_R FILE_GENERIC_READ -#define UNIX_ACCESS_W FILE_GENERIC_WRITE -#define UNIX_ACCESS_X FILE_GENERIC_EXECUTE - -#if 0 -/* - * This is the old mapping we used to use. To get W2KSP2 profiles - * working we need to map to the canonical file perms. - */ -#define UNIX_ACCESS_RWX (UNIX_ACCESS_R|UNIX_ACCESS_W|UNIX_ACCESS_X) -#define UNIX_ACCESS_R (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\ - FILE_READ_ATTRIBUTES|FILE_READ_EA|FILE_READ_DATA) -#define UNIX_ACCESS_W (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\ - FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA|\ - FILE_APPEND_DATA|FILE_WRITE_DATA) -#define UNIX_ACCESS_X (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\ - FILE_EXECUTE|FILE_READ_ATTRIBUTES) -#endif - -#define UNIX_ACCESS_NONE (WRITE_OWNER_ACCESS) - -/* Flags field. */ -#define REQUEST_OPLOCK 2 -#define REQUEST_BATCH_OPLOCK 4 -#define OPEN_DIRECTORY 8 -#define EXTENDED_RESPONSE_REQUIRED 0x10 - -/* ShareAccess field. */ -#define FILE_SHARE_NONE 0 /* Cannot be used in bitmask. */ -#define FILE_SHARE_READ 1 -#define FILE_SHARE_WRITE 2 -#define FILE_SHARE_DELETE 4 - -/* FileAttributesField */ -#define FILE_ATTRIBUTE_READONLY 0x001L -#define FILE_ATTRIBUTE_HIDDEN 0x002L -#define FILE_ATTRIBUTE_SYSTEM 0x004L -#define FILE_ATTRIBUTE_DIRECTORY 0x010L -#define FILE_ATTRIBUTE_ARCHIVE 0x020L -#define FILE_ATTRIBUTE_NORMAL 0x080L -#define FILE_ATTRIBUTE_TEMPORARY 0x100L -#define FILE_ATTRIBUTE_SPARSE 0x200L -#define FILE_ATTRIBUTE_COMPRESSED 0x800L -#define FILE_ATTRIBUTE_NONINDEXED 0x2000L -#define SAMBA_ATTRIBUTES_MASK 0x7F + FILE_EXECUTE|NT_ACCESS_SYNCHRONIZE_ACCESS) + + +/* FileAttributes (search attributes) field */ +#define FILE_ATTRIBUTE_READONLY 0x0001 +#define FILE_ATTRIBUTE_HIDDEN 0x0002 +#define FILE_ATTRIBUTE_SYSTEM 0x0004 +#define FILE_ATTRIBUTE_VOLUME 0x0008 +#define FILE_ATTRIBUTE_DIRECTORY 0x0010 +#define FILE_ATTRIBUTE_ARCHIVE 0x0020 +#define FILE_ATTRIBUTE_DEVICE 0x0040 +#define FILE_ATTRIBUTE_NORMAL 0x0080 +#define FILE_ATTRIBUTE_TEMPORARY 0x0100 +#define FILE_ATTRIBUTE_SPARSE 0x0200 +#define FILE_ATTRIBUTE_REPARSE_POINT 0x0400 +#define FILE_ATTRIBUTE_COMPRESSED 0x0800 +#define FILE_ATTRIBUTE_OFFLINE 0x1000 +#define FILE_ATTRIBUTE_NONINDEXED 0x2000 +#define FILE_ATTRIBUTE_ENCRYPTED 0x4000 /* Flags - combined with attributes. */ #define FILE_FLAG_WRITE_THROUGH 0x80000000L @@ -1119,25 +805,6 @@ struct bitmap { #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L #define FILE_FLAG_POSIX_SEMANTICS 0x01000000L -/* CreateDisposition field. */ -#define FILE_SUPERSEDE 0 -#define FILE_OPEN 1 -#define FILE_CREATE 2 -#define FILE_OPEN_IF 3 -#define FILE_OVERWRITE 4 -#define FILE_OVERWRITE_IF 5 - -/* CreateOptions field. */ -#define FILE_DIRECTORY_FILE 0x0001 -#define FILE_WRITE_THROUGH 0x0002 -#define FILE_SEQUENTIAL_ONLY 0x0004 -#define FILE_NON_DIRECTORY_FILE 0x0040 -#define FILE_NO_EA_KNOWLEDGE 0x0200 -#define FILE_EIGHT_DOT_THREE_ONLY 0x0400 -#define FILE_RANDOM_ACCESS 0x0800 -#define FILE_DELETE_ON_CLOSE 0x1000 -#define FILE_OPEN_BY_FILE_ID 0x2000 - /* Responses when opening a file. */ #define FILE_WAS_SUPERSEDED 0 #define FILE_WAS_OPENED 1 @@ -1155,30 +822,25 @@ struct bitmap { /* Flag for NT transact rename call. */ #define RENAME_REPLACE_IF_EXISTS 1 -/* flags for SMBntrename call (from Samba4) */ +/* flags for SMBntrename call */ #define RENAME_FLAG_MOVE_CLUSTER_INFORMATION 0x102 /* ???? */ #define RENAME_FLAG_HARD_LINK 0x103 #define RENAME_FLAG_RENAME 0x104 #define RENAME_FLAG_COPY 0x105 /* Filesystem Attributes. */ -#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 -#define FILE_CASE_PRESERVED_NAMES 0x00000002 -#define FILE_UNICODE_ON_DISK 0x00000004 +#define FILE_CASE_SENSITIVE_SEARCH 0x01 +#define FILE_CASE_PRESERVED_NAMES 0x02 +#define FILE_UNICODE_ON_DISK 0x04 /* According to cifs9f, this is 4, not 8 */ /* Acconding to testing, this actually sets the security attribute! */ -#define FILE_PERSISTENT_ACLS 0x00000008 -#define FILE_FILE_COMPRESSION 0x00000010 -#define FILE_VOLUME_QUOTAS 0x00000020 -#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 -#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 -#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 -#define FS_LFN_APIS 0x00004000 -#define FILE_VOLUME_IS_COMPRESSED 0x00008000 -#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 -#define FILE_SUPPORTS_ENCRYPTION 0x00020000 -#define FILE_NAMED_STREAMS 0x00040000 -#define FILE_READ_ONLY_VOLUME 0x00080000 +#define FILE_PERSISTENT_ACLS 0x08 +/* These entries added from cifs9f --tsb */ +#define FILE_FILE_COMPRESSION 0x10 +#define FILE_VOLUME_QUOTAS 0x20 +/* I think this is wrong. JRA #define FILE_DEVICE_IS_MOUNTED 0x20 */ +#define FILE_VOLUME_SPARSE_FILE 0x40 +#define FILE_VOLUME_IS_COMPRESSED 0x8000 /* ChangeNotify flags. */ #define FILE_NOTIFY_CHANGE_FILE 0x001 @@ -1192,7 +854,23 @@ struct bitmap { #define FILE_NOTIFY_CHANGE_SECURITY 0x100 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x200 +/* change notify action results */ +#define NOTIFY_ACTION_ADDED 1 +#define NOTIFY_ACTION_REMOVED 2 +#define NOTIFY_ACTION_MODIFIED 3 +#define NOTIFY_ACTION_OLD_NAME 4 +#define NOTIFY_ACTION_NEW_NAME 5 +#define NOTIFY_ACTION_ADDED_STREAM 6 +#define NOTIFY_ACTION_REMOVED_STREAM 7 +#define NOTIFY_ACTION_MODIFIED_STREAM 8 + +/* seek modes for smb_seek */ +#define SEEK_MODE_START 0 +#define SEEK_MODE_CURRENT 1 +#define SEEK_MODE_END 2 + /* where to find the base of the SMB packet proper */ +/* REWRITE TODO: smb_base needs to be removed */ #define smb_base(buf) (((char *)(buf))+4) /* we don't allow server strings to be longer than 48 characters as @@ -1308,46 +986,6 @@ char *strdup(char *s); #define CAP_UNIX 0x800000 /* Capabilities for UNIX extensions. Created by HP. */ #define CAP_EXTENDED_SECURITY 0x80000000 -/* protocol types. It assumes that higher protocols include lower protocols - as subsets */ -enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; - -/* security levels */ -enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN,SEC_ADS}; - -/* server roles */ -enum server_types -{ - ROLE_STANDALONE, - ROLE_DOMAIN_MEMBER, - ROLE_DOMAIN_BDC, - ROLE_DOMAIN_PDC -}; - -/* printing types */ -enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, - PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ, - PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2 -#ifdef DEVELOPER -,PRINT_TEST,PRINT_VLP -#endif /* DEVELOPER */ -}; - -/* LDAP schema types */ -enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA}; - -/* LDAP SSL options */ -enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS}; - -/* LDAP PASSWD SYNC methods */ -enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY}; - -/* Remote architectures we know about. */ -enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_SAMBA}; - -/* case handling */ -enum case_handling {CASE_LOWER,CASE_UPPER}; - /* * Global value meaing that the smb_uid field should be * ingored (in share level security and protocol level == CORE) @@ -1356,39 +994,6 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define UID_FIELD_INVALID 0 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */ -/* - * Size of buffer to use when moving files across filesystems. - */ -#define COPYBUF_SIZE (8*1024) - -/* - * Values used to override error codes. - */ -extern int unix_ERR_class; -extern int unix_ERR_code; -extern NTSTATUS unix_ERR_ntstatus; - -/* - * Used in chaining code. - */ -extern int chain_size; - -/* - * Map the Core and Extended Oplock requesst bits down - * to common bits (EXCLUSIVE_OPLOCK & BATCH_OPLOCK). - */ - -/* - * Core protocol. - */ -#define CORE_OPLOCK_REQUEST(inbuf) \ - ((CVAL(inbuf,smb_flg)&(FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK))>>5) - -/* - * Extended protocol. - */ -#define EXTENDED_OPLOCK_REQUEST(inbuf) ((SVAL(inbuf,smb_vwv2)&((1<<1)|(1<<2)))>>1) - /* Lock types. */ #define LOCKING_ANDX_SHARED_LOCK 0x1 #define LOCKING_ANDX_OPLOCK_RELEASE 0x2 @@ -1409,10 +1014,6 @@ extern int chain_size; #define BATCH_OPLOCK 2 #define LEVEL_II_OPLOCK 4 -#define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) -#define BATCH_OPLOCK_TYPE(lck) ((lck) & BATCH_OPLOCK) -#define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & LEVEL_II_OPLOCK) - #define CORE_OPLOCK_GRANTED (1<<5) #define EXTENDED_OPLOCK_GRANTED (1<<15) @@ -1435,24 +1036,6 @@ extern int chain_size; #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 @@ -1481,42 +1064,13 @@ extern int chain_size; #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); - 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 { - void * (*register_notify)(connection_struct *conn, char *path, uint32 flags); - BOOL (*check_notify)(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *data, time_t t); - void (*remove_notify)(void *data); - int select_time; -}; - - - #include "smb_macros.h" -#define MAX_NETBIOSNAME_LEN 16 -/* DOS character, NetBIOS namestring. Type used on the wire. */ -typedef char nstring[MAX_NETBIOSNAME_LEN]; -/* Unix character, NetBIOS namestring. Type used to manipulate name in nmbd. */ -typedef char unstring[MAX_NETBIOSNAME_LEN*4]; - /* A netbios name structure. */ struct nmb_name { - nstring name; + char name[17]; char scope[64]; unsigned int name_type; }; @@ -1524,7 +1078,7 @@ struct nmb_name { /* A netbios node status array element. */ struct node_status { - nstring name; + char name[16]; unsigned char type; unsigned char flags; }; @@ -1533,11 +1087,27 @@ struct pwd_info { BOOL null_pwd; BOOL cleartext; + BOOL crypted; fstring password; + uchar smb_lm_pwd[16]; + uchar smb_nt_pwd[16]; + + uchar smb_lm_owf[24]; + uchar smb_nt_owf[128]; + size_t nt_owf_len; + + uchar lm_cli_chal[8]; + uchar nt_cli_chal[128]; + size_t nt_cli_chal_len; + + uchar sess_key[16]; }; +#include "rpc_misc.h" +#include "rpc_secdes.h" + typedef struct user_struct { struct user_struct *next, *prev; @@ -1558,9 +1128,8 @@ typedef struct user_struct gid_t *groups; NT_USER_TOKEN *nt_user_token; - PRIVILEGE_SET *privs; - DATA_BLOB session_key; + uint8 session_key[16]; char *session_keystr; /* used by utmp and pam session code. TDB key string */ @@ -1570,7 +1139,6 @@ typedef struct user_struct } user_struct; - struct unix_error_map { int unix_error; int dos_class; @@ -1578,11 +1146,7 @@ struct unix_error_map { NTSTATUS nt_error; }; -/* -#include "ntdomain.h" - #include "client.h" -*/ /* * Size of new password account encoding string. This is enough space to @@ -1621,11 +1185,11 @@ struct unix_error_map { /* generic iconv conversion structure */ typedef struct { - size_t (*direct)(void *cd, char **inbuf, size_t *inbytesleft, + size_t (*direct)(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); - size_t (*pull)(void *cd, char **inbuf, size_t *inbytesleft, + size_t (*pull)(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); - size_t (*push)(void *cd, char **inbuf, size_t *inbytesleft, + size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); void *cd_direct, *cd_pull, *cd_push; char *from_name, *to_name; @@ -1637,43 +1201,15 @@ typedef struct { #define DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH 14 -#include "popt_common.h" - -#define PORT_NONE 0 -#ifndef LDAP_PORT -#define LDAP_PORT 389 -#endif -/* used by the IP comparison function */ -struct ip_service { - struct in_addr ip; - unsigned port; -}; +/* a set of flags to control handling of request structures */ +#define REQ_CONTROL_PROTECTED (1<<0) /* don't destroy this request */ +#define REQ_CONTROL_LARGE (1<<1) /* allow replies larger than max_xmit */ +#define REQ_CONTROL_ASYNC (1<<2) /* the backend will answer this one later */ -/* Used by the SMB signing functions. */ - -typedef struct smb_sign_info { - void (*sign_outgoing_message)(char *outbuf, struct smb_sign_info *si); - BOOL (*check_incoming_message)(char *inbuf, struct smb_sign_info *si, BOOL expected_ok); - void (*free_signing_context)(struct smb_sign_info *si); - void *signing_context; - - BOOL negotiated_smb_signing; - BOOL allow_smb_signing; - BOOL doing_signing; - BOOL mandatory_signing; - BOOL seen_valid; /* Have I ever seen a validly signed packet? */ -} smb_sign_info; - -struct ea_struct { - uint8 flags; - char *name; - DATA_BLOB value; -}; +/* passed to br lock code */ +enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_LOCK}; -/* EA names used internally in Samba. KEEP UP TO DATE with prohibited_ea_names in trans2.c !. */ -#define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI" -/* EA to use for DOS attributes */ -#define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" +#include "popt_common.h" #endif /* _SMB_H */ diff --git a/source/include/smb_acls.h b/source/include/smb_acls.h index 2bde6caeda1..49c4406ab84 100644 --- a/source/include/smb_acls.h +++ b/source/include/smb_acls.h @@ -18,6 +18,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#error SAMBA4 clean up +#error this file should be (re)moved +#error and all unused stuff should go + #ifndef _SMB_ACLS_H #define _SMB_ACLS_H #if defined(HAVE_POSIX_ACLS) diff --git a/source/include/smb_interfaces.h b/source/include/smb_interfaces.h new file mode 100644 index 00000000000..6f820be5367 --- /dev/null +++ b/source/include/smb_interfaces.h @@ -0,0 +1,1956 @@ +/* + Unix SMB/CIFS implementation. + SMB request interface structures + Copyright (C) Andrew Tridgell 2003 + Copyright (C) James J Myers 2003 <myersjj@samba.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 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. +*/ + + +typedef SMB_BIG_UINT large_t; + +/* Globally Unique ID */ +#define GUID_SIZE 16 + +/* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30 */ +typedef struct nttime_info +{ + uint32 low; + uint32 high; +} NTTIME; + +/* 8 byte aligned 'hyper' type from MS IDL */ +typedef struct +{ + uint32 low; + uint32 high; +} HYPER_T; + + + +/* this structure is just a wrapper for a string, the only reason we + bother with this is that it allows us to check the length provided + on the wire in testsuite test code to ensure that we are + terminating names in the same way that win2003 is. The *ONLY* time + you should ever look at the 'private_length' field in this + structure is inside compliance test code, in all other cases just + use the null terminated char* as the definitive definition of the + string + + also note that this structure is only used in packets where there + is an explicit length provided on the wire (hence the name). That + length is placed in 'private_length'. For packets where the length + is always determined by NULL or packet termination a normal char* + is used in the structure definition. + */ +typedef struct { + uint32 private_length; + const char *s; +} WIRE_STRING; + + +/* + this header defines the structures and unions used between the SMB + parser and the backends. +*/ + +/* struct used for SMBlseek call */ +struct smb_seek { + struct { + uint16 fnum; + uint16 mode; + int32 offset; /* signed */ + } in; + struct { + int32 offset; + } out; +}; + + +/* struct used in unlink() call */ +struct smb_unlink { + struct { + const char *pattern; + uint16 attrib; + } in; +}; + + +/* struct used in chkpath() call */ +struct smb_chkpath { + struct { + const char *path; + } in; +}; + +enum mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR}; + +/* union used in mkdir() call */ +union smb_mkdir { + /* generic level */ + struct { + enum mkdir_level level; + } generic; + + struct { + enum mkdir_level level; + struct { + const char *path; + } in; + } mkdir; + + struct { + enum mkdir_level level; + struct { + const char *path; + uint_t num_eas; + struct ea_struct *eas; + } in; + } t2mkdir; +}; + +/* struct used in rmdir() call */ +struct smb_rmdir { + struct { + const char *path; + } in; +}; + +/* struct used in rename() call */ +enum rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME}; + +union smb_rename { + struct { + enum rename_level level; + } generic; + + /* SMBrename interface */ + struct { + enum rename_level level; + + struct { + const char *pattern1; + const char *pattern2; + uint16 attrib; + } in; + } rename; + + + /* SMBntrename interface */ + struct { + enum rename_level level; + + struct { + uint16 attrib; + uint16 flags; /* see RENAME_FLAG_* */ + uint32 cluster_size; + const char *old_name; + const char *new_name; + } in; + } ntrename; +}; + +enum tcon_level {RAW_TCON_TCON, RAW_TCON_TCONX}; + +/* union used in tree connect call */ +union smb_tcon { + /* generic interface */ + struct { + enum tcon_level level; + } generic; + + /* SMBtcon interface */ + struct { + enum tcon_level level; + + struct { + const char *service; + const char *password; + const char *dev; + } in; + struct { + uint16 max_xmit; + uint16 cnum; + } out; + } tcon; + + /* SMBtconX interface */ + struct { + enum tcon_level level; + + struct { + uint16 flags; + DATA_BLOB password; + const char *path; + const char *device; + } in; + struct { + uint16 options; + char *dev_type; + char *fs_type; + uint16 cnum; + } out; + } tconx; +}; + + +enum sesssetup_level {RAW_SESSSETUP_GENERIC, RAW_SESSSETUP_OLD, RAW_SESSSETUP_NT1, RAW_SESSSETUP_SPNEGO}; + +/* union used in session_setup call */ +union smb_sesssetup { + + /* generic interface - used for auto selecting based on negotiated + protocol options */ + struct { + enum sesssetup_level level; + + struct { + uint32 sesskey; + uint32 capabilities; + const char *password; + const char *user; + const char *domain; + } in; + struct { + uint16 vuid; + char *os; + char *lanman; + char *domain; + } out; + } generic; + + /* the pre-NT1 interface */ + struct { + enum sesssetup_level level; + + struct { + uint16 bufsize; + uint16 mpx_max; + uint16 vc_num; + uint32 sesskey; + DATA_BLOB password; + const char *user; + const char *domain; + const char *os; + const char *lanman; + } in; + struct { + uint16 action; + uint16 vuid; + char *os; + char *lanman; + char *domain; + } out; + } old; + + /* the NT1 interface */ + struct { + enum sesssetup_level level; + + struct { + uint16 bufsize; + uint16 mpx_max; + uint16 vc_num; + uint32 sesskey; + uint32 capabilities; + DATA_BLOB password1; + DATA_BLOB password2; + const char *user; + const char *domain; + const char *os; + const char *lanman; + } in; + struct { + uint16 action; + uint16 vuid; + char *os; + char *lanman; + char *domain; + } out; + } nt1; + + + /* the SPNEGO interface */ + struct { + enum sesssetup_level level; + + struct { + uint16 bufsize; + uint16 mpx_max; + uint16 vc_num; + uint32 sesskey; + uint32 capabilities; + DATA_BLOB secblob; + const char *os; + const char *lanman; + const char *domain; + } in; + struct { + uint16 action; + DATA_BLOB secblob; + char *os; + char *lanman; + char *domain; + uint16 vuid; + } out; + } spnego; +}; + +/* Note that the specified enum values are identical to the actual info-levels used + * on the wire. + */ +enum fileinfo_level {RAW_FILEINFO_GENERIC = 0xF000, + RAW_FILEINFO_GETATTR, /* SMBgetatr */ + RAW_FILEINFO_GETATTRE, /* SMBgetattrE */ + RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD, + RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE, + RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS, + RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID, + RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO, + RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO, + RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO, + RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO, + RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO, + RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO, + RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO, + RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO, + RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC, + RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK, + RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION, + RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION, + RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION, + RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION, + RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION, + RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION, + RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION, + RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION, + RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION, + RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION, + RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION, + RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION, + RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION, + RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION, + RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION +}; + + +/* union used in qfileinfo() and qpathinfo() backend calls */ +union smb_fileinfo { + /* generic interface: + * matches RAW_FILEINFO_GENERIC */ + struct { + enum fileinfo_level level; + + /* each level can be called on either a pathname or a + * filename, in either case the return format is + * identical */ + union smb_fileinfo_in { + const char *fname; + uint16 fnum; + } in; + + struct { + uint16 attrib; + uint32 ea_size; + uint_t num_eas; + struct ea_struct { + uint8 flags; + WIRE_STRING name; + DATA_BLOB value; + } *eas; + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + uint32 ex_attrib; + large_t alloc_size; + large_t size; + uint32 nlink; + WIRE_STRING fname; + WIRE_STRING alt_fname; + uint8 delete_pending; + uint8 directory; + large_t compressed_size; + uint16 format; + uint8 unit_shift; + uint8 chunk_shift; + uint8 cluster_shift; + large_t file_id; + uint32 access_flags; /* seen 0x001f01ff from w2k3 */ + large_t position; + uint32 mode; + uint32 alignment_requirement; + uint32 reparse_tag; + uint_t num_streams; + struct stream_struct { + large_t size; + large_t alloc_size; + WIRE_STRING stream_name; + } *streams; + } out; + } generic; + + + /* SMBgetatr interface: + * matches RAW_FILEINFO_GETATTR */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + uint16 attrib; + uint32 size; + time_t write_time; + } out; + } getattr; + + /* SMBgetattrE interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + time_t create_time; + time_t access_time; + time_t write_time; + uint32 size; + uint32 alloc_size; + uint16 attrib; + } out; + } getattre; + + /* trans2 RAW_FILEINFO_STANDARD interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + time_t create_time; + time_t access_time; + time_t write_time; + uint32 size; + uint32 alloc_size; + uint16 attrib; + } out; + } standard; + + /* trans2 RAW_FILEINFO_EA_SIZE interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + time_t create_time; + time_t access_time; + time_t write_time; + uint32 size; + uint32 alloc_size; + uint16 attrib; + uint32 ea_size; + } out; + } ea_size; + + /* trans2 RAW_FILEINFO_ALL_EAS interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + /* the ea_size is implied by the list */ + uint_t num_eas; + struct ea_struct *eas; + } out; + } all_eas; + + /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface + only valid for a QPATHNAME call - no returned data */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + } is_name_valid; + + /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + uint32 attrib; + } out; + } basic_info; + + + /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + large_t alloc_size; + large_t size; + uint32 nlink; + BOOL delete_pending; + BOOL directory; + } out; + } standard_info; + + /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + uint32 ea_size; + } out; + } ea_info; + + /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + WIRE_STRING fname; + } out; + } name_info; + + /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + uint32 attrib; + large_t alloc_size; + large_t size; + uint32 nlink; + uint8 delete_pending; + uint8 directory; + uint32 ea_size; + WIRE_STRING fname; + } out; + } all_info; + + /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + WIRE_STRING fname; + } out; + } alt_name_info; + + /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + uint_t num_streams; + struct stream_struct *streams; + } out; + } stream_info; + + /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + large_t compressed_size; + uint16 format; + uint8 unit_shift; + uint8 chunk_shift; + uint8 cluster_shift; + } out; + } compression_info; + + /* RAW_FILEINFO_UNIX_BASIC interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + large_t end_of_file; + large_t num_bytes; + NTTIME status_change_time; + NTTIME access_time; + NTTIME change_time; + large_t uid; + large_t gid; + uint32 file_type; + large_t dev_major; + large_t dev_minor; + large_t unique_id; + large_t permissions; + large_t nlink; + } out; + } unix_basic_info; + + /* RAW_FILEINFO_UNIX_LINK interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + WIRE_STRING link_dest; + } out; + } unix_link_info; + + /* RAW_FILEINFO_INTERNAL_INFORMATION interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + large_t file_id; + } out; + } internal_information; + + /* RAW_FILEINFO_ACCESS_INFORMATION interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + uint32 access_flags; /* seen 0x001f01ff from w2k3 */ + } out; + } access_information; + + /* RAW_FILEINFO_POSITION_INFORMATION interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + large_t position; + } out; + } position_information; + + /* RAW_FILEINFO_MODE_INFORMATION interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + uint32 mode; + } out; + } mode_information; + + /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + uint32 alignment_requirement; + } out; + } alignment_information; + + /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + large_t alloc_size; + large_t size; + uint32 attrib; + } out; + } network_open_information; + + + /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */ + struct { + enum fileinfo_level level; + union smb_fileinfo_in in; + + struct { + uint32 attrib; + uint32 reparse_tag; + } out; + } attribute_tag_information; +}; + + +enum setfileinfo_level { + RAW_SFILEINFO_GENERIC = 0xF000, + RAW_SFILEINFO_SETATTR, /* SMBsetatr */ + RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */ + RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD, + RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET, + RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO, + RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO, + RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO, + RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO, + RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC, + RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK, + RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK, + RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION, + RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION, + RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION, + RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION, + RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION, + RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION, + RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION, + RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023, + RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025, + RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029, + RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032, + RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039, + RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040 +}; + +/* union used in setfileinfo() and setpathinfo() calls */ +union smb_setfileinfo { + /* generic interface */ + struct { + enum setfileinfo_level level; + + /* we are combining setfileinfo and setpathinfo into one + interface */ + union setfileinfo_file { + const char *fname; + uint16 fnum; + } file; + } generic; + + /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + struct { + uint16 attrib; + time_t write_time; + } in; + } setattr; + + /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo() */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + time_t create_time; + time_t access_time; + time_t write_time; + } in; + } setattre; + + + /* RAW_SFILEINFO_STANDARD interface */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + struct { + time_t create_time; + time_t access_time; + time_t write_time; + /* notice that size, alloc_size and attrib are not settable, + unlike the corresponding qfileinfo level */ + } in; + } standard; + + /* RAW_SFILEINFO_EA_SET interface */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + struct { + struct ea_struct ea; + } in; + } ea_set; + + /* RAW_SFILEINFO_BASIC_INFO and + RAW_SFILEINFO_BASIC_INFORMATION interfaces */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + uint32 attrib; + } in; + } basic_info; + + /* RAW_SFILEINFO_DISPOSITION_INFO and + RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + BOOL delete_on_close; + } in; + } disposition_info; + + /* RAW_SFILEINFO_ALLOCATION_INFO and + RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + /* w2k3 rounds this up to nearest 4096 */ + large_t alloc_size; + } in; + } allocation_info; + + /* RAW_SFILEINFO_END_OF_FILE_INFO and + RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + large_t size; + } in; + } end_of_file_info; + + /* RAW_SFILEINFO_RENAME_INFORMATION interface */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + uint8 overwrite; + uint32 root_fid; + const char *new_name; + } in; + } rename_information; + + /* RAW_SFILEINFO_POSITION_INFORMATION interface */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + large_t position; + } in; + } position_information; + + /* RAW_SFILEINFO_MODE_INFORMATION interface */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + + struct { + /* valid values seem to be 0, 2, 4 and 6 */ + uint32 mode; + } in; + } mode_information; + + + + /* RAW_SFILEINFO_UNIX_BASIC interface */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + struct { + uint32 mode; /* yuck - this field remains to fix compile of libcli/clifile.c */ + large_t end_of_file; + large_t num_bytes; + NTTIME status_change_time; + NTTIME access_time; + NTTIME change_time; + large_t uid; + large_t gid; + uint32 file_type; + large_t dev_major; + large_t dev_minor; + large_t unique_id; + large_t permissions; + large_t nlink; + } in; + } unix_basic; + + /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */ + struct { + enum setfileinfo_level level; + union setfileinfo_file file; + struct { + const char *link_dest; + } in; + } unix_link, unix_hlink; +}; + + +enum fsinfo_level {RAW_QFS_GENERIC = 0xF000, + RAW_QFS_DSKATTR, /* SMBdskattr */ + RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION, + RAW_QFS_VOLUME = SMB_QFS_VOLUME, + RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO, + RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO, + RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO, + RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO, + RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO, + RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION, + RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION, + RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION, + RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION, + RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION, + RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION, + RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION}; + + +/* union for fsinfo() backend call. Note that there are no in + structures, as this call only contains out parameters */ +union smb_fsinfo { + /* generic interface */ + struct { + enum fsinfo_level level; + + struct { + uint32 block_size; + large_t blocks_total; + large_t blocks_free; + uint32 fs_id; + NTTIME create_time; + uint32 serial_number; + uint32 fs_attr; + uint32 max_file_component_length; + uint32 device_type; + uint32 device_characteristics; + large_t quota_soft; + large_t quota_hard; + large_t quota_flags; + struct GUID guid; + char *volume_name; + char *fs_type; + } out; + } generic; + + /* SMBdskattr interface */ + struct { + enum fsinfo_level level; + + struct { + uint16 units_total; + uint16 blocks_per_unit; + uint16 block_size; + uint16 units_free; + } out; + } dskattr; + + /* trans2 RAW_QFS_ALLOCATION interface */ + struct { + enum fsinfo_level level; + + struct { + uint32 fs_id; + uint32 sectors_per_unit; + uint32 total_alloc_units; + uint32 avail_alloc_units; + uint16 bytes_per_sector; + } out; + } allocation; + + /* TRANS2 RAW_QFS_VOLUME interface */ + struct { + enum fsinfo_level level; + + struct { + uint32 serial_number; + WIRE_STRING volume_name; + } out; + } volume; + + /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */ + struct { + enum fsinfo_level level; + + struct { + NTTIME create_time; + uint32 serial_number; + WIRE_STRING volume_name; + } out; + } volume_info; + + /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */ + struct { + enum fsinfo_level level; + + struct { + large_t total_alloc_units; + large_t avail_alloc_units; /* maps to call_avail_alloc_units */ + uint32 sectors_per_unit; + uint32 bytes_per_sector; + } out; + } size_info; + + /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */ + struct { + enum fsinfo_level level; + + struct { + uint32 device_type; + uint32 characteristics; + } out; + } device_info; + + + /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */ + struct { + enum fsinfo_level level; + + struct { + uint32 fs_attr; + uint32 max_file_component_length; + WIRE_STRING fs_type; + } out; + } attribute_info; + + + /* TRANS2 RAW_QFS_UNIX_INFO interface */ + struct { + enum fsinfo_level level; + + struct { + uint16 major_version; + uint16 minor_version; + large_t capability; + } out; + } unix_info; + + /* trans2 RAW_QFS_QUOTA_INFORMATION interface */ + struct { + enum fsinfo_level level; + + struct { + large_t unknown[3]; + large_t quota_soft; + large_t quota_hard; + large_t quota_flags; + } out; + } quota_information; + + /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */ + struct { + enum fsinfo_level level; + + struct { + large_t total_alloc_units; + large_t call_avail_alloc_units; + large_t actual_avail_alloc_units; + uint32 sectors_per_unit; + uint32 bytes_per_sector; + } out; + } full_size_information; + + /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */ + struct { + enum fsinfo_level level; + + struct { + struct GUID guid; + large_t unknown[6]; + } out; + } objectid_information; +}; + + + +enum open_level {RAW_OPEN_OPEN, RAW_OPEN_OPENX, + RAW_OPEN_MKNEW, RAW_OPEN_CREATE, + RAW_OPEN_CTEMP, RAW_OPEN_SPLOPEN, + RAW_OPEN_NTCREATEX, RAW_OPEN_T2OPEN}; + +/* the generic interface is defined to be equal to the NTCREATEX interface */ +#define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX + +/* union for open() backend call */ +union smb_open { + /* SMBNTCreateX interface */ + struct { + enum open_level level; + + struct { + uint32 flags; + uint32 root_fid; + uint32 access_mask; + large_t alloc_size; + uint32 file_attr; + uint32 share_access; + uint32 open_disposition; + uint32 create_options; + uint32 impersonation; + uint8 security_flags; + const char *fname; + } in; + + struct { + uint8 oplock_level; + uint16 fnum; + uint32 create_action; + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + uint32 attrib; + large_t alloc_size; + large_t size; + uint16 file_type; + uint16 ipc_state; + uint8 is_directory; + } out; + } ntcreatex, generic; + + /* TRANS2_OPEN interface */ + struct { + enum open_level level; + + struct { + uint16 flags; + uint16 open_mode; + uint16 file_attrs; + time_t write_time; + uint16 open_func; + uint32 size; + uint32 timeout; + const char *fname; + uint_t num_eas; + struct ea_struct *eas; + } in; + + struct { + uint16 fnum; + uint16 attrib; + time_t write_time; + uint32 size; + uint16 access; + uint16 ftype; + uint16 devstate; + uint16 action; + uint32 unknown; + } out; + } t2open; + + /* SMBopen interface */ + struct { + enum open_level level; + + struct { + uint16 flags; + uint16 search_attrs; + const char *fname; + } in; + struct { + uint16 fnum; + uint16 attrib; + time_t write_time; + uint32 size; + uint16 rmode; + } out; + } open; + + /* SMBopenX interface */ + struct { + enum open_level level; + + struct { + uint16 flags; + uint16 open_mode; + uint16 search_attrs; /* not honoured by win2003 */ + uint16 file_attrs; + time_t write_time; /* not honoured by win2003 */ + uint16 open_func; + uint32 size; /* note that this sets the + initial file size, not + just allocation size */ + uint32 timeout; /* not honoured by win2003 */ + const char *fname; + } in; + struct { + uint16 fnum; + uint16 attrib; + time_t write_time; + uint32 size; + uint16 access; + uint16 ftype; + uint16 devstate; + uint16 action; + uint32 unique_fid; + uint32 access_mask; + uint32 unknown; + } out; + } openx; + + /* SMBmknew interface */ + struct { + enum open_level level; + + struct { + uint16 attrib; + time_t write_time; + const char *fname; + } in; + struct { + uint16 fnum; + } out; + } mknew, create; + + /* SMBctemp interface */ + struct { + enum open_level level; + + struct { + uint16 attrib; + time_t write_time; + const char *directory; + } in; + struct { + uint16 fnum; + /* temp name, relative to directory */ + char *name; + } out; + } ctemp; + + /* SMBsplopen interface */ + struct { + enum open_level level; + + struct { + uint16 setup_length; + uint16 mode; + const char *ident; + } in; + struct { + uint16 fnum; + } out; + } splopen; +}; + + + +enum read_level {RAW_READ_GENERIC, RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX}; + +/* union for read() backend call + + note that .infoX.out.data will be allocated before the backend is + called. It will be big enough to hold the maximum size asked for +*/ +union smb_read { + /* generic interface */ + struct { + enum read_level level; + + struct { + uint16 fnum; + SMB_BIG_UINT offset; + uint32 size; + } in; + struct { + char *data; + uint32 nread; + } out; + } generic; + + + /* SMBreadbraw interface */ + struct { + enum read_level level; + + struct { + uint16 fnum; + SMB_BIG_UINT offset; + uint16 maxcnt; + uint16 mincnt; + uint32 timeout; + } in; + struct { + char *data; + uint32 nread; + } out; + } readbraw; + + + /* SMBlockandread interface */ + struct { + enum read_level level; + + struct { + uint16 fnum; + uint16 count; + uint32 offset; + uint16 remaining; + } in; + struct { + char *data; + uint16 nread; + } out; + } lockread; + + /* SMBread interface */ + struct { + enum read_level level; + + struct { + uint16 fnum; + uint16 count; + uint32 offset; + uint16 remaining; + } in; + struct { + char *data; + uint16 nread; + } out; + } read; + + /* SMBreadX interface */ + struct { + enum read_level level; + + struct { + uint16 fnum; + SMB_BIG_UINT offset; + uint16 mincnt; + uint16 maxcnt; + uint16 remaining; + } in; + struct { + char *data; + uint16 remaining; + uint16 compaction_mode; + uint16 nread; + } out; + } readx; +}; + + +enum write_level {RAW_WRITE_GENERIC, RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE, + RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE, RAW_WRITE_SPLWRITE}; + +/* union for write() backend call +*/ +union smb_write { + /* generic interface */ + struct { + enum write_level level; + + struct { + uint16 fnum; + SMB_BIG_UINT offset; + uint32 count; + const char *data; + } in; + struct { + uint32 nwritten; + } out; + } generic; + + + /* SMBwriteunlock interface */ + struct { + enum write_level level; + + struct { + uint16 fnum; + uint16 count; + uint32 offset; + uint16 remaining; + const char *data; + } in; + struct { + uint32 nwritten; + } out; + } writeunlock; + + /* SMBwrite interface */ + struct { + enum write_level level; + + struct { + uint16 fnum; + uint16 count; + uint32 offset; + uint16 remaining; + const char *data; + } in; + struct { + uint16 nwritten; + } out; + } write; + + /* SMBwriteX interface */ + struct { + enum write_level level; + + struct { + uint16 fnum; + SMB_BIG_UINT offset; + uint16 wmode; + uint16 remaining; + uint32 count; + const char *data; + } in; + struct { + uint32 nwritten; + uint16 remaining; + } out; + } writex; + + /* SMBwriteclose interface */ + struct { + enum write_level level; + + struct { + uint16 fnum; + uint16 count; + uint32 offset; + time_t mtime; + const char *data; + } in; + struct { + uint16 nwritten; + } out; + } writeclose; + + /* SMBsplwrite interface */ + struct { + enum write_level level; + + struct { + uint16 fnum; + uint16 count; + const char *data; + } in; + } splwrite; +}; + + +enum lock_level {RAW_LOCK_GENERIC, RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX}; + +/* union for lock() backend call +*/ +union smb_lock { + /* generic interface */ + struct { + enum lock_level level; + + } generic; + + /* SMBlock interface */ + struct { + enum lock_level level; + + struct { + uint16 fnum; + uint32 count; + uint32 offset; + } in; + } lock; + + /* SMBunlock interface */ + struct { + enum lock_level level; + + struct { + uint16 fnum; + uint32 count; + uint32 offset; + } in; + } unlock; + + /* SMBlockingX interface */ + struct { + enum lock_level level; + + struct { + uint16 fnum; + uint16 mode; + uint32 timeout; + uint16 ulock_cnt; + uint16 lock_cnt; + struct smb_lock_entry { + uint16 pid; + SMB_BIG_UINT offset; + SMB_BIG_UINT count; + } *locks; /* unlocks are first in the arrray */ + } in; + } lockx; +}; + + +enum close_enum {RAW_CLOSE_GENERIC, RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE}; + +/* + union for close() backend call +*/ +union smb_close { + /* generic interface */ + struct { + enum close_enum level; + + struct { + uint16 fnum; + } in; + } generic; + + /* SMBclose interface */ + struct { + enum close_enum level; + + struct { + uint16 fnum; + time_t write_time; + } in; + } close; + + /* SMBsplclose interface - empty! */ + struct { + enum close_enum level; + + struct { + uint16 fnum; + } in; + } splclose; +}; + + +enum lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ}; + +/* + union for lpq() backend +*/ +union smb_lpq { + /* generic interface */ + struct { + enum lpq_level level; + + } generic; + + + /* SMBsplretq interface */ + struct { + enum lpq_level level; + + struct { + uint16 maxcount; + uint16 startidx; + } in; + struct { + uint16 count; + uint16 restart_idx; + struct { + time_t time; + uint8 status; + uint16 job; + uint32 size; + char *user; + } *queue; + } out; + } retq; +}; + +enum ioctl_level {RAW_IOCTL_IOCTL, RAW_IOCTL_NTIOCTL}; + +/* + union for ioctl() backend +*/ +union smb_ioctl { + /* generic interface */ + struct { + enum ioctl_level level; + + } generic; + + /* struct for SMBioctl */ + struct { + enum ioctl_level level; + struct { + uint16 fnum; + uint32 request; + } in; + struct { + DATA_BLOB blob; + } out; + } ioctl; + + + /* struct for NT ioctl call */ + struct { + enum ioctl_level level; + struct { + uint32 function; + uint16 fnum; + BOOL fsctl; + uint8 filter; + } in; + struct { + DATA_BLOB blob; + } out; + } ntioctl; +}; + +/* struct for SMBflush */ +struct smb_flush { + struct { + uint16 fnum; + } in; +}; + + +/* struct for SMBcopy */ +struct smb_copy { + struct { + uint16 tid2; + uint16 ofun; + uint16 flags; + const char *path1; + const char *path2; + } in; + struct { + uint16 count; + } out; +}; + + +/* struct for transact/transact2 call */ +struct smb_trans2 { + struct { + uint16 max_param; + uint16 max_data; + uint8 max_setup; + uint16 flags; + uint32 timeout; + uint8 setup_count; + uint16 *setup; + const char *trans_name; /* SMBtrans only */ + DATA_BLOB params; + DATA_BLOB data; + } in; + + struct { + uint8 setup_count; + uint16 *setup; + DATA_BLOB params; + DATA_BLOB data; + } out; +}; + +/* struct for nttransact2 call */ +struct smb_nttrans { + struct { + uint8 max_setup; + uint32 max_param; + uint32 max_data; + uint32 setup_count; + uint16 function; + uint16 *setup; + DATA_BLOB params; + DATA_BLOB data; + } in; + + struct { + uint8 setup_count; + uint16 *setup; + DATA_BLOB params; + DATA_BLOB data; + } out; +}; + + +/* struct for nttrans change notify call */ +struct smb_notify { + struct { + uint32 buffer_size; + uint32 completion_filter; + uint16 fnum; + BOOL recursive; + } in; + + struct { + uint32 num_changes; + struct { + uint32 action; + WIRE_STRING name; + } *changes; + } out; +}; + + +enum search_level {RAW_SEARCH_GENERIC = 0xF000, + RAW_SEARCH_SEARCH, /* SMBsearch */ + RAW_SEARCH_FCLOSE, /* SMBfclose */ + RAW_SEARCH_STANDARD = SMB_FIND_STANDARD, + RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE, + RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO, + RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO, + RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO, + RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO, + RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO, + RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO, + RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO}; + + +/* union for file search */ +union smb_search_first { + struct { + enum search_level level; + } generic; + + /* search (old) findfirst interface */ + struct { + enum search_level level; + + struct { + uint16 max_count; + uint16 search_attrib; + const char *pattern; + } in; + struct { + int16 count; + } out; + } search_first; + + /* trans2 findfirst interface */ + struct { + enum search_level level; + + struct { + uint16 search_attrib; + uint16 max_count; + uint16 flags; + uint32 storage_type; + const char *pattern; + } in; + struct { + uint16 handle; + uint16 count; + uint16 end_of_search; + } out; + } t2ffirst; +}; + +/* union for file search continue */ +union smb_search_next { + struct { + enum search_level level; + } generic; + + /* search (old) findnext interface */ + struct { + enum search_level level; + + struct { + uint16 max_count; + uint16 search_attrib; + DATA_BLOB search_id; + } in; + struct { + uint16 count; + } out; + } search_next; + + /* trans2 findnext interface */ + struct { + enum search_level level; + + struct { + uint16 handle; + uint16 max_count; + uint32 resume_key; + uint16 flags; + const char *last_name; + } in; + struct { + uint16 count; + uint16 end_of_search; + } out; + } t2fnext; +}; + +/* union for search reply file data */ +union smb_search_data { + /* search (old) findfirst */ + struct { + uint16 attrib; + time_t write_time; + uint32 size; + DATA_BLOB search_id; /* used to resume search from this point */ + char *name; + } search; + + /* trans2 findfirst RAW_SEARCH_STANDARD level */ + struct { + uint32 resume_key; + time_t create_time; + time_t access_time; + time_t write_time; + uint32 size; + uint32 alloc_size; + uint16 attrib; + WIRE_STRING name; + } standard; + + /* trans2 findfirst RAW_SEARCH_EA_SIZE level */ + struct { + uint32 resume_key; + time_t create_time; + time_t access_time; + time_t write_time; + uint32 size; + uint32 alloc_size; + uint16 attrib; + uint32 ea_size; + WIRE_STRING name; + } ea_size; + + /* RAW_SEARCH_DIRECTORY_INFO interface */ + struct { + uint32 file_index; + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + large_t size; + large_t alloc_size; + uint32 attrib; + WIRE_STRING name; + } directory_info; + + /* RAW_SEARCH_FULL_DIRECTORY_INFO interface */ + struct { + uint32 file_index; + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + large_t size; + large_t alloc_size; + uint32 attrib; + uint32 ea_size; + WIRE_STRING name; + } full_directory_info; + + /* RAW_SEARCH_NAME_INFO interface */ + struct { + uint32 file_index; + WIRE_STRING name; + } name_info; + + /* RAW_SEARCH_BOTH_DIRECTORY_INFO interface */ + struct { + uint32 file_index; + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + large_t size; + large_t alloc_size; + uint32 attrib; + uint32 ea_size; + WIRE_STRING short_name; + WIRE_STRING name; + } both_directory_info; + + /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */ + struct { + uint32 file_index; + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + large_t size; + large_t alloc_size; + uint32 attrib; + uint32 ea_size; + large_t file_id; + WIRE_STRING name; + } id_full_directory_info; + + /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */ + struct { + uint32 file_index; + NTTIME create_time; + NTTIME access_time; + NTTIME write_time; + NTTIME change_time; + large_t size; + large_t alloc_size; + uint32 attrib; + uint32 ea_size; + large_t file_id; + WIRE_STRING short_name; + WIRE_STRING name; + } id_both_directory_info; + + /* RAW_SEARCH_UNIX_INFO interface */ + struct { + large_t end_of_file; + large_t num_bytes; + NTTIME status_change_time; + NTTIME access_time; + NTTIME change_time; + large_t uid; + large_t gid; + uint32 file_type; + large_t dev_major; + large_t dev_minor; + large_t unique_id; + large_t permissions; + large_t nlink; + } unix_info; +}; + + +enum search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_CLOSE}; + +/* union for file search close */ +union smb_search_close { + struct { + enum search_close_level level; + } generic; + + /* SMBfclose (old search) interface */ + struct { + enum search_level level; + + struct { + uint16 max_count; + uint16 search_attrib; + DATA_BLOB search_id; + } in; + struct { + uint16 count; + } out; + } search_next; + + /* SMBfindclose interface */ + struct { + enum search_close_level level; + + struct { + uint16 handle; + } in; + } findclose; +}; + diff --git a/source/include/smb_macros.h b/source/include/smb_macros.h index c3bdba30b15..6f8ecd6c211 100644 --- a/source/include/smb_macros.h +++ b/source/include/smb_macros.h @@ -44,7 +44,7 @@ * @note You are explicitly allowed to pass NULL pointers -- they will * always be ignored. **/ -#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) +#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); (x)=NULL;} } while(0) #endif /* zero a structure */ @@ -67,42 +67,11 @@ #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) /* assert macros */ -#define SMB_ASSERT(b) ((b)?(void)0: \ - (DEBUG(0,("PANIC: assert failed at %s(%d)\n", \ - __FILE__, __LINE__)), smb_panic("assert failed"))) -#define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) +#define SMB_ASSERT(b) do { if (!(b)) { \ + DEBUG(0,("PANIC: assert failed at %s(%d)\n", __FILE__, __LINE__)); \ + smb_panic("assert failed"); }} while (0) -/* these are useful macros for checking validity of handles */ -#define OPEN_FSP(fsp) ((fsp) && !(fsp)->is_directory) -#define OPEN_CONN(conn) ((conn) && (conn)->open) -#define IS_IPC(conn) ((conn) && (conn)->ipc) -#define IS_PRINT(conn) ((conn) && (conn)->printer) -#define FSP_BELONGS_CONN(fsp,conn) do {\ - extern struct current_user current_user;\ - if (!((fsp) && (conn) && ((conn)==(fsp)->conn) && (current_user.vuid==(fsp)->vuid))) \ - return(ERROR_DOS(ERRDOS,ERRbadfid));\ - } while(0) - -#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn && current_user.vuid==(fsp)->vuid) - -#define CHECK_FSP(fsp,conn) do {\ - extern struct current_user current_user;\ - if (!FNUM_OK(fsp,conn)) \ - return(ERROR_DOS(ERRDOS,ERRbadfid)); \ - else if((fsp)->fd == -1) \ - return(ERROR_DOS(ERRDOS,ERRbadaccess));\ - } while(0) - -#define CHECK_READ(fsp) if (!(fsp)->can_read) \ - return(ERROR_DOS(ERRDOS,ERRbadaccess)) -#define CHECK_WRITE(fsp) if (!(fsp)->can_write) \ - return(ERROR_DOS(ERRDOS,ERRbadaccess)) - -#define CHECK_ERROR(fsp) if (HAS_CACHED_ERROR(fsp)) \ - return(CACHED_ERROR(fsp)) - -#define ERROR_WAS_LOCK_DENIED(status) (NT_STATUS_EQUAL((status), NT_STATUS_LOCK_NOT_GRANTED) || \ - NT_STATUS_EQUAL((status), NT_STATUS_FILE_LOCK_CONFLICT) ) +#define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) /* the service number for the [globals] defaults */ #define GLOBAL_SECTION_SNUM (-1) @@ -112,19 +81,10 @@ /* access various service details */ #define SERVICE(snum) (lp_servicename(snum)) -#define PRINTERNAME(snum) (lp_printername(snum)) +#define PRINTERNAME_NOTUSED(snum) (lp_printername(snum)) #define CAN_WRITE(conn) (!conn->read_only) #define VALID_SNUM(snum) (lp_snum_ok(snum)) #define GUEST_OK(snum) (VALID_SNUM(snum) && lp_guest_ok(snum)) -#define GUEST_ONLY(snum) (VALID_SNUM(snum) && lp_guest_only(snum)) -#define CAN_SETDIR(snum) (!lp_no_set_dir(snum)) -#define CAN_PRINT(conn) ((conn) && lp_print_ok((conn)->service)) -#define MAP_HIDDEN(conn) ((conn) && lp_map_hidden((conn)->service)) -#define MAP_SYSTEM(conn) ((conn) && lp_map_system((conn)->service)) -#define MAP_ARCHIVE(conn) ((conn) && lp_map_archive((conn)->service)) -#define IS_HIDDEN_PATH(conn,path) ((conn) && is_in_path((path),(conn)->hide_list)) -#define IS_VETO_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_list)) -#define IS_VETO_OPLOCK_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_oplock_list)) /* * Used by the stat cache code to check if a returned @@ -145,29 +105,6 @@ #define ABS(a) ((a)>0?(a):(-(a))) #endif -/* Macros to get at offsets within smb_lkrng and smb_unlkrng - structures. We cannot define these as actual structures - due to possible differences in structure packing - on different machines/compilers. */ - -#define SMB_LPID_OFFSET(indx) (10 * (indx)) -#define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx))) -#define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx))) -#define SMB_LARGE_LPID_OFFSET(indx) (20 * (indx)) -#define SMB_LARGE_LKOFF_OFFSET_HIGH(indx) (4 + (20 * (indx))) -#define SMB_LARGE_LKOFF_OFFSET_LOW(indx) (8 + (20 * (indx))) -#define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) -#define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) - -/* Macro to cache an error in a write_bmpx_struct */ -#define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \ - w->wr_discard = True, -1) -/* Macro to test if an error has been cached for this fnum */ -#define HAS_CACHED_ERROR(fsp) ((fsp)->wbmpx_ptr && \ - (fsp)->wbmpx_ptr->wr_discard) -/* Macro to turn the cached error into an error packet */ -#define CACHED_ERROR(fsp) cached_error_packet(outbuf,fsp,__LINE__,__FILE__) - /* these are the datagram types */ #define DGRAM_DIRECT_UNIQUE 0x10 @@ -178,21 +115,16 @@ /* this is how errors are generated */ #define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,__LINE__,__FILE__) -#define SMB_ROUNDUP(x,r) ( ((x)%(r)) ? ( (((x)+(r))/(r))*(r) ) : (x)) - -/* Extra macros added by Ying Chen at IBM - speed increase by inlining. */ -#define smb_buf(buf) (((char *)(buf)) + smb_size + CVAL(buf,smb_wct)*2) -#define smb_buflen(buf) (SVAL(buf,smb_vwv0 + (int)CVAL(buf, smb_wct)*2)) +/* REWRITE TODO: remove these smb_xxx macros */ +#define smb_buf(buf) (((char *)(buf)) + MIN_SMB_SIZE + CVAL(buf,HDR_WCT+4)*2) /* the remaining number of bytes in smb buffer 'buf' from pointer 'p'. */ #define smb_bufrem(buf, p) (smb_buflen(buf)-PTR_DIFF(p, smb_buf(buf))) -/* Note that chain_size must be available as an extern int to this macro. */ -#define smb_offset(p,buf) (PTR_DIFF(p,buf+4) + chain_size) -#define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|((PVAL(buf,1)&1)<<16)) -#define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = (len&0x10000)>>16; \ - buf[2] = (len&0xFF00)>>8; buf[3] = len&0xFF; } while (0) +#define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|(PVAL(buf,1)<<16)) +#define _smb_setlen(buf,len) do {(buf)[0] = 0; (buf)[1] = ((len)&0x10000)>>16; \ + (buf)[2] = ((len)&0xFF00)>>8; (buf)[3] = (len)&0xFF;} while (0) /******************************************************************* find the difference in milliseconds between two struct timeval @@ -208,7 +140,6 @@ true if two IP addresses are equal ****************************************************************************/ #define ip_equal(ip1,ip2) ((ip1).s_addr == (ip2).s_addr) -#define ip_service_equal(ip1,ip2) ( ((ip1).ip.s_addr == (ip2).ip.s_addr) && ((ip1).port == (ip2).port) ) /***************************************************************** splits out the last subkey of a key @@ -239,13 +170,12 @@ copy an IP address from one buffer to another Return True if a server has CIFS UNIX capabilities. ********************************************************************/ -#define SERVER_HAS_UNIX_CIFS(c) ((c)->capabilities & CAP_UNIX) +#define SERVER_HAS_UNIX_CIFS(c) (cli_state_has_unix_cifs(c)) /**************************************************************************** Make a filename into unix format. ****************************************************************************/ -#define IS_DIRECTORY_SEP(c) ((c) == '\\' || (c) == '/') #define unix_format(fname) string_replace(fname,'\\','/') #define unix_format_w(fname) string_replace_w(fname, UCS2_CHAR('\\'), UCS2_CHAR('/')) @@ -255,10 +185,4 @@ copy an IP address from one buffer to another #define dos_format(fname) string_replace(fname,'/','\\') -/***************************************************************************** - Check to see if we are a DO for this domain -*****************************************************************************/ - -#define IS_DC (lp_server_role()==ROLE_DOMAIN_PDC || lp_server_role()==ROLE_DOMAIN_BDC) - #endif /* _SMB_MACROS_H */ diff --git a/source/include/smbldap.h b/source/include/smbldap.h deleted file mode 100644 index 119479f218d..00000000000 --- a/source/include/smbldap.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - Unix SMB/CIFS mplementation. - LDAP protocol helper functions for SAMBA - Copyright (C) Gerald Carter 2001-2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef _SMBLDAP_H -#define _SMBLDAP_H - -#ifdef HAVE_LDAP - -/* specify schema versions between 2.2. and 3.0 */ - -#define SCHEMAVER_SAMBAACCOUNT 1 -#define SCHEMAVER_SAMBASAMACCOUNT 2 - -/* objectclass names */ - -#define LDAP_OBJ_SAMBASAMACCOUNT "sambaSamAccount" -#define LDAP_OBJ_SAMBAACCOUNT "sambaAccount" -#define LDAP_OBJ_GROUPMAP "sambaGroupMapping" -#define LDAP_OBJ_DOMINFO "sambaDomain" -#define LDAP_OBJ_IDPOOL "sambaUnixIdPool" -#define LDAP_OBJ_IDMAP_ENTRY "sambaIdmapEntry" -#define LDAP_OBJ_SID_ENTRY "sambaSidEntry" -#define LDAP_OBJ_PRIVILEGE "sambaPrivilege" - -#define LDAP_OBJ_ACCOUNT "account" -#define LDAP_OBJ_POSIXACCOUNT "posixAccount" -#define LDAP_OBJ_POSIXGROUP "posixGroup" -#define LDAP_OBJ_OU "organizationalUnit" - -/* some generic attributes that get reused a lot */ - -#define LDAP_ATTRIBUTE_SID "sambaSID" -#define LDAP_ATTRIBUTE_UIDNUMBER "uidNumber" -#define LDAP_ATTRIBUTE_GIDNUMBER "gidNumber" -#define LDAP_ATTRIBUTE_SID_LIST "sambaSIDList" - -/* attribute map table indexes */ - -#define LDAP_ATTR_LIST_END 0 -#define LDAP_ATTR_UID 1 -#define LDAP_ATTR_UIDNUMBER 2 -#define LDAP_ATTR_GIDNUMBER 3 -#define LDAP_ATTR_UNIX_HOME 4 -#define LDAP_ATTR_PWD_LAST_SET 5 -#define LDAP_ATTR_PWD_CAN_CHANGE 6 -#define LDAP_ATTR_PWD_MUST_CHANGE 7 -#define LDAP_ATTR_LOGON_TIME 8 -#define LDAP_ATTR_LOGOFF_TIME 9 -#define LDAP_ATTR_KICKOFF_TIME 10 -#define LDAP_ATTR_CN 11 -#define LDAP_ATTR_DISPLAY_NAME 12 -#define LDAP_ATTR_HOME_PATH 13 -#define LDAP_ATTR_LOGON_SCRIPT 14 -#define LDAP_ATTR_PROFILE_PATH 15 -#define LDAP_ATTR_DESC 16 -#define LDAP_ATTR_USER_WKS 17 -#define LDAP_ATTR_USER_SID 18 -#define LDAP_ATTR_USER_RID 18 -#define LDAP_ATTR_PRIMARY_GROUP_SID 19 -#define LDAP_ATTR_PRIMARY_GROUP_RID 20 -#define LDAP_ATTR_LMPW 21 -#define LDAP_ATTR_NTPW 22 -#define LDAP_ATTR_DOMAIN 23 -#define LDAP_ATTR_OBJCLASS 24 -#define LDAP_ATTR_ACB_INFO 25 -#define LDAP_ATTR_NEXT_USERRID 26 -#define LDAP_ATTR_NEXT_GROUPRID 27 -#define LDAP_ATTR_DOM_SID 28 -#define LDAP_ATTR_HOME_DRIVE 29 -#define LDAP_ATTR_GROUP_SID 30 -#define LDAP_ATTR_GROUP_TYPE 31 -#define LDAP_ATTR_SID 32 -#define LDAP_ATTR_ALGORITHMIC_RID_BASE 33 -#define LDAP_ATTR_NEXT_RID 34 -#define LDAP_ATTR_BAD_PASSWORD_COUNT 35 -#define LDAP_ATTR_LOGON_COUNT 36 -#define LDAP_ATTR_MUNGED_DIAL 37 -#define LDAP_ATTR_BAD_PASSWORD_TIME 38 -#define LDAP_ATTR_MOD_TIMESTAMP 39 -#define LDAP_ATTR_SID_LIST 40 - -typedef struct _attrib_map_entry { - int attrib; - const char *name; -} ATTRIB_MAP_ENTRY; - - -/* structures */ - -extern ATTRIB_MAP_ENTRY attrib_map_v22[]; -extern ATTRIB_MAP_ENTRY attrib_map_v30[]; -extern ATTRIB_MAP_ENTRY dominfo_attr_list[]; -extern ATTRIB_MAP_ENTRY groupmap_attr_list[]; -extern ATTRIB_MAP_ENTRY privilege_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[]; - -/* Function declarations -- not included in proto.h so we don't - have to worry about LDAP structure types */ - -const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key ); -char** get_attr_list( ATTRIB_MAP_ENTRY table[] ); -void free_attr_list( char **list ); -void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value); -void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing, - LDAPMod ***mods, - const char *attribute, const char *newval); -BOOL smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry, - const char *attribute, char *value, - int max_len); -BOOL smbldap_get_single_pstring (LDAP * ldap_struct, LDAPMessage * entry, - const char *attribute, pstring value); - -/** - * Struct to keep the state for all the ldap stuff - * - */ - -struct smbldap_state { - LDAP *ldap_struct; - time_t last_ping; - /* retrive-once info */ - const char *uri; - char *bind_dn; - char *bind_secret; - - unsigned int num_failures; - - time_t last_use; - smb_event_id_t event_id; - - struct timeval last_rebind; -}; - -#endif /* HAVE_LDAP */ - -struct smbldap_state; - -#endif /* _SMBLDAP_H */ - diff --git a/source/include/smbprofile.h b/source/include/smbprofile.h deleted file mode 100644 index e494faf7da6..00000000000 --- a/source/include/smbprofile.h +++ /dev/null @@ -1,485 +0,0 @@ -#ifndef _PROFILE_H_ -#define _PROFILE_H_ -/* - Unix SMB/CIFS implementation. - store smbd profiling information in shared memory - Copyright (C) Andrew Tridgell 1999 - - 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. - -*/ - -/* - * Reasons for cache flush. - */ - -#define NUM_FLUSH_REASONS 8 /* Keep this in sync with the enum below. */ -enum flush_reason_enum { SEEK_FLUSH, READ_FLUSH, WRITE_FLUSH, READRAW_FLUSH, - OPLOCK_RELEASE_FLUSH, CLOSE_FLUSH, SYNC_FLUSH, SIZECHANGE_FLUSH }; - -/* this file defines the profile structure in the profile shared - memory area */ - -#define PROF_SHMEM_KEY ((key_t)0x07021999) -#define PROF_SHM_MAGIC 0x6349985 -#define PROF_SHM_VERSION 9 - -/* time values in the following structure are in microseconds */ - -struct profile_stats { -/* general counters */ - unsigned smb_count; /* how many SMB packets we have processed */ - unsigned uid_changes; /* how many times we change our effective uid */ -/* system call counters */ - unsigned syscall_opendir_count; - unsigned syscall_opendir_time; - unsigned syscall_readdir_count; - unsigned syscall_readdir_time; - unsigned syscall_mkdir_count; - unsigned syscall_mkdir_time; - unsigned syscall_rmdir_count; - unsigned syscall_rmdir_time; - unsigned syscall_closedir_count; - unsigned syscall_closedir_time; - unsigned syscall_open_count; - unsigned syscall_open_time; - unsigned syscall_close_count; - unsigned syscall_close_time; - unsigned syscall_read_count; - unsigned syscall_read_time; - unsigned syscall_read_bytes; /* bytes read with read syscall */ - unsigned syscall_pread_count; - unsigned syscall_pread_time; - unsigned syscall_pread_bytes; /* bytes read with pread syscall */ - unsigned syscall_write_count; - unsigned syscall_write_time; - unsigned syscall_write_bytes; /* bytes written with write syscall */ - unsigned syscall_pwrite_count; - unsigned syscall_pwrite_time; - unsigned syscall_pwrite_bytes; /* bytes written with pwrite syscall */ - unsigned syscall_lseek_count; - unsigned syscall_lseek_time; - unsigned syscall_sendfile_count; - unsigned syscall_sendfile_time; - unsigned syscall_sendfile_bytes; /* bytes read with sendfile syscall */ - unsigned syscall_rename_count; - unsigned syscall_rename_time; - unsigned syscall_fsync_count; - unsigned syscall_fsync_time; - unsigned syscall_stat_count; - unsigned syscall_stat_time; - unsigned syscall_fstat_count; - unsigned syscall_fstat_time; - unsigned syscall_lstat_count; - unsigned syscall_lstat_time; - unsigned syscall_unlink_count; - unsigned syscall_unlink_time; - unsigned syscall_chmod_count; - unsigned syscall_chmod_time; - unsigned syscall_fchmod_count; - unsigned syscall_fchmod_time; - unsigned syscall_chown_count; - unsigned syscall_chown_time; - unsigned syscall_fchown_count; - unsigned syscall_fchown_time; - unsigned syscall_chdir_count; - unsigned syscall_chdir_time; - unsigned syscall_getwd_count; - unsigned syscall_getwd_time; - unsigned syscall_utime_count; - unsigned syscall_utime_time; - unsigned syscall_ftruncate_count; - unsigned syscall_ftruncate_time; - unsigned syscall_fcntl_lock_count; - unsigned syscall_fcntl_lock_time; - unsigned syscall_readlink_count; - unsigned syscall_readlink_time; - unsigned syscall_symlink_count; - unsigned syscall_symlink_time; - unsigned syscall_link_count; - unsigned syscall_link_time; - unsigned syscall_mknod_count; - unsigned syscall_mknod_time; - unsigned syscall_realpath_count; - unsigned syscall_realpath_time; - unsigned syscall_get_quota_count; - unsigned syscall_get_quota_time; - unsigned syscall_set_quota_count; - unsigned syscall_set_quota_time; -/* stat cache counters */ - unsigned statcache_lookups; - unsigned statcache_misses; - unsigned statcache_hits; -/* write cache counters */ - unsigned writecache_read_hits; - unsigned writecache_abutted_writes; - unsigned writecache_total_writes; - unsigned writecache_non_oplock_writes; - unsigned writecache_direct_writes; - unsigned writecache_init_writes; - unsigned writecache_flushed_writes[NUM_FLUSH_REASONS]; - unsigned writecache_num_perfect_writes; - unsigned writecache_num_write_caches; - unsigned writecache_allocated_write_caches; -/* counters for individual SMB types */ - unsigned SMBmkdir_count; /* create directory */ - unsigned SMBmkdir_time; - unsigned SMBrmdir_count; /* delete directory */ - unsigned SMBrmdir_time; - unsigned SMBopen_count; /* open file */ - unsigned SMBopen_time; - unsigned SMBcreate_count; /* create file */ - unsigned SMBcreate_time; - unsigned SMBclose_count; /* close file */ - unsigned SMBclose_time; - unsigned SMBflush_count; /* flush file */ - unsigned SMBflush_time; - unsigned SMBunlink_count; /* delete file */ - unsigned SMBunlink_time; - unsigned SMBmv_count; /* rename file */ - unsigned SMBmv_time; - unsigned SMBgetatr_count; /* get file attributes */ - unsigned SMBgetatr_time; - unsigned SMBsetatr_count; /* set file attributes */ - unsigned SMBsetatr_time; - unsigned SMBread_count; /* read from file */ - unsigned SMBread_time; - unsigned SMBwrite_count; /* write to file */ - unsigned SMBwrite_time; - unsigned SMBlock_count; /* lock byte range */ - unsigned SMBlock_time; - unsigned SMBunlock_count; /* unlock byte range */ - unsigned SMBunlock_time; - unsigned SMBctemp_count; /* create temporary file */ - unsigned SMBctemp_time; - /* SMBmknew stats are currently combined with SMBcreate */ - unsigned SMBmknew_count; /* make new file */ - unsigned SMBmknew_time; - unsigned SMBchkpth_count; /* check directory path */ - unsigned SMBchkpth_time; - unsigned SMBexit_count; /* process exit */ - unsigned SMBexit_time; - unsigned SMBlseek_count; /* seek */ - unsigned SMBlseek_time; - unsigned SMBlockread_count; /* Lock a range and read */ - unsigned SMBlockread_time; - unsigned SMBwriteunlock_count; /* Unlock a range then write */ - unsigned SMBwriteunlock_time; - unsigned SMBreadbraw_count; /* read a block of data with no smb header */ - unsigned SMBreadbraw_time; - unsigned SMBreadBmpx_count; /* read block multiplexed */ - unsigned SMBreadBmpx_time; - unsigned SMBreadBs_count; /* read block (secondary response) */ - unsigned SMBreadBs_time; - unsigned SMBwritebraw_count; /* write a block of data with no smb header */ - unsigned SMBwritebraw_time; - unsigned SMBwriteBmpx_count; /* write block multiplexed */ - unsigned SMBwriteBmpx_time; - unsigned SMBwriteBs_count; /* write block (secondary request) */ - unsigned SMBwriteBs_time; - unsigned SMBwritec_count; /* secondary write request */ - unsigned SMBwritec_time; - unsigned SMBsetattrE_count; /* set file attributes expanded */ - unsigned SMBsetattrE_time; - unsigned SMBgetattrE_count; /* get file attributes expanded */ - unsigned SMBgetattrE_time; - unsigned SMBlockingX_count; /* lock/unlock byte ranges and X */ - unsigned SMBlockingX_time; - unsigned SMBtrans_count; /* transaction - name, bytes in/out */ - unsigned SMBtrans_time; - unsigned SMBtranss_count; /* transaction (secondary request/response) */ - unsigned SMBtranss_time; - unsigned SMBioctl_count; /* IOCTL */ - unsigned SMBioctl_time; - unsigned SMBioctls_count; /* IOCTL (secondary request/response) */ - unsigned SMBioctls_time; - unsigned SMBcopy_count; /* copy */ - unsigned SMBcopy_time; - unsigned SMBmove_count; /* move */ - unsigned SMBmove_time; - unsigned SMBecho_count; /* echo */ - unsigned SMBecho_time; - unsigned SMBwriteclose_count; /* write a file then close it */ - unsigned SMBwriteclose_time; - unsigned SMBopenX_count; /* open and X */ - unsigned SMBopenX_time; - unsigned SMBreadX_count; /* read and X */ - unsigned SMBreadX_time; - unsigned SMBwriteX_count; /* write and X */ - unsigned SMBwriteX_time; - unsigned SMBtrans2_count; /* TRANS2 protocol set */ - unsigned SMBtrans2_time; - unsigned SMBtranss2_count; /* TRANS2 protocol set, secondary command */ - unsigned SMBtranss2_time; - unsigned SMBfindclose_count; /* Terminate a TRANSACT2_FINDFIRST */ - unsigned SMBfindclose_time; - unsigned SMBfindnclose_count; /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ - unsigned SMBfindnclose_time; - unsigned SMBtcon_count; /* tree connect */ - unsigned SMBtcon_time; - unsigned SMBtdis_count; /* tree disconnect */ - unsigned SMBtdis_time; - unsigned SMBnegprot_count; /* negotiate protocol */ - unsigned SMBnegprot_time; - unsigned SMBsesssetupX_count; /* Session Set Up & X (including User Logon) */ - unsigned SMBsesssetupX_time; - unsigned SMBulogoffX_count; /* user logoff */ - unsigned SMBulogoffX_time; - unsigned SMBtconX_count; /* tree connect and X*/ - unsigned SMBtconX_time; - unsigned SMBdskattr_count; /* get disk attributes */ - unsigned SMBdskattr_time; - unsigned SMBsearch_count; /* search directory */ - unsigned SMBsearch_time; - /* SBMffirst stats combined with SMBsearch */ - unsigned SMBffirst_count; /* find first */ - unsigned SMBffirst_time; - /* SBMfunique stats combined with SMBsearch */ - unsigned SMBfunique_count; /* find unique */ - unsigned SMBfunique_time; - unsigned SMBfclose_count; /* find close */ - unsigned SMBfclose_time; - unsigned SMBnttrans_count; /* NT transact */ - unsigned SMBnttrans_time; - unsigned SMBnttranss_count; /* NT transact secondary */ - unsigned SMBnttranss_time; - unsigned SMBntcreateX_count; /* NT create and X */ - unsigned SMBntcreateX_time; - unsigned SMBntcancel_count; /* NT cancel */ - unsigned SMBntcancel_time; - unsigned SMBntrename_count; /* NT rename file */ - unsigned SMBntrename_time; - unsigned SMBsplopen_count; /* open print spool file */ - unsigned SMBsplopen_time; - unsigned SMBsplwr_count; /* write to print spool file */ - unsigned SMBsplwr_time; - unsigned SMBsplclose_count; /* close print spool file */ - unsigned SMBsplclose_time; - unsigned SMBsplretq_count; /* return print queue */ - unsigned SMBsplretq_time; - unsigned SMBsends_count; /* send single block message */ - unsigned SMBsends_time; - unsigned SMBsendb_count; /* send broadcast message */ - unsigned SMBsendb_time; - unsigned SMBfwdname_count; /* forward user name */ - unsigned SMBfwdname_time; - unsigned SMBcancelf_count; /* cancel forward */ - unsigned SMBcancelf_time; - unsigned SMBgetmac_count; /* get machine name */ - unsigned SMBgetmac_time; - unsigned SMBsendstrt_count; /* send start of multi-block message */ - unsigned SMBsendstrt_time; - unsigned SMBsendend_count; /* send end of multi-block message */ - unsigned SMBsendend_time; - unsigned SMBsendtxt_count; /* send text of multi-block message */ - unsigned SMBsendtxt_time; - unsigned SMBinvalid_count; /* invalid command */ - unsigned SMBinvalid_time; -/* Pathworks setdir command */ - unsigned pathworks_setdir_count; - unsigned pathworks_setdir_time; -/* These are the TRANS2 sub commands */ - unsigned Trans2_open_count; - unsigned Trans2_open_time; - unsigned Trans2_findfirst_count; - unsigned Trans2_findfirst_time; - unsigned Trans2_findnext_count; - unsigned Trans2_findnext_time; - unsigned Trans2_qfsinfo_count; - unsigned Trans2_qfsinfo_time; - unsigned Trans2_setfsinfo_count; - unsigned Trans2_setfsinfo_time; - unsigned Trans2_qpathinfo_count; - unsigned Trans2_qpathinfo_time; - unsigned Trans2_setpathinfo_count; - unsigned Trans2_setpathinfo_time; - unsigned Trans2_qfileinfo_count; - unsigned Trans2_qfileinfo_time; - unsigned Trans2_setfileinfo_count; - unsigned Trans2_setfileinfo_time; - unsigned Trans2_fsctl_count; - unsigned Trans2_fsctl_time; - unsigned Trans2_ioctl_count; - unsigned Trans2_ioctl_time; - unsigned Trans2_findnotifyfirst_count; - unsigned Trans2_findnotifyfirst_time; - unsigned Trans2_findnotifynext_count; - unsigned Trans2_findnotifynext_time; - unsigned Trans2_mkdir_count; - unsigned Trans2_mkdir_time; - unsigned Trans2_session_setup_count; - unsigned Trans2_session_setup_time; - unsigned Trans2_get_dfs_referral_count; - unsigned Trans2_get_dfs_referral_time; - unsigned Trans2_report_dfs_inconsistancy_count; - unsigned Trans2_report_dfs_inconsistancy_time; -/* These are the NT transact sub commands. */ - unsigned NT_transact_create_count; - unsigned NT_transact_create_time; - unsigned NT_transact_ioctl_count; - unsigned NT_transact_ioctl_time; - unsigned NT_transact_set_security_desc_count; - unsigned NT_transact_set_security_desc_time; - unsigned NT_transact_notify_change_count; - unsigned NT_transact_notify_change_time; - unsigned NT_transact_rename_count; - unsigned NT_transact_rename_time; - unsigned NT_transact_query_security_desc_count; - unsigned NT_transact_query_security_desc_time; - unsigned NT_transact_get_user_quota_count; - unsigned NT_transact_get_user_quota_time; - unsigned NT_transact_set_user_quota_count; - unsigned NT_transact_set_user_quota_time; -/* These are ACL manipulation calls */ - unsigned get_nt_acl_count; - unsigned get_nt_acl_time; - unsigned fget_nt_acl_count; - unsigned fget_nt_acl_time; - unsigned set_nt_acl_count; - unsigned set_nt_acl_time; - unsigned fset_nt_acl_count; - unsigned fset_nt_acl_time; - unsigned chmod_acl_count; - unsigned chmod_acl_time; - unsigned fchmod_acl_count; - unsigned fchmod_acl_time; -/* These are nmbd stats */ - unsigned name_release_count; - unsigned name_release_time; - unsigned name_refresh_count; - unsigned name_refresh_time; - unsigned name_registration_count; - unsigned name_registration_time; - unsigned node_status_count; - unsigned node_status_time; - unsigned name_query_count; - unsigned name_query_time; - unsigned host_announce_count; - unsigned host_announce_time; - unsigned workgroup_announce_count; - unsigned workgroup_announce_time; - unsigned local_master_announce_count; - unsigned local_master_announce_time; - unsigned master_browser_announce_count; - unsigned master_browser_announce_time; - unsigned lm_host_announce_count; - unsigned lm_host_announce_time; - unsigned get_backup_list_count; - unsigned get_backup_list_time; - unsigned reset_browser_count; - unsigned reset_browser_time; - unsigned announce_request_count; - unsigned announce_request_time; - unsigned lm_announce_request_count; - unsigned lm_announce_request_time; - unsigned domain_logon_count; - unsigned domain_logon_time; - unsigned sync_browse_lists_count; - unsigned sync_browse_lists_time; - unsigned run_elections_count; - unsigned run_elections_time; - unsigned election_count; - unsigned election_time; -}; - -struct profile_header { - int prof_shm_magic; - int prof_shm_version; - struct profile_stats stats; -}; - -extern struct profile_header *profile_h; -extern struct profile_stats *profile_p; -extern struct timeval profile_starttime; -extern struct timeval profile_endtime; -extern struct timeval profile_starttime_nested; -extern struct timeval profile_endtime_nested; -extern BOOL do_profile_flag; -extern BOOL do_profile_times; - -/* these are helper macros - do not call them directly in the code - * use the DO_PROFILE_* START_PROFILE and END_PROFILE ones - * below which test for the profile flage first - */ -#define INC_PROFILE_COUNT(x) profile_p->x++ -#define DEC_PROFILE_COUNT(x) profile_p->x-- -#define ADD_PROFILE_COUNT(x,y) profile_p->x += (y) -#define PROFILE_TIME \ - ((profile_endtime.tv_sec - profile_starttime.tv_sec) *1000000 + \ - ((int)profile_endtime.tv_usec - (int)profile_starttime.tv_usec)) -#define PROFILE_TIME_NESTED \ - ((profile_endtime_nested.tv_sec - profile_starttime_nested.tv_sec) *1000000 + \ - ((int)profile_endtime_nested.tv_usec - (int)profile_starttime_nested.tv_usec)) - -#ifdef WITH_PROFILE -#define DO_PROFILE_INC(x) \ - if (do_profile_flag) { \ - INC_PROFILE_COUNT(x); \ - } -#define DO_PROFILE_DEC(x) \ - if (do_profile_flag) { \ - DEC_PROFILE_COUNT(x); \ - } -#define DO_PROFILE_DEC_INC(x,y) \ - if (do_profile_flag) { \ - DEC_PROFILE_COUNT(x); \ - INC_PROFILE_COUNT(y); \ - } -#define DO_PROFILE_ADD(x,n) \ - if (do_profile_flag) { \ - ADD_PROFILE_COUNT(x,n); \ - } -#define START_PROFILE(x) \ - if (do_profile_flag) { \ - if (do_profile_times) \ - GetTimeOfDay(&profile_starttime); \ - INC_PROFILE_COUNT(x##_count); \ - } -#define START_PROFILE_NESTED(x) \ - if (do_profile_flag) { \ - if (do_profile_times) \ - GetTimeOfDay(&profile_starttime_nested); \ - INC_PROFILE_COUNT(x##_count); \ - } -#define START_PROFILE_BYTES(x,n) \ - if (do_profile_flag) { \ - if (do_profile_times) \ - GetTimeOfDay(&profile_starttime); \ - INC_PROFILE_COUNT(x##_count); \ - ADD_PROFILE_COUNT(x##_bytes,n); \ - } -#define END_PROFILE(x) \ - if (do_profile_times) { \ - GetTimeOfDay(&profile_endtime); \ - ADD_PROFILE_COUNT(x##_time,PROFILE_TIME); \ - } -#define END_PROFILE_NESTED(x) \ - if (do_profile_times) { \ - GetTimeOfDay(&profile_endtime_nested); \ - ADD_PROFILE_COUNT(x##_time,PROFILE_TIME_NESTED); \ - } -#else -#define DO_PROFILE_INC(x) -#define DO_PROFILE_DEC(x) -#define DO_PROFILE_DEC_INC(x,y) -#define DO_PROFILE_ADD(x,n) -#define START_PROFILE(x) -#define START_PROFILE_NESTED(x) -#define START_PROFILE_BYTES(x,n) -#define END_PROFILE(x) -#define END_PROFILE_NESTED(x) -#endif - -#endif diff --git a/source/include/spnego.h b/source/include/spnego.h deleted file mode 100644 index b6492ee3c8a..00000000000 --- a/source/include/spnego.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - RFC2478 Compliant SPNEGO implementation - - Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef SAMBA_SPNEGO_H -#define SAMBA_SPNEGO_H - -#define SPNEGO_DELEG_FLAG 0x01 -#define SPNEGO_MUTUAL_FLAG 0x02 -#define SPNEGO_REPLAY_FLAG 0x04 -#define SPNEGO_SEQUENCE_FLAG 0x08 -#define SPNEGO_ANON_FLAG 0x10 -#define SPNEGO_CONF_FLAG 0x20 -#define SPNEGO_INTEG_FLAG 0x40 -#define SPNEGO_REQ_FLAG 0x80 - -#define SPNEGO_NEG_TOKEN_INIT 0 -#define SPNEGO_NEG_TOKEN_TARG 1 - -typedef enum _spnego_negResult { - SPNEGO_ACCEPT_COMPLETED = 0, - SPNEGO_ACCEPT_INCOMPLETE = 1, - SPNEGO_REJECT = 2 -} negResult_t; - -typedef struct spnego_negTokenInit { - const char **mechTypes; - int reqFlags; - DATA_BLOB mechToken; - DATA_BLOB mechListMIC; -} negTokenInit_t; - -typedef struct spnego_negTokenTarg { - uint8 negResult; - const char *supportedMech; - DATA_BLOB responseToken; - DATA_BLOB mechListMIC; -} negTokenTarg_t; - -typedef struct spnego_spnego { - int type; - negTokenInit_t negTokenInit; - negTokenTarg_t negTokenTarg; -} SPNEGO_DATA; - -#endif diff --git a/source/include/srvstr.h b/source/include/srvstr.h deleted file mode 100644 index 04db59cf012..00000000000 --- a/source/include/srvstr.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Unix SMB/CIFS implementation. - server specific string routines - Copyright (C) Andrew Tridgell 2001 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" - -#define srvstr_pull(base_ptr, dest, src, dest_len, src_len, flags) \ - pull_string(base_ptr, dest, src, dest_len, src_len, flags) - -/* pull a string from the smb_buf part of a packet. In this case the - string can either be null terminated or it can be terminated by the - end of the smbbuf area -*/ - -#define srvstr_pull_buf(inbuf, dest, src, dest_len, flags) \ - pull_string(inbuf, dest, src, dest_len, smb_bufrem(inbuf, src), flags) - diff --git a/source/include/stamp-h.in b/source/include/stamp-h.in deleted file mode 100644 index c9061b3ad3d..00000000000 --- a/source/include/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -Sun Jul 18 20:32:29 UTC 1999 diff --git a/source/include/sysquotas.h b/source/include/sysquotas.h deleted file mode 100644 index bfb9466b392..00000000000 --- a/source/include/sysquotas.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SYS QUOTA code constants - Copyright (C) Stefan (metze) Metzmacher 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _SYSQUOTAS_H -#define _SYSQUOTAS_H - -#ifdef HAVE_SYS_QUOTAS - -#if defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT) -#include <mntent.h> -#define HAVE_MNTENT 1 -/*#endif defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT) */ -#elif defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) -#include <devnm.h> -#endif /* defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) */ - -#endif /* HAVE_SYS_QUOTAS */ - - -/************************************************** - Some stuff for the sys_quota api. - **************************************************/ - -#define SMB_QUOTAS_NO_LIMIT ((SMB_BIG_UINT)(0)) -#define SMB_QUOTAS_NO_SPACE ((SMB_BIG_UINT)(1)) - -#define SMB_QUOTAS_SET_NO_LIMIT(dp) \ -{\ - (dp)->softlimit = SMB_QUOTAS_NO_LIMIT;\ - (dp)->hardlimit = SMB_QUOTAS_NO_LIMIT;\ - (dp)->isoftlimit = SMB_QUOTAS_NO_LIMIT;\ - (dp)->ihardlimit = SMB_QUOTAS_NO_LIMIT;\ -} - -#define SMB_QUOTAS_SET_NO_SPACE(dp) \ -{\ - (dp)->softlimit = SMB_QUOTAS_NO_SPACE;\ - (dp)->hardlimit = SMB_QUOTAS_NO_SPACE;\ - (dp)->isoftlimit = SMB_QUOTAS_NO_SPACE;\ - (dp)->ihardlimit = SMB_QUOTAS_NO_SPACE;\ -} - -typedef struct _SMB_DISK_QUOTA { - enum SMB_QUOTA_TYPE qtype; - SMB_BIG_UINT bsize; - SMB_BIG_UINT hardlimit; /* In bsize units. */ - SMB_BIG_UINT softlimit; /* In bsize units. */ - SMB_BIG_UINT curblocks; /* In bsize units. */ - SMB_BIG_UINT ihardlimit; /* inode hard limit. */ - SMB_BIG_UINT isoftlimit; /* inode soft limit. */ - SMB_BIG_UINT curinodes; /* Current used inodes. */ - uint32 qflags; -} SMB_DISK_QUOTA; - -#ifndef QUOTABLOCK_SIZE -#define QUOTABLOCK_SIZE 1024 -#endif - -#endif /*_SYSQUOTAS_H */ diff --git a/source/include/talloc.h b/source/include/talloc.h index 433b52ec954..60a2822f38e 100644 --- a/source/include/talloc.h +++ b/source/include/talloc.h @@ -30,27 +30,6 @@ /** * talloc allocation pool. All allocated blocks can be freed in one go. **/ - -struct talloc_chunk { - struct talloc_chunk *next; - size_t size; - void *ptr; -}; - -struct talloc_ctx { - struct talloc_chunk *list; - size_t total_alloc_size; - - /** The name recorded for this pool, if any. Should describe - * the purpose for which it was allocated. The string is - * allocated within the pool. **/ - char *name; - - /** Pointer to the next allocate talloc pool, so that we can - * summarize all talloc memory usage. **/ - struct talloc_ctx *next_ctx; -}; - typedef struct talloc_ctx TALLOC_CTX; TALLOC_CTX *talloc_init(char const *fmt, ...) PRINTF_ATTRIBUTE(1, 2); @@ -67,6 +46,11 @@ char *talloc_vasprintf_append(TALLOC_CTX *t, char *, const char *, va_list ap) char *talloc_asprintf_append(TALLOC_CTX *t, char *, const char *, ...) PRINTF_ATTRIBUTE(3, 4); +/* useful macros for creating type checked pointers */ +#define talloc_p(ctx, type) (type *)talloc(ctx, sizeof(type)); +#define talloc_array_p(ctx, type, count) (type *)talloc_realloc_array(ctx, NULL, sizeof(type), count) +#define talloc_realloc_p(ctx, p, type, count) (type *)talloc_realloc_array(ctx, p, sizeof(type), count) + /** @} */ #endif /* ndef _TALLOC_H_ */ diff --git a/source/include/tdbsam2_parse_info.h b/source/include/tdbsam2_parse_info.h deleted file mode 100644 index 35eeaeb2d2c..00000000000 --- a/source/include/tdbsam2_parse_info.h +++ /dev/null @@ -1,2 +0,0 @@ -/* This is an automatically generated file - DO NOT EDIT! */ - diff --git a/source/include/trans2.h b/source/include/trans2.h index 168e6477210..5c9848f40c7 100644 --- a/source/include/trans2.h +++ b/source/include/trans2.h @@ -2,8 +2,7 @@ Unix SMB/CIFS implementation. SMB transaction2 handling Copyright (C) Jeremy Allison 1994-2002. - - Extensively modified by Andrew Tridgell, 1995 + Copyright (C) Andrew Tridgell 1995-2003. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,311 +22,285 @@ #ifndef _TRANS2_H_ #define _TRANS2_H_ -/* Define the structures needed for the trans2 calls. */ - -/******************************************************* - For DosFindFirst/DosFindNext - level 1 - -MAXFILENAMELEN = 255; -FDATE == uint16 -FTIME == uint16 -ULONG == uint32 -USHORT == uint16 - -typedef struct _FILEFINDBUF { -Byte offset Type name description --------------+-------+-------------------+-------------- -0 FDATE fdateCreation; -2 FTIME ftimeCreation; -4 FDATE fdateLastAccess; -6 FTIME ftimeLastAccess; -8 FDATE fdateLastWrite; -10 FTIME ftimeLastWrite; -12 ULONG cbFile file length in bytes -16 ULONG cbFileAlloc size of file allocation unit -20 USHORT attrFile -22 UCHAR cchName length of name to follow (not including zero) -23 UCHAR achName[MAXFILENAMELEN]; Null terminated name -} FILEFINDBUF; -*********************************************************/ - -#define l1_fdateCreation 0 -#define l1_fdateLastAccess 4 -#define l1_fdateLastWrite 8 -#define l1_cbFile 12 -#define l1_cbFileAlloc 16 -#define l1_attrFile 20 -#define l1_cchName 22 -#define l1_achName 23 - -/********************************************************** -For DosFindFirst/DosFindNext - level 2 - -typedef struct _FILEFINDBUF2 { -Byte offset Type name description --------------+-------+-------------------+-------------- -0 FDATE fdateCreation; -2 FTIME ftimeCreation; -4 FDATE fdateLastAccess; -6 FTIME ftimeLastAccess; -8 FDATE fdateLastWrite; -10 FTIME ftimeLastWrite; -12 ULONG cbFile file length in bytes -16 ULONG cbFileAlloc size of file allocation unit -20 USHORT attrFile -22 ULONG cbList Extended attribute list (always 0) -26 UCHAR cchName length of name to follow (not including zero) -27 UCHAR achName[MAXFILENAMELEN]; Null terminated name -} FILEFINDBUF2; -*************************************************************/ - -#define l2_fdateCreation 0 -#define l2_fdateLastAccess 4 -#define l2_fdateLastWrite 8 -#define l2_cbFile 12 -#define l2_cbFileAlloc 16 -#define l2_attrFile 20 -#define l2_cbList 22 -#define l2_cchName 26 -#define l2_achName 27 - - -/********************************************************** -For DosFindFirst/DosFindNext - level 260 - -typedef struct _FILEFINDBUF260 { -Byte offset Type name description --------------+-------+-------------------+-------------- -0 ULONG NextEntryOffset; -4 ULONG FileIndex; -8 LARGE_INTEGER CreationTime; -16 LARGE_INTEGER LastAccessTime; -24 LARGE_INTEGER LastWriteTime; -32 LARGE_INTEGER ChangeTime; -40 LARGE_INTEGER EndOfFile; -48 LARGE_INTEGER AllocationSize; -56 ULONG FileAttributes; -60 ULONG FileNameLength; -64 ULONG EaSize; -68 CHAR ShortNameLength; -70 UNICODE ShortName[12]; -94 UNICODE FileName[]; -*************************************************************/ - -#define l260_achName 94 - - -/********************************************************** -For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/ -DosSetFileInfo - level 1 - -typedef struct _FILESTATUS { -Byte offset Type name description --------------+-------+-------------------+-------------- -0 FDATE fdateCreation; -2 FTIME ftimeCreation; -4 FDATE fdateLastAccess; -6 FTIME ftimeLastAccess; -8 FDATE fdateLastWrite; -10 FTIME ftimeLastWrite; -12 ULONG cbFile file length in bytes -16 ULONG cbFileAlloc size of file allocation unit -20 USHORT attrFile -} FILESTATUS; -*************************************************************/ - -/* Use the l1_ defines from DosFindFirst */ - -/********************************************************** -For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/ -DosSetFileInfo - level 2 - -typedef struct _FILESTATUS2 { -Byte offset Type name description --------------+-------+-------------------+-------------- -0 FDATE fdateCreation; -2 FTIME ftimeCreation; -4 FDATE fdateLastAccess; -6 FTIME ftimeLastAccess; -8 FDATE fdateLastWrite; -10 FTIME ftimeLastWrite; -12 ULONG cbFile file length in bytes -16 ULONG cbFileAlloc size of file allocation unit -20 USHORT attrFile -22 ULONG cbList Length of EA's (0) -} FILESTATUS2; -*************************************************************/ - -/* Use the l2_ #defines from DosFindFirst */ - -/********************************************************** -For DosQFSInfo/DosSetFSInfo - level 1 - -typedef struct _FSALLOCATE { -Byte offset Type name description --------------+-------+-------------------+-------------- -0 ULONG idFileSystem id of file system -4 ULONG cSectorUnit number of sectors per allocation unit -8 ULONG cUnit number of allocation units -12 ULONG cUnitAvail Available allocation units -16 USHORT cbSector bytes per sector -} FSALLOCATE; -*************************************************************/ - -#define l1_idFileSystem 0 -#define l1_cSectorUnit 4 -#define l1_cUnit 8 -#define l1_cUnitAvail 12 -#define l1_cbSector 16 - -/********************************************************** -For DosQFSInfo/DosSetFSInfo - level 2 - -typedef struct _FSINFO { -Byte offset Type name description --------------+-------+-------------------+-------------- -0 FDATE vol_fdateCreation -2 FTIME vol_ftimeCreation -4 UCHAR vol_cch length of volume name (excluding NULL) -5 UCHAR vol_szVolLabel[12] volume name -} FSINFO; -*************************************************************/ - -#define SMB_INFO_STANDARD 1 /* FILESTATUS3 struct */ -#define SMB_INFO_SET_EA 2 /* EAOP2 struct, only valid on set not query */ -#define SMB_INFO_QUERY_EA_SIZE 2 /* FILESTATUS4 struct, only valid on query not set */ -#define SMB_INFO_QUERY_EAS_FROM_LIST 3 /* only valid on query not set */ -#define SMB_INFO_QUERY_ALL_EAS 4 /* only valid on query not set */ -#define SMB_INFO_IS_NAME_VALID 6 -#define SMB_INFO_STANDARD_LONG 11 /* similar to level 1, ie struct FileStatus3 */ -#define SMB_QUERY_EA_SIZE_LONG 12 /* similar to level 2, ie struct FileStatus4 */ -#define SMB_QUERY_FS_LABEL_INFO 0x101 -#define SMB_QUERY_FS_VOLUME_INFO 0x102 -#define SMB_QUERY_FS_SIZE_INFO 0x103 -#define SMB_QUERY_FS_DEVICE_INFO 0x104 -#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 -#if 0 -#define SMB_QUERY_FS_QUOTA_INFO -#endif +/* These are the TRANS2 sub commands */ +#define TRANSACT2_OPEN 0 +#define TRANSACT2_FINDFIRST 1 +#define TRANSACT2_FINDNEXT 2 +#define TRANSACT2_QFSINFO 3 +#define TRANSACT2_SETFSINFO 4 +#define TRANSACT2_QPATHINFO 5 +#define TRANSACT2_SETPATHINFO 6 +#define TRANSACT2_QFILEINFO 7 +#define TRANSACT2_SETFILEINFO 8 +#define TRANSACT2_FSCTL 9 +#define TRANSACT2_IOCTL 0xA +#define TRANSACT2_FINDNOTIFYFIRST 0xB +#define TRANSACT2_FINDNOTIFYNEXT 0xC +#define TRANSACT2_MKDIR 0xD +#define TRANSACT2_SESSION_SETUP 0xE +#define TRANSACT2_GET_DFS_REFERRAL 0x10 +#define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11 + + +/* trans2 Query FS info levels */ +/* +w2k3 TRANS2ALIASES: +Checking for QFSINFO aliases + Found level 1 (0x001) of size 18 (0x12) + Found level 2 (0x002) of size 12 (0x0c) + Found level 258 (0x102) of size 26 (0x1a) + Found level 259 (0x103) of size 24 (0x18) + Found level 260 (0x104) of size 8 (0x08) + Found level 261 (0x105) of size 20 (0x14) + Found level 1001 (0x3e9) of size 26 (0x1a) + Found level 1003 (0x3eb) of size 24 (0x18) + Found level 1004 (0x3ec) of size 8 (0x08) + Found level 1005 (0x3ed) of size 20 (0x14) + Found level 1006 (0x3ee) of size 48 (0x30) + Found level 1007 (0x3ef) of size 32 (0x20) + Found level 1008 (0x3f0) of size 64 (0x40) +Found 13 levels with success status + Level 261 (0x105) and level 1005 (0x3ed) are possible aliases + Level 260 (0x104) and level 1004 (0x3ec) are possible aliases + Level 259 (0x103) and level 1003 (0x3eb) are possible aliases + Level 258 (0x102) and level 1001 (0x3e9) are possible aliases +Found 4 aliased levels +*/ +#define SMB_QFS_ALLOCATION 1 +#define SMB_QFS_VOLUME 2 +#define SMB_QFS_VOLUME_INFO 0x102 +#define SMB_QFS_SIZE_INFO 0x103 +#define SMB_QFS_DEVICE_INFO 0x104 +#define SMB_QFS_ATTRIBUTE_INFO 0x105 +#define SMB_QFS_UNIX_INFO 0x200 +#define SMB_QFS_VOLUME_INFORMATION 1001 +#define SMB_QFS_SIZE_INFORMATION 1003 +#define SMB_QFS_DEVICE_INFORMATION 1004 +#define SMB_QFS_ATTRIBUTE_INFORMATION 1005 +#define SMB_QFS_QUOTA_INFORMATION 1006 +#define SMB_QFS_FULL_SIZE_INFORMATION 1007 +#define SMB_QFS_OBJECTID_INFORMATION 1008 + + +/* trans2 qfileinfo/qpathinfo */ +/* w2k3 TRANS2ALIASES: +Checking for QPATHINFO aliases +setting up complex file \qpathinfo_aliases.txt + Found level 1 (0x001) of size 22 (0x16) + Found level 2 (0x002) of size 26 (0x1a) + Found level 4 (0x004) of size 41 (0x29) + Found level 6 (0x006) of size 0 (0x00) + Found level 257 (0x101) of size 40 (0x28) + Found level 258 (0x102) of size 24 (0x18) + Found level 259 (0x103) of size 4 (0x04) + Found level 260 (0x104) of size 48 (0x30) + Found level 263 (0x107) of size 126 (0x7e) + Found level 264 (0x108) of size 28 (0x1c) + Found level 265 (0x109) of size 38 (0x26) + Found level 267 (0x10b) of size 16 (0x10) + Found level 1004 (0x3ec) of size 40 (0x28) + Found level 1005 (0x3ed) of size 24 (0x18) + Found level 1006 (0x3ee) of size 8 (0x08) + Found level 1007 (0x3ef) of size 4 (0x04) + Found level 1008 (0x3f0) of size 4 (0x04) + Found level 1009 (0x3f1) of size 48 (0x30) + Found level 1014 (0x3f6) of size 8 (0x08) + Found level 1016 (0x3f8) of size 4 (0x04) + Found level 1017 (0x3f9) of size 4 (0x04) + Found level 1018 (0x3fa) of size 126 (0x7e) + Found level 1021 (0x3fd) of size 28 (0x1c) + Found level 1022 (0x3fe) of size 38 (0x26) + Found level 1028 (0x404) of size 16 (0x10) + Found level 1034 (0x40a) of size 56 (0x38) + Found level 1035 (0x40b) of size 8 (0x08) +Found 27 levels with success status + Level 267 (0x10b) and level 1028 (0x404) are possible aliases + Level 265 (0x109) and level 1022 (0x3fe) are possible aliases + Level 264 (0x108) and level 1021 (0x3fd) are possible aliases + Level 263 (0x107) and level 1018 (0x3fa) are possible aliases + Level 260 (0x104) and level 1009 (0x3f1) are possible aliases + Level 259 (0x103) and level 1007 (0x3ef) are possible aliases + Level 258 (0x102) and level 1005 (0x3ed) are possible aliases + Level 257 (0x101) and level 1004 (0x3ec) are possible aliases +Found 8 aliased levels +*/ +#define SMB_QFILEINFO_STANDARD 1 +#define SMB_QFILEINFO_EA_SIZE 2 +#define SMB_QFILEINFO_ALL_EAS 4 +#define SMB_QFILEINFO_IS_NAME_VALID 6 /* only for QPATHINFO */ +#define SMB_QFILEINFO_BASIC_INFO 0x101 +#define SMB_QFILEINFO_STANDARD_INFO 0x102 +#define SMB_QFILEINFO_EA_INFO 0x103 +#define SMB_QFILEINFO_NAME_INFO 0x104 +#define SMB_QFILEINFO_ALL_INFO 0x107 +#define SMB_QFILEINFO_ALT_NAME_INFO 0x108 +#define SMB_QFILEINFO_STREAM_INFO 0x109 +#define SMB_QFILEINFO_COMPRESSION_INFO 0x10b +#define SMB_QFILEINFO_UNIX_BASIC 0x200 +#define SMB_QFILEINFO_UNIX_LINK 0x201 +#define SMB_QFILEINFO_BASIC_INFORMATION 1004 +#define SMB_QFILEINFO_STANDARD_INFORMATION 1005 +#define SMB_QFILEINFO_INTERNAL_INFORMATION 1006 +#define SMB_QFILEINFO_EA_INFORMATION 1007 +#define SMB_QFILEINFO_ACCESS_INFORMATION 1008 +#define SMB_QFILEINFO_NAME_INFORMATION 1009 +#define SMB_QFILEINFO_POSITION_INFORMATION 1014 +#define SMB_QFILEINFO_MODE_INFORMATION 1016 +#define SMB_QFILEINFO_ALIGNMENT_INFORMATION 1017 +#define SMB_QFILEINFO_ALL_INFORMATION 1018 +#define SMB_QFILEINFO_ALT_NAME_INFORMATION 1021 +#define SMB_QFILEINFO_STREAM_INFORMATION 1022 +#define SMB_QFILEINFO_COMPRESSION_INFORMATION 1028 +#define SMB_QFILEINFO_NETWORK_OPEN_INFORMATION 1034 +#define SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION 1035 + + + +/* trans2 setfileinfo/setpathinfo levels */ +/* +w2k3 TRANS2ALIASES +Checking for SETFILEINFO aliases +setting up complex file \setfileinfo_aliases.txt + Found level 1 (0x001) of size 2 (0x02) + Found level 2 (0x002) of size 2 (0x02) + Found level 257 (0x101) of size 40 (0x28) + Found level 258 (0x102) of size 2 (0x02) + Found level 259 (0x103) of size 8 (0x08) + Found level 260 (0x104) of size 8 (0x08) + Found level 1004 (0x3ec) of size 40 (0x28) + Found level 1010 (0x3f2) of size 2 (0x02) + Found level 1013 (0x3f5) of size 2 (0x02) + Found level 1014 (0x3f6) of size 8 (0x08) + Found level 1016 (0x3f8) of size 4 (0x04) + Found level 1019 (0x3fb) of size 8 (0x08) + Found level 1020 (0x3fc) of size 8 (0x08) + Found level 1023 (0x3ff) of size 8 (0x08) + Found level 1025 (0x401) of size 16 (0x10) + Found level 1029 (0x405) of size 72 (0x48) + Found level 1032 (0x408) of size 56 (0x38) + Found level 1039 (0x40f) of size 8 (0x08) + Found level 1040 (0x410) of size 8 (0x08) +Found 19 valid levels + +Checking for SETPATHINFO aliases + Found level 1004 (0x3ec) of size 40 (0x28) + Found level 1010 (0x3f2) of size 2 (0x02) + Found level 1013 (0x3f5) of size 2 (0x02) + Found level 1014 (0x3f6) of size 8 (0x08) + Found level 1016 (0x3f8) of size 4 (0x04) + Found level 1019 (0x3fb) of size 8 (0x08) + Found level 1020 (0x3fc) of size 8 (0x08) + Found level 1023 (0x3ff) of size 8 (0x08) + Found level 1025 (0x401) of size 16 (0x10) + Found level 1029 (0x405) of size 72 (0x48) + Found level 1032 (0x408) of size 56 (0x38) + Found level 1039 (0x40f) of size 8 (0x08) + Found level 1040 (0x410) of size 8 (0x08) +Found 13 valid levels +*/ +#define SMB_SFILEINFO_STANDARD 1 +#define SMB_SFILEINFO_EA_SET 2 +#define SMB_SFILEINFO_BASIC_INFO 0x101 +#define SMB_SFILEINFO_DISPOSITION_INFO 0x102 +#define SMB_SFILEINFO_ALLOCATION_INFO 0x103 +#define SMB_SFILEINFO_END_OF_FILE_INFO 0x104 +#define SMB_SFILEINFO_UNIX_BASIC 0x200 +#define SMB_SFILEINFO_UNIX_LINK 0x201 +#define SMB_SFILEINFO_BASIC_INFORMATION 1004 +#define SMB_SFILEINFO_RENAME_INFORMATION 1010 +#define SMB_SFILEINFO_DISPOSITION_INFORMATION 1013 +#define SMB_SFILEINFO_POSITION_INFORMATION 1014 +#define SMB_SFILEINFO_MODE_INFORMATION 1016 +#define SMB_SFILEINFO_ALLOCATION_INFORMATION 1019 +#define SMB_SFILEINFO_END_OF_FILE_INFORMATION 1020 + +/* filemon shows FilePipeInformation */ +#define SMB_SFILEINFO_1023 1023 + +/* filemon shows FilePipeRemoteInformation */ +#define SMB_SFILEINFO_1025 1025 + +/* filemon shows CopyOnWriteInformation */ +#define SMB_SFILEINFO_1029 1029 + +/* filemon shows OleClassIdInformation */ +#define SMB_SFILEINFO_1032 1032 + +/* seems to be the file size - perhaps valid data size? + filemon shows 'InheritContentIndexInfo' +*/ +#define SMB_SFILEINFO_1039 1039 + +/* OLE_INFORMATION? */ +#define SMB_SFILEINFO_1040 1040 -#define l2_vol_fdateCreation 0 -#define l2_vol_cch 4 -#define l2_vol_szVolLabel 5 - - -#define SMB_QUERY_FILE_BASIC_INFO 0x101 -#define SMB_QUERY_FILE_STANDARD_INFO 0x102 -#define SMB_QUERY_FILE_EA_INFO 0x103 -#define SMB_QUERY_FILE_NAME_INFO 0x104 -#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 -#define SMB_QUERY_FILE_END_OF_FILEINFO 0x106 -#define SMB_QUERY_FILE_ALL_INFO 0x107 -#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 -#define SMB_QUERY_FILE_STREAM_INFO 0x109 -#define SMB_QUERY_COMPRESSION_INFO 0x10b - -#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 -#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 -#define SMB_FIND_FILE_NAMES_INFO 0x103 -#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 -#define SMB_FIND_FILE_LEVEL_261 0x105 -#define SMB_FIND_FILE_LEVEL_262 0x106 - -#define SMB_SET_FILE_BASIC_INFO 0x101 -#define SMB_SET_FILE_DISPOSITION_INFO 0x102 -#define SMB_SET_FILE_ALLOCATION_INFO 0x103 -#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 - -/* Query FS info. */ -#define SMB_INFO_ALLOCATION 1 -#define SMB_INFO_VOLUME 2 +/* trans2 findfirst levels */ /* - * Thursby MAC extensions.... - */ +w2k3 TRANS2ALIASES: +Checking for FINDFIRST aliases + Found level 1 (0x001) of size 68 (0x44) + Found level 2 (0x002) of size 70 (0x46) + Found level 257 (0x101) of size 108 (0x6c) + Found level 258 (0x102) of size 116 (0x74) + Found level 259 (0x103) of size 60 (0x3c) + Found level 260 (0x104) of size 140 (0x8c) + Found level 261 (0x105) of size 124 (0x7c) + Found level 262 (0x106) of size 148 (0x94) +Found 8 levels with success status +Found 0 aliased levels +*/ +#define SMB_FIND_STANDARD 1 +#define SMB_FIND_EA_SIZE 2 +#define SMB_FIND_DIRECTORY_INFO 0x101 +#define SMB_FIND_FULL_DIRECTORY_INFO 0x102 +#define SMB_FIND_NAME_INFO 0x103 +#define SMB_FIND_BOTH_DIRECTORY_INFO 0x104 +#define SMB_FIND_ID_FULL_DIRECTORY_INFO 0x105 +#define SMB_FIND_ID_BOTH_DIRECTORY_INFO 0x106 +#define SMB_FIND_UNIX_INFO 0x200 + +/* flags on trans2 findfirst/findnext that control search */ +#define FLAG_TRANS2_FIND_CLOSE 0x1 +#define FLAG_TRANS2_FIND_CLOSE_IF_END 0x2 +#define FLAG_TRANS2_FIND_REQUIRE_RESUME 0x4 +#define FLAG_TRANS2_FIND_CONTINUE 0x8 +#define FLAG_TRANS2_FIND_BACKUP_INTENT 0x10 /* - * MAC CIFS Extensions have the range 0x300 - 0x2FF reserved. - * Supposedly Microsoft have agreed to this. + * DeviceType and Characteristics returned in a + * SMB_QFS_DEVICE_INFO call. */ +#define QFS_DEVICETYPE_CD_ROM 0x2 +#define QFS_DEVICETYPE_CD_ROM_FILE_SYSTEM 0x3 +#define QFS_DEVICETYPE_DISK 0x7 +#define QFS_DEVICETYPE_DISK_FILE_SYSTEM 0x8 +#define QFS_DEVICETYPE_FILE_SYSTEM 0x9 -#define MIN_MAC_INFO_LEVEL 0x300 -#define MAX_MAC_INFO_LEVEL 0x3FF +/* Characteristics. */ +#define QFS_TYPE_REMOVABLE_MEDIA 0x1 +#define QFS_TYPE_READ_ONLY_DEVICE 0x2 +#define QFS_TYPE_FLOPPY 0x4 +#define QFS_TYPE_WORM 0x8 +#define QFS_TYPE_REMOTE 0x10 +#define QFS_TYPE_MOUNTED 0x20 +#define QFS_TYPE_VIRTUAL 0x40 -#define SMB_MAC_QUERY_FS_INFO 0x301 -#define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName)) +/* + * Thursby MAC extensions.... + */ /* - * DeviceType and Characteristics returned in a - * SMB_QUERY_FS_DEVICE_INFO call. + * MAC CIFS Extensions have the range 0x300 - 0x2FF reserved. + * Supposedly Microsoft have agreed to this. */ -#define DEVICETYPE_CD_ROM 0x2 -#define DEVICETYPE_CD_ROM_FILE_SYSTEM 0x3 -#define DEVICETYPE_DISK 0x7 -#define DEVICETYPE_DISK_FILE_SYSTEM 0x8 -#define DEVICETYPE_FILE_SYSTEM 0x9 +#define MIN_MAC_INFO_LEVEL 0x300 +#define MAX_MAC_INFO_LEVEL 0x3FF +#define SMB_QFS_MAC_FS_INFO 0x301 + -/* Characteristics. */ -#define TYPE_REMOVABLE_MEDIA 0x1 -#define TYPE_READ_ONLY_DEVICE 0x2 -#define TYPE_FLOPPY 0x4 -#define TYPE_WORM 0x8 -#define TYPE_REMOTE 0x10 -#define TYPE_MOUNTED 0x20 -#define TYPE_VIRTUAL 0x40 - -/* NT passthrough levels... */ - -#define SMB_FILE_DIRECTORY_INFORMATION 1001 -#define SMB_FILE_FULL_DIRECTORY_INFORMATION 1002 -#define SMB_FILE_BOTH_DIRECTORY_INFORMATION 1003 -#define SMB_FILE_BASIC_INFORMATION 1004 -#define SMB_FILE_STANDARD_INFORMATION 1005 -#define SMB_FILE_INTERNAL_INFORMATION 1006 -#define SMB_FILE_EA_INFORMATION 1007 -#define SMB_FILE_ACCESS_INFORMATION 1008 -#define SMB_FILE_NAME_INFORMATION 1009 -#define SMB_FILE_RENAME_INFORMATION 1010 -#define SMB_FILE_LINK_INFORMATION 1011 -#define SMB_FILE_NAMES_INFORMATION 1012 -#define SMB_FILE_DISPOSITION_INFORMATION 1013 -#define SMB_FILE_POSITION_INFORMATION 1014 -#define SMB_FILE_FULL_EA_INFORMATION 1015 -#define SMB_FILE_MODE_INFORMATION 1016 -#define SMB_FILE_ALIGNMENT_INFORMATION 1017 -#define SMB_FILE_ALL_INFORMATION 1018 -#define SMB_FILE_ALLOCATION_INFORMATION 1019 -#define SMB_FILE_END_OF_FILE_INFORMATION 1020 -#define SMB_FILE_ALTERNATE_NAME_INFORMATION 1021 -#define SMB_FILE_STREAM_INFORMATION 1022 -#define SMB_FILE_PIPE_INFORMATION 1023 -#define SMB_FILE_PIPE_LOCAL_INFORMATION 1024 -#define SMB_FILE_PIPE_REMOTE_INFORMATION 1025 -#define SMB_FILE_MAILSLOT_QUERY_INFORMATION 1026 -#define SMB_FILE_MAILSLOT_SET_INFORMATION 1027 -#define SMB_FILE_COMPRESSION_INFORMATION 1028 -#define SMB_FILE_OBJECTID_INFORMATION 1029 -#define SMB_FILE_COMPLETION_INFORMATION 1030 -#define SMB_FILE_MOVE_CLUSTER_INFORMATION 1031 -#define SMB_FILE_QUOTA_INFORMATION 1032 -#define SMB_FILE_REPARSEPOINT_INFORMATION 1033 -#define SMB_FILE_NETWORK_OPEN_INFORMATION 1034 -#define SMB_FILE_ATTRIBUTE_TAG_INFORMATION 1035 -#define SMB_FILE_TRACKING_INFORMATION 1036 -#define SMB_FILE_MAXIMUM_INFORMATION 1037 - -/* NT passthough levels for qfsinfo. */ - -#define SMB_FS_VOLUME_INFORMATION 1001 -#define SMB_FS_LABEL_INFORMATION 1002 -#define SMB_FS_SIZE_INFORMATION 1003 -#define SMB_FS_DEVICE_INFORMATION 1004 -#define SMB_FS_ATTRIBUTE_INFORMATION 1005 -#define SMB_FS_QUOTA_INFORMATION 1006 -#define SMB_FS_FULL_SIZE_INFORMATION 1007 -#define SMB_FS_OBJECTID_INFORMATION 1008 /* UNIX CIFS Extensions - created by HP */ /* @@ -340,8 +313,8 @@ Byte offset Type name description #define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL)) -#define SMB_QUERY_FILE_UNIX_BASIC 0x200 /* UNIX File Info*/ -#define SMB_SET_FILE_UNIX_BASIC 0x200 +#define SMB_QFILEINFO_UNIX_BASIC 0x200 /* UNIX File Info*/ +#define SMB_SFILEINFO_UNIX_BASIC 0x200 #define SMB_MODE_NO_CHANGE 0xFFFFFFFF /* file mode value which */ /* means "don't change it" */ @@ -386,14 +359,14 @@ Offset Size Name /* UNIX filetype mappings. */ -#define UNIX_TYPE_FILE 0 -#define UNIX_TYPE_DIR 1 -#define UNIX_TYPE_SYMLINK 2 -#define UNIX_TYPE_CHARDEV 3 -#define UNIX_TYPE_BLKDEV 4 -#define UNIX_TYPE_FIFO 5 -#define UNIX_TYPE_SOCKET 6 -#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF +#define UNIX_TYPE_FILE 0 +#define UNIX_TYPE_DIR 1 +#define UNIX_TYPE_SYMLINK 2 +#define UNIX_TYPE_CHARDEV 3 +#define UNIX_TYPE_BLKDEV 4 +#define UNIX_TYPE_FIFO 5 +#define UNIX_TYPE_SOCKET 6 +#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF /* * Oh this is fun. "Standard UNIX permissions" has no @@ -423,11 +396,11 @@ Offset Size Name #define UNIX_EXTRA_MASK 0007000 #define UNIX_ALL_MASK 0007777 -#define SMB_QUERY_FILE_UNIX_LINK 0x201 -#define SMB_SET_FILE_UNIX_LINK 0x201 -#define SMB_SET_FILE_UNIX_HLINK 0x203 +#define SMB_QFILEINFO_UNIX_LINK 0x201 +#define SMB_SFILEINFO_UNIX_LINK 0x201 +#define SMB_SFILEINFO_UNIX_HLINK 0x203 -#define SMB_FIND_FILE_UNIX 0x202 +#define SMB_FIND_FILE_UNIX 0x202 /* Info level for QVOLINFO - returns version of CIFS UNIX extensions, plus diff --git a/source/include/vfs.h b/source/include/vfs.h deleted file mode 100644 index 8caf64fd99d..00000000000 --- a/source/include/vfs.h +++ /dev/null @@ -1,489 +0,0 @@ -/* - Unix SMB/CIFS implementation. - VFS structures and parameters - Copyright (C) Jeremy Allison 1999-2003 - Copyright (C) Tim Potter 1999 - Copyright (C) Alexander Bokovoy 2002 - Copyright (C) Stefan (metze) Metzmacher 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This work was sponsored by Optifacio Software Services, Inc. -*/ - -#ifndef _VFS_H -#define _VFS_H - -/* Avoid conflict with an AIX include file */ - -#ifdef vfs_ops -#undef vfs_ops -#endif - -/* - * As we're now (thanks Andrew ! :-) using file_structs and connection - * structs in the vfs - then anyone writing a vfs must include includes.h... - */ - -/* - * This next constant specifies the version number of the VFS interface - * this smbd will load. Increment this if *ANY* changes are made to the - * vfs_ops below. JRA. - */ - -/* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */ -/* Changed to version 3 for POSIX acl extensions. JRA. */ -/* Changed to version 4 for cascaded VFS interface. Alexander Bokovoy. */ -/* Changed to version 5 for sendfile addition. JRA. */ -/* Changed to version 6 for the new module system, fixed cascading and quota functions. --metze */ -/* Changed to version 7 to include the get_nt_acl info parameter. JRA. */ -/* Changed to version 8 includes EA calls. JRA. */ -/* Changed to version 9 to include the get_shadow_data call. --metze */ -/* Changed to version 10 to include pread/pwrite calls. */ -#define SMB_VFS_INTERFACE_VERSION 10 - - -/* to bug old modules witch are trying to compile with the old functions */ -#define vfs_init __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore(void) { __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore }; -#define lp_parm_string __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string { \ - __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string }; -#define lp_vfs_options __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead { \ - __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead }; - -/* - All intercepted VFS operations must be declared as static functions inside module source - in order to keep smbd namespace unpolluted. See source of audit, extd_audit, fake_perms and recycle - example VFS modules for more details. -*/ - -/* VFS operations structure */ - -struct vfs_handle_struct; -struct connection_struct; -struct files_struct; -struct security_descriptor_info; - -/* - Available VFS operations. These values must be in sync with vfs_ops struct - (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops). - In particular, if new operations are added to vfs_ops, appropriate constants - should be added to vfs_op_type so that order of them kept same as in vfs_ops. -*/ - -typedef enum _vfs_op_type { - SMB_VFS_OP_NOOP = -1, - - /* Disk operations */ - - SMB_VFS_OP_CONNECT = 0, - SMB_VFS_OP_DISCONNECT, - SMB_VFS_OP_DISK_FREE, - SMB_VFS_OP_GET_QUOTA, - SMB_VFS_OP_SET_QUOTA, - SMB_VFS_OP_GET_SHADOW_COPY_DATA, - - - /* Directory operations */ - - SMB_VFS_OP_OPENDIR, - SMB_VFS_OP_READDIR, - SMB_VFS_OP_MKDIR, - SMB_VFS_OP_RMDIR, - SMB_VFS_OP_CLOSEDIR, - - /* File operations */ - - SMB_VFS_OP_OPEN, - SMB_VFS_OP_CLOSE, - SMB_VFS_OP_READ, - SMB_VFS_OP_PREAD, - SMB_VFS_OP_WRITE, - SMB_VFS_OP_PWRITE, - SMB_VFS_OP_LSEEK, - SMB_VFS_OP_SENDFILE, - SMB_VFS_OP_RENAME, - SMB_VFS_OP_FSYNC, - SMB_VFS_OP_STAT, - SMB_VFS_OP_FSTAT, - SMB_VFS_OP_LSTAT, - SMB_VFS_OP_UNLINK, - SMB_VFS_OP_CHMOD, - SMB_VFS_OP_FCHMOD, - SMB_VFS_OP_CHOWN, - SMB_VFS_OP_FCHOWN, - SMB_VFS_OP_CHDIR, - SMB_VFS_OP_GETWD, - SMB_VFS_OP_UTIME, - SMB_VFS_OP_FTRUNCATE, - SMB_VFS_OP_LOCK, - SMB_VFS_OP_SYMLINK, - SMB_VFS_OP_READLINK, - SMB_VFS_OP_LINK, - SMB_VFS_OP_MKNOD, - SMB_VFS_OP_REALPATH, - - /* NT ACL operations. */ - - SMB_VFS_OP_FGET_NT_ACL, - SMB_VFS_OP_GET_NT_ACL, - SMB_VFS_OP_FSET_NT_ACL, - SMB_VFS_OP_SET_NT_ACL, - - /* POSIX ACL operations. */ - - SMB_VFS_OP_CHMOD_ACL, - SMB_VFS_OP_FCHMOD_ACL, - - SMB_VFS_OP_SYS_ACL_GET_ENTRY, - SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, - SMB_VFS_OP_SYS_ACL_GET_PERMSET, - SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, - SMB_VFS_OP_SYS_ACL_GET_FILE, - SMB_VFS_OP_SYS_ACL_GET_FD, - SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, - SMB_VFS_OP_SYS_ACL_ADD_PERM, - SMB_VFS_OP_SYS_ACL_TO_TEXT, - SMB_VFS_OP_SYS_ACL_INIT, - SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, - SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, - SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, - SMB_VFS_OP_SYS_ACL_SET_PERMSET, - SMB_VFS_OP_SYS_ACL_VALID, - SMB_VFS_OP_SYS_ACL_SET_FILE, - SMB_VFS_OP_SYS_ACL_SET_FD, - SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, - SMB_VFS_OP_SYS_ACL_GET_PERM, - SMB_VFS_OP_SYS_ACL_FREE_TEXT, - SMB_VFS_OP_SYS_ACL_FREE_ACL, - SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, - - /* EA operations. */ - SMB_VFS_OP_GETXATTR, - SMB_VFS_OP_LGETXATTR, - SMB_VFS_OP_FGETXATTR, - SMB_VFS_OP_LISTXATTR, - SMB_VFS_OP_LLISTXATTR, - SMB_VFS_OP_FLISTXATTR, - SMB_VFS_OP_REMOVEXATTR, - SMB_VFS_OP_LREMOVEXATTR, - SMB_VFS_OP_FREMOVEXATTR, - SMB_VFS_OP_SETXATTR, - SMB_VFS_OP_LSETXATTR, - SMB_VFS_OP_FSETXATTR, - - /* This should always be last enum value */ - - SMB_VFS_OP_LAST -} vfs_op_type; - -/* - Please keep vfs_op_type, struct vfs_fn_pointers and struct vfs_handles_pointers in sync. -*/ -struct vfs_ops { - struct vfs_fn_pointers { - /* Disk operations */ - - int (*connect)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *service, const char *user); - void (*disconnect)(struct vfs_handle_struct *handle, struct connection_struct *conn); - SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, - SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); - int (*get_quota)(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt); - int (*set_quota)(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt); - int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels); - - /* Directory operations */ - - DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname); - struct dirent *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp); - int (*mkdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode); - int (*rmdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); - int (*closedir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dir); - - /* File operations */ - - int (*open)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, int flags, mode_t mode); - int (*close)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); - ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n); - ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset); - ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n); - ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset); - SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence); - ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); - int (*rename)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *old, const char *new); - int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); - int (*stat)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf); - int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); - int (*lstat)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf); - int (*unlink)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); - int (*chmod)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode); - int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode); - int (*chown)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, uid_t uid, gid_t gid); - int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid); - int (*chdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); - char *(*getwd)(struct vfs_handle_struct *handle, struct connection_struct *conn, char *buf); - int (*utime)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct utimbuf *times); - int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset); - BOOL (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); - int (*symlink)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *oldpath, const char *newpath); - int (*readlink)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, char *buf, size_t bufsiz); - int (*link)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *oldpath, const char *newpath); - int (*mknod)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev); - char *(*realpath)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, char *resolved_path); - - /* NT ACL operations. */ - - size_t (*fget_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 security_info, struct security_descriptor_info **ppdesc); - size_t (*get_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor_info **ppdesc); - BOOL (*fset_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd); - BOOL (*set_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd); - - /* POSIX ACL operations. */ - - int (*chmod_acl)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *name, mode_t mode); - int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode); - - int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p); - int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); - int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); - void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d); - SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type); - SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); - int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_PERMSET_T permset); - int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); - char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen); - SMB_ACL_T (*sys_acl_init)(struct vfs_handle_struct *handle, struct connection_struct *conn, int count); - int (*sys_acl_create_entry)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry); - int (*sys_acl_set_tag_type)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype); - int (*sys_acl_set_qualifier)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual); - int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset); - int (*sys_acl_valid)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T theacl ); - int (*sys_acl_set_file)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl); - int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_ACL_T theacl); - int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); - int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); - int (*sys_acl_free_text)(struct vfs_handle_struct *handle, struct connection_struct *conn, char *text); - int (*sys_acl_free_acl)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T posix_acl); - int (*sys_acl_free_qualifier)(struct vfs_handle_struct *handle, struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype); - - /* EA operations. */ - ssize_t (*getxattr)(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size); - ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size); - ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size); - ssize_t (*listxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size); - ssize_t (*llistxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size); - ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size); - int (*removexattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name); - int (*lremovexattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name); - int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name); - int (*setxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags); - int (*lsetxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags); - int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags); - - } ops; - - struct vfs_handles_pointers { - /* Disk operations */ - - struct vfs_handle_struct *connect; - struct vfs_handle_struct *disconnect; - struct vfs_handle_struct *disk_free; - struct vfs_handle_struct *get_quota; - struct vfs_handle_struct *set_quota; - struct vfs_handle_struct *get_shadow_copy_data; - - /* Directory operations */ - - struct vfs_handle_struct *opendir; - struct vfs_handle_struct *readdir; - struct vfs_handle_struct *mkdir; - struct vfs_handle_struct *rmdir; - struct vfs_handle_struct *closedir; - - /* File operations */ - - struct vfs_handle_struct *open; - struct vfs_handle_struct *close; - struct vfs_handle_struct *read; - struct vfs_handle_struct *pread; - struct vfs_handle_struct *write; - struct vfs_handle_struct *pwrite; - struct vfs_handle_struct *lseek; - struct vfs_handle_struct *sendfile; - struct vfs_handle_struct *rename; - struct vfs_handle_struct *fsync; - struct vfs_handle_struct *stat; - struct vfs_handle_struct *fstat; - struct vfs_handle_struct *lstat; - struct vfs_handle_struct *unlink; - struct vfs_handle_struct *chmod; - struct vfs_handle_struct *fchmod; - struct vfs_handle_struct *chown; - struct vfs_handle_struct *fchown; - struct vfs_handle_struct *chdir; - struct vfs_handle_struct *getwd; - struct vfs_handle_struct *utime; - struct vfs_handle_struct *ftruncate; - struct vfs_handle_struct *lock; - struct vfs_handle_struct *symlink; - struct vfs_handle_struct *readlink; - struct vfs_handle_struct *link; - struct vfs_handle_struct *mknod; - struct vfs_handle_struct *realpath; - - /* NT ACL operations. */ - - struct vfs_handle_struct *fget_nt_acl; - struct vfs_handle_struct *get_nt_acl; - struct vfs_handle_struct *fset_nt_acl; - struct vfs_handle_struct *set_nt_acl; - - /* POSIX ACL operations. */ - - struct vfs_handle_struct *chmod_acl; - struct vfs_handle_struct *fchmod_acl; - - struct vfs_handle_struct *sys_acl_get_entry; - struct vfs_handle_struct *sys_acl_get_tag_type; - struct vfs_handle_struct *sys_acl_get_permset; - struct vfs_handle_struct *sys_acl_get_qualifier; - struct vfs_handle_struct *sys_acl_get_file; - struct vfs_handle_struct *sys_acl_get_fd; - struct vfs_handle_struct *sys_acl_clear_perms; - struct vfs_handle_struct *sys_acl_add_perm; - struct vfs_handle_struct *sys_acl_to_text; - struct vfs_handle_struct *sys_acl_init; - struct vfs_handle_struct *sys_acl_create_entry; - struct vfs_handle_struct *sys_acl_set_tag_type; - struct vfs_handle_struct *sys_acl_set_qualifier; - struct vfs_handle_struct *sys_acl_set_permset; - struct vfs_handle_struct *sys_acl_valid; - struct vfs_handle_struct *sys_acl_set_file; - struct vfs_handle_struct *sys_acl_set_fd; - struct vfs_handle_struct *sys_acl_delete_def_file; - struct vfs_handle_struct *sys_acl_get_perm; - struct vfs_handle_struct *sys_acl_free_text; - struct vfs_handle_struct *sys_acl_free_acl; - struct vfs_handle_struct *sys_acl_free_qualifier; - - /* EA operations. */ - struct vfs_handle_struct *getxattr; - struct vfs_handle_struct *lgetxattr; - struct vfs_handle_struct *fgetxattr; - struct vfs_handle_struct *listxattr; - struct vfs_handle_struct *llistxattr; - struct vfs_handle_struct *flistxattr; - struct vfs_handle_struct *removexattr; - struct vfs_handle_struct *lremovexattr; - struct vfs_handle_struct *fremovexattr; - struct vfs_handle_struct *setxattr; - struct vfs_handle_struct *lsetxattr; - struct vfs_handle_struct *fsetxattr; - - } handles; -}; - -/* - Possible VFS operation layers (per-operation) - - These values are used by VFS subsystem when building vfs_ops for connection - from multiple VFS modules. Internally, Samba differentiates only opaque and - transparent layers at this process. Other types are used for providing better - diagnosing facilities. - - Most modules will provide transparent layers. Opaque layer is for modules - which implement actual file system calls (like DB-based VFS). For example, - default POSIX VFS which is built in into Samba is an opaque VFS module. - - Other layer types (audit, splitter, scanner) were designed to provide different - degree of transparency and for diagnosing VFS module behaviour. - - Each module can implement several layers at the same time provided that only - one layer is used per each operation. - -*/ - -typedef enum _vfs_op_layer { - SMB_VFS_LAYER_NOOP = -1, /* - For using in VFS module to indicate end of array */ - /* of operations description */ - SMB_VFS_LAYER_OPAQUE = 0, /* - Final level, does not call anything beyond itself */ - SMB_VFS_LAYER_TRANSPARENT, /* - Normal operation, calls underlying layer after */ - /* possibly changing passed data */ - SMB_VFS_LAYER_LOGGER, /* - Logs data, calls underlying layer, logging may not */ - /* use Samba VFS */ - SMB_VFS_LAYER_SPLITTER, /* - Splits operation, calls underlying layer _and_ own facility, */ - /* then combines result */ - SMB_VFS_LAYER_SCANNER /* - Checks data and possibly initiates additional */ - /* file activity like logging to files _inside_ samba VFS */ -} vfs_op_layer; - -/* - VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem, - which describes all operations this module is willing to intercept. - VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs - using this information. -*/ - -typedef struct _vfs_op_tuple { - void* op; - vfs_op_type type; - vfs_op_layer layer; -} vfs_op_tuple; - - -typedef struct vfs_handle_struct { - struct vfs_handle_struct *next, *prev; - const char *param; - struct vfs_ops vfs_next; - struct connection_struct *conn; - void *data; - void (*free_data)(void **data); -} vfs_handle_struct; - - -#define SMB_VFS_HANDLE_GET_DATA(handle, datap, type, ret) { \ - if (!(handle)||((datap=(type *)(handle)->data)==NULL)) { \ - DEBUG(0,("%s() failed to get vfs_handle->data!\n",FUNCTION_MACRO)); \ - ret; \ - } \ -} - -#define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \ - if (!(handle)) { \ - DEBUG(0,("%s() failed to set handle->data!\n",FUNCTION_MACRO)); \ - ret; \ - } else { \ - if ((handle)->free_data) { \ - (handle)->free_data(&(handle)->data); \ - } \ - (handle)->data = (void *)datap; \ - (handle)->free_data = free_fn; \ - } \ -} - -#define SMB_VFS_HANDLE_FREE_DATA(handle) { \ - if ((handle) && (handle)->free_data) { \ - (handle)->free_data(&(handle)->data); \ - } \ -} - -/* Check whether module-specific data handle was already allocated or not */ -#define SMB_VFS_HANDLE_TEST_DATA(handle) ( !(handle) || !(handle)->data ? False : True ) - -#define SMB_VFS_OP(x) ((void *) x) - - -#include "vfs_macros.h" - -#endif /* _VFS_H */ diff --git a/source/include/vfs_macros.h b/source/include/vfs_macros.h deleted file mode 100644 index 1ec1c5a7789..00000000000 --- a/source/include/vfs_macros.h +++ /dev/null @@ -1,318 +0,0 @@ -/* - Unix SMB/CIFS implementation. - VFS wrapper macros - Copyright (C) Stefan (metze) Metzmacher 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _VFS_MACROS_H -#define _VFS_MACROS_H - -/******************************************************************* - Don't access conn->vfs.ops.* directly!!! - Use this macros! - (Fixes should go also into the vfs_opaque_* and vfs_next_* macros!) -********************************************************************/ - -/* Disk operations */ -#define SMB_VFS_CONNECT(conn, service, user) ((conn)->vfs.ops.connect((conn)->vfs.handles.connect, (conn), (service), (user))) -#define SMB_VFS_DISCONNECT(conn) ((conn)->vfs.ops.disconnect((conn)->vfs.handles.disconnect, (conn))) -#define SMB_VFS_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs.ops.disk_free((conn)->vfs.handles.disk_free, (conn), (path), (small_query), (bsize), (dfree), (dsize))) -#define SMB_VFS_GET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.get_quota((conn)->vfs.handles.get_quota, (conn), (qtype), (id), (qt))) -#define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.set_quota((conn)->vfs.handles.set_quota, (conn), (qtype), (id), (qt))) -#define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs.ops.get_shadow_copy_data((fsp)->conn->vfs.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels))) - -/* Directory operations */ -#define SMB_VFS_OPENDIR(conn, fname) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (conn), (fname))) -#define SMB_VFS_READDIR(conn, dirp) ((conn)->vfs.ops.readdir((conn)->vfs.handles.readdir, (conn), (dirp))) -#define SMB_VFS_MKDIR(conn, path, mode) ((conn)->vfs.ops.mkdir((conn)->vfs.handles.mkdir,(conn), (path), (mode))) -#define SMB_VFS_RMDIR(conn, path) ((conn)->vfs.ops.rmdir((conn)->vfs.handles.rmdir, (conn), (path))) -#define SMB_VFS_CLOSEDIR(conn, dir) ((conn)->vfs.ops.closedir((conn)->vfs.handles.closedir, (conn), dir)) - -/* File operations */ -#define SMB_VFS_OPEN(conn, fname, flags, mode) ((conn)->vfs.ops.open((conn)->vfs.handles.open, (conn), (fname), (flags), (mode))) -#define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close((fsp)->conn->vfs.handles.close, (fsp), (fd))) -#define SMB_VFS_READ(fsp, fd, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (fd), (data), (n), (off))) -#define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n))) -#define SMB_VFS_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (fd), (data), (n), (off))) -#define SMB_VFS_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (fd), (offset), (whence))) -#define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) -#define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (conn), (old), (new))) -#define SMB_VFS_FSYNC(fsp, fd) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp), (fd))) -#define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (conn), (fname), (sbuf))) -#define SMB_VFS_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp) ,(fd) ,(sbuf))) -#define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (conn), (path), (sbuf))) -#define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (conn), (path))) -#define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (conn), (path), (mode))) -#define SMB_VFS_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (fd), (mode))) -#define SMB_VFS_CHOWN(conn, path, uid, gid) ((conn)->vfs.ops.chown((conn)->vfs.handles.chown, (conn), (path), (uid), (gid))) -#define SMB_VFS_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (fd), (uid), (gid))) -#define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (conn), (path))) -#define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (conn), (buf))) -#define SMB_VFS_UTIME(conn, path, times) ((conn)->vfs.ops.utime((conn)->vfs.handles.utime, (conn), (path), (times))) -#define SMB_VFS_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (fd), (offset))) -#define SMB_VFS_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) -#define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (conn), (oldpath), (newpath))) -#define SMB_VFS_READLINK(conn, path, buf, bufsiz) ((conn)->vfs.ops.readlink((conn)->vfs.handles.readlink, (conn), (path), (buf), (bufsiz))) -#define SMB_VFS_LINK(conn, oldpath, newpath) ((conn)->vfs.ops.link((conn)->vfs.handles.link, (conn), (oldpath), (newpath))) -#define SMB_VFS_MKNOD(conn, path, mode, dev) ((conn)->vfs.ops.mknod((conn)->vfs.handles.mknod, (conn), (path), (mode), (dev))) -#define SMB_VFS_REALPATH(conn, path, resolved_path) ((conn)->vfs.ops.realpath((conn)->vfs.handles.realpath, (conn), (path), (resolved_path))) - -/* NT ACL operations. */ -#define SMB_VFS_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) -#define SMB_VFS_GET_NT_ACL(fsp, name, security_info, ppdesc) ((fsp)->conn->vfs.ops.get_nt_acl((fsp)->conn->vfs.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc))) -#define SMB_VFS_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) -#define SMB_VFS_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs.ops.set_nt_acl((fsp)->conn->vfs.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) - -/* POSIX ACL operations. */ -#define SMB_VFS_CHMOD_ACL(conn, name, mode) ((conn)->vfs.ops.chmod_acl((conn)->vfs.handles.chmod_acl, (conn), (name), (mode))) -#define SMB_VFS_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (fd), (mode))) - -#define SMB_VFS_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs.ops.sys_acl_get_entry((conn)->vfs.handles.sys_acl_get_entry, (conn), (theacl), (entry_id), (entry_p))) -#define SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs.ops.sys_acl_get_tag_type((conn)->vfs.handles.sys_acl_get_tag_type, (conn), (entry_d), (tag_type_p))) -#define SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs.ops.sys_acl_get_permset((conn)->vfs.handles.sys_acl_get_permset, (conn), (entry_d), (permset_p))) -#define SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs.ops.sys_acl_get_qualifier((conn)->vfs.handles.sys_acl_get_qualifier, (conn), (entry_d))) -#define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs.ops.sys_acl_get_file((conn)->vfs.handles.sys_acl_get_file, (conn), (path_p), (type))) -#define SMB_VFS_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp), (fd))) -#define SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs.ops.sys_acl_clear_perms((conn)->vfs.handles.sys_acl_clear_perms, (conn), (permset))) -#define SMB_VFS_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_add_perm((conn)->vfs.handles.sys_acl_add_perm, (conn), (permset), (perm))) -#define SMB_VFS_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs.ops.sys_acl_to_text((conn)->vfs.handles.sys_acl_to_text, (conn), (theacl), (plen))) -#define SMB_VFS_SYS_ACL_INIT(conn, count) ((conn)->vfs.ops.sys_acl_init((conn)->vfs.handles.sys_acl_init, (conn), (count))) -#define SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, pacl, pentry) ((conn)->vfs.ops.sys_acl_create_entry((conn)->vfs.handles.sys_acl_create_entry, (conn), (pacl), (pentry))) -#define SMB_VFS_SYS_ACL_SET_TAG_TYPE(conn, entry, tagtype) ((conn)->vfs.ops.sys_acl_set_tag_type((conn)->vfs.handles.sys_acl_set_tag_type, (conn), (entry), (tagtype))) -#define SMB_VFS_SYS_ACL_SET_QUALIFIER(conn, entry, qual) ((conn)->vfs.ops.sys_acl_set_qualifier((conn)->vfs.handles.sys_acl_set_qualifier, (conn), (entry), (qual))) -#define SMB_VFS_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs.ops.sys_acl_set_permset((conn)->vfs.handles.sys_acl_set_permset, (conn), (entry), (permset))) -#define SMB_VFS_SYS_ACL_VALID(conn, theacl) ((conn)->vfs.ops.sys_acl_valid((conn)->vfs.handles.sys_acl_valid, (conn), (theacl))) -#define SMB_VFS_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs.ops.sys_acl_set_file((conn)->vfs.handles.sys_acl_set_file, (conn), (name), (acltype), (theacl))) -#define SMB_VFS_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (fd), (theacl))) -#define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs.ops.sys_acl_delete_def_file((conn)->vfs.handles.sys_acl_delete_def_file, (conn), (path))) -#define SMB_VFS_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_get_perm((conn)->vfs.handles.sys_acl_get_perm, (conn), (permset), (perm))) -#define SMB_VFS_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs.ops.sys_acl_free_text((conn)->vfs.handles.sys_acl_free_text, (conn), (text))) -#define SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl) ((conn)->vfs.ops.sys_acl_free_acl((conn)->vfs.handles.sys_acl_free_acl, (conn), (posix_acl))) -#define SMB_VFS_SYS_ACL_FREE_QUALIFIER(conn, qualifier, tagtype) ((conn)->vfs.ops.sys_acl_free_qualifier((conn)->vfs.handles.sys_acl_free_qualifier, (conn), (qualifier), (tagtype))) - -/* EA operations. */ -#define SMB_VFS_GETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.getxattr((conn)->vfs.handles.getxattr,(conn),(path),(name),(value),(size))) -#define SMB_VFS_LGETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.lgetxattr((conn)->vfs.handles.lgetxattr,(conn),(path),(name),(value),(size))) -#define SMB_VFS_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(fd),(name),(value),(size))) -#define SMB_VFS_LISTXATTR(conn,path,list,size) ((conn)->vfs.ops.listxattr((conn)->vfs.handles.listxattr,(conn),(path),(list),(size))) -#define SMB_VFS_LLISTXATTR(conn,path,list,size) ((conn)->vfs.ops.llistxattr((conn)->vfs.handles.llistxattr,(conn),(path),(list),(size))) -#define SMB_VFS_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(fd),(list),(size))) -#define SMB_VFS_REMOVEXATTR(conn,path,name) ((conn)->vfs.ops.removexattr((conn)->vfs.handles.removexattr,(conn),(path),(name))) -#define SMB_VFS_LREMOVEXATTR(conn,path,name) ((conn)->vfs.ops.lremovexattr((conn)->vfs.handles.lremovexattr,(conn),(path),(name))) -#define SMB_VFS_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(fd),(name))) -#define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.setxattr((conn)->vfs.handles.setxattr,(conn),(path),(name),(value),(size),(flags))) -#define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.lsetxattr((conn)->vfs.handles.lsetxattr,(conn),(path),(name),(value),(size),(flags))) -#define SMB_VFS_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) - -/******************************************************************* - Don't access conn->vfs_opaque.ops directly!!! - Use this macros! - (Fixes should also go into the vfs_* and vfs_next_* macros!) -********************************************************************/ - -/* Disk operations */ -#define SMB_VFS_OPAQUE_CONNECT(conn, service, user) ((conn)->vfs_opaque.ops.connect((conn)->vfs_opaque.handles.connect, (conn), (service), (user))) -#define SMB_VFS_OPAQUE_DISCONNECT(conn) ((conn)->vfs_opaque.ops.disconnect((conn)->vfs_opaque.handles.disconnect, (conn))) -#define SMB_VFS_OPAQUE_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs_opaque.ops.disk_free((conn)->vfs_opaque.handles.disk_free, (conn), (path), (small_query), (bsize), (dfree), (dsize))) -#define SMB_VFS_OPAQUE_GET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.get_quota((conn)->vfs_opaque.handles.get_quota, (conn), (qtype), (id), (qt))) -#define SMB_VFS_OPAQUE_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.set_quota((conn)->vfs_opaque.handles.set_quota, (conn), (qtype), (id), (qt))) -#define SMB_VFS_OPAQUE_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs_opaque.ops.get_shadow_copy_data((fsp)->conn->vfs_opaque.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels))) - -/* Directory operations */ -#define SMB_VFS_OPAQUE_OPENDIR(conn, fname) ((conn)->vfs_opaque.ops.opendir((conn)->vfs_opaque.handles.opendir, (conn), (fname))) -#define SMB_VFS_OPAQUE_READDIR(conn, dirp) ((conn)->vfs_opaque.ops.readdir((conn)->vfs_opaque.handles.readdir, (conn), (dirp))) -#define SMB_VFS_OPAQUE_MKDIR(conn, path, mode) ((conn)->vfs_opaque.ops.mkdir((conn)->vfs_opaque.handles.mkdir,(conn), (path), (mode))) -#define SMB_VFS_OPAQUE_RMDIR(conn, path) ((conn)->vfs_opaque.ops.rmdir((conn)->vfs_opaque.handles.rmdir, (conn), (path))) -#define SMB_VFS_OPAQUE_CLOSEDIR(conn, dir) ((conn)->vfs_opaque.ops.closedir((conn)->vfs_opaque.handles.closedir, (conn), dir)) - -/* File operations */ -#define SMB_VFS_OPAQUE_OPEN(conn, fname, flags, mode) ((conn)->vfs_opaque.ops.open((conn)->vfs_opaque.handles.open, (conn), (fname), (flags), (mode))) -#define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close((fsp)->conn->vfs_opaque.handles.close, (fsp), (fd))) -#define SMB_VFS_OPAQUE_READ(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_OPAQUE_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (fd), (data), (n), (off))) -#define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n))) -#define SMB_VFS_OPAQUE_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (fd), (data), (n), (off))) -#define SMB_VFS_OPAQUE_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (fd), (offset), (whence))) -#define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) -#define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (conn), (old), (new))) -#define SMB_VFS_OPAQUE_FSYNC(fsp, fd) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp), (fd))) -#define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (conn), (fname), (sbuf))) -#define SMB_VFS_OPAQUE_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp) ,(fd) ,(sbuf))) -#define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (conn), (path), (sbuf))) -#define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (conn), (path))) -#define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (conn), (path), (mode))) -#define SMB_VFS_OPAQUE_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (fd), (mode))) -#define SMB_VFS_OPAQUE_CHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.chown((conn)->vfs_opaque.handles.chown, (conn), (path), (uid), (gid))) -#define SMB_VFS_OPAQUE_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (fd), (uid), (gid))) -#define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (conn), (path))) -#define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (conn), (buf))) -#define SMB_VFS_OPAQUE_UTIME(conn, path, times) ((conn)->vfs_opaque.ops.utime((conn)->vfs_opaque.handles.utime, (conn), (path), (times))) -#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (fd), (offset))) -#define SMB_VFS_OPAQUE_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) -#define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (conn), (oldpath), (newpath))) -#define SMB_VFS_OPAQUE_READLINK(conn, path, buf, bufsiz) ((conn)->vfs_opaque.ops.readlink((conn)->vfs_opaque.handles.readlink, (conn), (path), (buf), (bufsiz))) -#define SMB_VFS_OPAQUE_LINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.link((conn)->vfs_opaque.handles.link, (conn), (oldpath), (newpath))) -#define SMB_VFS_OPAQUE_MKNOD(conn, path, mode, dev) ((conn)->vfs_opaque.ops.mknod((conn)->vfs_opaque.handles.mknod, (conn), (path), (mode), (dev))) -#define SMB_VFS_OPAQUE_REALPATH(conn, path, resolved_path) ((conn)->vfs_opaque.ops.realpath((conn)->vfs_opaque.handles.realpath, (conn), (path), (resolved_path))) - -/* NT ACL operations. */ -#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) -#define SMB_VFS_OPAQUE_GET_NT_ACL(fsp, name, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.get_nt_acl((fsp)->conn->vfs_opaque.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc))) -#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) -#define SMB_VFS_OPAQUE_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.set_nt_acl((fsp)->conn->vfs_opaque.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) - -/* POSIX ACL operations. */ -#define SMB_VFS_OPAQUE_CHMOD_ACL(conn, name, mode) ((conn)->vfs_opaque.ops.chmod_acl((conn)->vfs_opaque.handles.chmod_acl, (conn), (name), (mode))) -#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (fd), (mode))) - -#define SMB_VFS_OPAQUE_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs_opaque.ops.sys_acl_get_entry((conn)->vfs_opaque.handles.sys_acl_get_entry, (conn), (theacl), (entry_id), (entry_p))) -#define SMB_VFS_OPAQUE_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs_opaque.ops.sys_acl_get_tag_type((conn)->vfs_opaque.handles.sys_acl_get_tag_type, (conn), (entry_d), (tag_type_p))) -#define SMB_VFS_OPAQUE_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs_opaque.ops.sys_acl_get_permset((conn)->vfs_opaque.handles.sys_acl_get_permset, (conn), (entry_d), (permset_p))) -#define SMB_VFS_OPAQUE_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs_opaque.ops.sys_acl_get_qualifier((conn)->vfs_opaque.handles.sys_acl_get_qualifier, (conn), (entry_d))) -#define SMB_VFS_OPAQUE_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs_opaque.ops.sys_acl_get_file((conn)->vfs_opaque.handles.sys_acl_get_file, (conn), (path_p), (type))) -#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp), (fd))) -#define SMB_VFS_OPAQUE_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs_opaque.ops.sys_acl_clear_perms((conn)->vfs_opaque.handles.sys_acl_clear_perms, (conn), (permset))) -#define SMB_VFS_OPAQUE_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_add_perm((conn)->vfs_opaque.handles.sys_acl_add_perm, (conn), (permset), (perm))) -#define SMB_VFS_OPAQUE_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs_opaque.ops.sys_acl_to_text((conn)->vfs_opaque.handles.sys_acl_to_text, (conn), (theacl), (plen))) -#define SMB_VFS_OPAQUE_SYS_ACL_INIT(conn, count) ((conn)->vfs_opaque.ops.sys_acl_init((conn)->vfs_opaque.handles.sys_acl_init, (conn), (count))) -#define SMB_VFS_OPAQUE_SYS_ACL_CREATE_ENTRY(conn, pacl, pentry) ((conn)->vfs_opaque.ops.sys_acl_create_entry((conn)->vfs_opaque.handles.sys_acl_create_entry, (conn), (pacl), (pentry))) -#define SMB_VFS_OPAQUE_SYS_ACL_SET_TAG_TYPE(conn, entry, tagtype) ((conn)->vfs_opaque.ops.sys_acl_set_tag_type((conn)->vfs_opaque.handles.sys_acl_set_tag_type, (conn), (entry), (tagtype))) -#define SMB_VFS_OPAQUE_SYS_ACL_SET_QUALIFIER(conn, entry, qual) ((conn)->vfs_opaque.ops.sys_acl_set_qualifier((conn)->vfs_opaque.handles.sys_acl_set_qualifier, (conn), (entry), (qual))) -#define SMB_VFS_OPAQUE_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs_opaque.ops.sys_acl_set_permset((conn)->vfs_opaque.handles.sys_acl_set_permset, (conn), (entry), (permset))) -#define SMB_VFS_OPAQUE_SYS_ACL_VALID(conn, theacl) ((conn)->vfs_opaque.ops.sys_acl_valid((conn)->vfs_opaque.handles.sys_acl_valid, (conn), (theacl))) -#define SMB_VFS_OPAQUE_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs_opaque.ops.sys_acl_set_file((conn)->vfs_opaque.handles.sys_acl_set_file, (conn), (name), (acltype), (theacl))) -#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (fd), (theacl))) -#define SMB_VFS_OPAQUE_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs_opaque.ops.sys_acl_delete_def_file((conn)->vfs_opaque.handles.sys_acl_delete_def_file, (conn), (path))) -#define SMB_VFS_OPAQUE_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_get_perm((conn)->vfs_opaque.handles.sys_acl_get_perm, (conn), (permset), (perm))) -#define SMB_VFS_OPAQUE_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs_opaque.ops.sys_acl_free_text((conn)->vfs_opaque.handles.sys_acl_free_text, (conn), (text))) -#define SMB_VFS_OPAQUE_SYS_ACL_FREE_ACL(conn, posix_acl) ((conn)->vfs_opaque.ops.sys_acl_free_acl((conn)->vfs_opaque.handles.sys_acl_free_acl, (conn), (posix_acl))) -#define SMB_VFS_OPAQUE_SYS_ACL_FREE_QUALIFIER(conn, qualifier, tagtype) ((conn)->vfs_opaque.ops.sys_acl_free_qualifier((conn)->vfs_opaque.handles.sys_acl_free_qualifier, (conn), (qualifier), (tagtype))) - -/* EA operations. */ -#define SMB_VFS_OPAQUE_GETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.getxattr((conn)->vfs_opaque.handles.getxattr,(conn),(path),(name),(value),(size))) -#define SMB_VFS_OPAQUE_LGETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.lgetxattr((conn)->vfs_opaque.handles.lgetxattr,(conn),(path),(name),(value),(size))) -#define SMB_VFS_OPAQUE_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(fd),(name),(value),(size))) -#define SMB_VFS_OPAQUE_LISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.listxattr((conn)->vfs_opaque.handles.listxattr,(conn),(path),(list),(size))) -#define SMB_VFS_OPAQUE_LLISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.llistxattr((conn)->vfs_opaque.handles.llistxattr,(conn),(path),(list),(size))) -#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(fd),(list),(size))) -#define SMB_VFS_OPAQUE_REMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.removexattr((conn)->vfs_opaque.handles.removexattr,(conn),(path),(name))) -#define SMB_VFS_OPAQUE_LREMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.lremovexattr((conn)->vfs_opaque.handles.lremovexattr,(conn),(path),(name))) -#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(fd),(name))) -#define SMB_VFS_OPAQUE_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.setxattr((conn)->vfs_opaque.handles.setxattr,(conn),(path),(name),(value),(size),(flags))) -#define SMB_VFS_OPAQUE_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.lsetxattr((conn)->vfs_opaque.handles.lsetxattr,(conn),(path),(name),(value),(size),(flags))) -#define SMB_VFS_OPAQUE_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) - -/******************************************************************* - Don't access handle->vfs_next.ops.* directly!!! - Use this macros! - (Fixes should go also into the vfs_* and vfs_opaque_* macros!) -********************************************************************/ - -/* Disk operations */ -#define SMB_VFS_NEXT_CONNECT(handle, conn, service, user) ((handle)->vfs_next.ops.connect((handle)->vfs_next.handles.connect, (conn), (service), (user))) -#define SMB_VFS_NEXT_DISCONNECT(handle, conn) ((handle)->vfs_next.ops.disconnect((handle)->vfs_next.handles.disconnect, (conn))) -#define SMB_VFS_NEXT_DISK_FREE(handle, conn, path, small_query, bsize, dfree ,dsize) ((handle)->vfs_next.ops.disk_free((handle)->vfs_next.handles.disk_free, (conn), (path), (small_query), (bsize), (dfree), (dsize))) -#define SMB_VFS_NEXT_GET_QUOTA(handle, conn, qtype, id, qt) ((handle)->vfs_next.ops.get_quota((handle)->vfs_next.handles.get_quota, (conn), (qtype), (id), (qt))) -#define SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, qt) ((handle)->vfs_next.ops.set_quota((handle)->vfs_next.handles.set_quota, (conn), (qtype), (id), (qt))) -#define SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data ,labels) ((handle)->vfs_next.ops.get_shadow_copy_data((handle)->vfs_next.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels))) - -/* Directory operations */ -#define SMB_VFS_NEXT_OPENDIR(handle, conn, fname) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (conn), (fname))) -#define SMB_VFS_NEXT_READDIR(handle, conn, dirp) ((handle)->vfs_next.ops.readdir((handle)->vfs_next.handles.readdir, (conn), (dirp))) -#define SMB_VFS_NEXT_MKDIR(handle, conn, path, mode) ((handle)->vfs_next.ops.mkdir((handle)->vfs_next.handles.mkdir,(conn), (path), (mode))) -#define SMB_VFS_NEXT_RMDIR(handle, conn, path) ((handle)->vfs_next.ops.rmdir((handle)->vfs_next.handles.rmdir, (conn), (path))) -#define SMB_VFS_NEXT_CLOSEDIR(handle, conn, dir) ((handle)->vfs_next.ops.closedir((handle)->vfs_next.handles.closedir, (conn), dir)) - -/* File operations */ -#define SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode) ((handle)->vfs_next.ops.open((handle)->vfs_next.handles.open, (conn), (fname), (flags), (mode))) -#define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close((handle)->vfs_next.handles.close, (fsp), (fd))) -#define SMB_VFS_NEXT_READ(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (fd), (data), (n), (off))) -#define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n))) -#define SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (fd), (data), (n), (off))) -#define SMB_VFS_NEXT_LSEEK(handle, fsp, fd, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (fd), (offset), (whence))) -#define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) -#define SMB_VFS_NEXT_RENAME(handle, conn, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (conn), (old), (new))) -#define SMB_VFS_NEXT_FSYNC(handle, fsp, fd) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp), (fd))) -#define SMB_VFS_NEXT_STAT(handle, conn, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (conn), (fname), (sbuf))) -#define SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp) ,(fd) ,(sbuf))) -#define SMB_VFS_NEXT_LSTAT(handle, conn, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (conn), (path), (sbuf))) -#define SMB_VFS_NEXT_UNLINK(handle, conn, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (conn), (path))) -#define SMB_VFS_NEXT_CHMOD(handle, conn, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (conn), (path), (mode))) -#define SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (fd), (mode))) -#define SMB_VFS_NEXT_CHOWN(handle, conn, path, uid, gid) ((handle)->vfs_next.ops.chown((handle)->vfs_next.handles.chown, (conn), (path), (uid), (gid))) -#define SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (fd), (uid), (gid))) -#define SMB_VFS_NEXT_CHDIR(handle, conn, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (conn), (path))) -#define SMB_VFS_NEXT_GETWD(handle, conn, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (conn), (buf))) -#define SMB_VFS_NEXT_UTIME(handle, conn, path, times) ((handle)->vfs_next.ops.utime((handle)->vfs_next.handles.utime, (conn), (path), (times))) -#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (fd), (offset))) -#define SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) -#define SMB_VFS_NEXT_SYMLINK(handle, conn, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (conn), (oldpath), (newpath))) -#define SMB_VFS_NEXT_READLINK(handle, conn, path, buf, bufsiz) ((handle)->vfs_next.ops.readlink((handle)->vfs_next.handles.readlink, (conn), (path), (buf), (bufsiz))) -#define SMB_VFS_NEXT_LINK(handle, conn, oldpath, newpath) ((handle)->vfs_next.ops.link((handle)->vfs_next.handles.link, (conn), (oldpath), (newpath))) -#define SMB_VFS_NEXT_MKNOD(handle, conn, path, mode, dev) ((handle)->vfs_next.ops.mknod((handle)->vfs_next.handles.mknod, (conn), (path), (mode), (dev))) -#define SMB_VFS_NEXT_REALPATH(handle, conn, path, resolved_path) ((handle)->vfs_next.ops.realpath((handle)->vfs_next.handles.realpath, (conn), (path), (resolved_path))) - -/* NT ACL operations. */ -#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) -#define SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc))) -#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) -#define SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd) ((handle)->vfs_next.ops.set_nt_acl((handle)->vfs_next.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) - -/* POSIX ACL operations. */ -#define SMB_VFS_NEXT_CHMOD_ACL(handle, conn, name, mode) ((handle)->vfs_next.ops.chmod_acl((handle)->vfs_next.handles.chmod_acl, (conn), (name), (mode))) -#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (fd), (mode))) - -#define SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, conn, theacl, entry_id, entry_p) ((handle)->vfs_next.ops.sys_acl_get_entry((handle)->vfs_next.handles.sys_acl_get_entry, (conn), (theacl), (entry_id), (entry_p))) -#define SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, conn, entry_d, tag_type_p) ((handle)->vfs_next.ops.sys_acl_get_tag_type((handle)->vfs_next.handles.sys_acl_get_tag_type, (conn), (entry_d), (tag_type_p))) -#define SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, conn, entry_d, permset_p) ((handle)->vfs_next.ops.sys_acl_get_permset((handle)->vfs_next.handles.sys_acl_get_permset, (conn), (entry_d), (permset_p))) -#define SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, conn, entry_d) ((handle)->vfs_next.ops.sys_acl_get_qualifier((handle)->vfs_next.handles.sys_acl_get_qualifier, (conn), (entry_d))) -#define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, conn, path_p, type) ((handle)->vfs_next.ops.sys_acl_get_file((handle)->vfs_next.handles.sys_acl_get_file, (conn), (path_p), (type))) -#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp), (fd))) -#define SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, conn, permset) ((handle)->vfs_next.ops.sys_acl_clear_perms((handle)->vfs_next.handles.sys_acl_clear_perms, (conn), (permset))) -#define SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, conn, permset, perm) ((handle)->vfs_next.ops.sys_acl_add_perm((handle)->vfs_next.handles.sys_acl_add_perm, (conn), (permset), (perm))) -#define SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, conn, theacl, plen) ((handle)->vfs_next.ops.sys_acl_to_text((handle)->vfs_next.handles.sys_acl_to_text, (conn), (theacl), (plen))) -#define SMB_VFS_NEXT_SYS_ACL_INIT(handle, conn, count) ((handle)->vfs_next.ops.sys_acl_init((handle)->vfs_next.handles.sys_acl_init, (conn), (count))) -#define SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, conn, pacl, pentry) ((handle)->vfs_next.ops.sys_acl_create_entry((handle)->vfs_next.handles.sys_acl_create_entry, (conn), (pacl), (pentry))) -#define SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, conn, entry, tagtype) ((handle)->vfs_next.ops.sys_acl_set_tag_type((handle)->vfs_next.handles.sys_acl_set_tag_type, (conn), (entry), (tagtype))) -#define SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, conn, entry, qual) ((handle)->vfs_next.ops.sys_acl_set_qualifier((handle)->vfs_next.handles.sys_acl_set_qualifier, (conn), (entry), (qual))) -#define SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, conn, entry, permset) ((handle)->vfs_next.ops.sys_acl_set_permset((handle)->vfs_next.handles.sys_acl_set_permset, (conn), (entry), (permset))) -#define SMB_VFS_NEXT_SYS_ACL_VALID(handle, conn, theacl) ((handle)->vfs_next.ops.sys_acl_valid((handle)->vfs_next.handles.sys_acl_valid, (conn), (theacl))) -#define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, conn, name, acltype, theacl) ((handle)->vfs_next.ops.sys_acl_set_file((handle)->vfs_next.handles.sys_acl_set_file, (conn), (name), (acltype), (theacl))) -#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (fd), (theacl))) -#define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, conn, path) ((handle)->vfs_next.ops.sys_acl_delete_def_file((handle)->vfs_next.handles.sys_acl_delete_def_file, (conn), (path))) -#define SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, conn, permset, perm) ((handle)->vfs_next.ops.sys_acl_get_perm((handle)->vfs_next.handles.sys_acl_get_perm, (conn), (permset), (perm))) -#define SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, conn, text) ((handle)->vfs_next.ops.sys_acl_free_text((handle)->vfs_next.handles.sys_acl_free_text, (conn), (text))) -#define SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, conn, posix_acl) ((handle)->vfs_next.ops.sys_acl_free_acl((handle)->vfs_next.handles.sys_acl_free_acl, (conn), (posix_acl))) -#define SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, conn, qualifier, tagtype) ((handle)->vfs_next.ops.sys_acl_free_qualifier((handle)->vfs_next.handles.sys_acl_free_qualifier, (conn), (qualifier), (tagtype))) - -/* EA operations. */ -#define SMB_VFS_NEXT_GETXATTR(handle,conn,path,name,value,size) ((handle)->vfs_next.ops.getxattr((handle)->vfs_next.handles.getxattr,(conn),(path),(name),(value),(size))) -#define SMB_VFS_NEXT_LGETXATTR(handle,conn,path,name,value,size) ((handle)->vfs_next.ops.lgetxattr((handle)->vfs_next.handles.lgetxattr,(conn),(path),(name),(value),(size))) -#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,fd,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(fd),(name),(value),(size))) -#define SMB_VFS_NEXT_LISTXATTR(handle,conn,path,list,size) ((handle)->vfs_next.ops.listxattr((handle)->vfs_next.handles.listxattr,(conn),(path),(list),(size))) -#define SMB_VFS_NEXT_LLISTXATTR(handle,conn,path,list,size) ((handle)->vfs_next.ops.llistxattr((handle)->vfs_next.handles.llistxattr,(conn),(path),(list),(size))) -#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,fd,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(fd),(list),(size))) -#define SMB_VFS_NEXT_REMOVEXATTR(handle,conn,path,name) ((handle)->vfs_next.ops.removexattr((handle)->vfs_next.handles.removexattr,(conn),(path),(name))) -#define SMB_VFS_NEXT_LREMOVEXATTR(handle,conn,path,name) ((handle)->vfs_next.ops.lremovexattr((handle)->vfs_next.handles.lremovexattr,(conn),(path),(name))) -#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,fd,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(fd),(name))) -#define SMB_VFS_NEXT_SETXATTR(handle,conn,path,name,value,size,flags) ((handle)->vfs_next.ops.setxattr((handle)->vfs_next.handles.setxattr,(conn),(path),(name),(value),(size),(flags))) -#define SMB_VFS_NEXT_LSETXATTR(handle,conn,path,name,value,size,flags) ((handle)->vfs_next.ops.lsetxattr((handle)->vfs_next.handles.lsetxattr,(conn),(path),(name),(value),(size),(flags))) -#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,fd,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) - -#endif /* _VFS_MACROS_H */ |