From 31e21b67d998eed46c55132cc6067db6163d30c1 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 7 Apr 2003 18:01:40 +0000 Subject: Decode the PAC! This patch just decodes it and then frees it, so it's just for doc purposes right now (you can see it in the debug logs). (This used to be commit 046c2087a11b9ce7a02aece34ffb129ce0d66b08) --- source3/include/authdata.h | 131 +++++++++++++++++++++++++++++++++++++++++++++ source3/include/ntdomain.h | 4 +- 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 source3/include/authdata.h (limited to 'source3/include') diff --git a/source3/include/authdata.h b/source3/include/authdata.h new file mode 100644 index 0000000000..dc9f217549 --- /dev/null +++ b/source3/include/authdata.h @@ -0,0 +1,131 @@ +/* + Unix SMB/CIFS implementation. + Kerberos authorization data + Copyright (C) Jim McDonough 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 + +typedef struct pac_signature_data { + uint32 type; + uint8 *signature; +} PAC_SIGNATURE_DATA; + +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_group_sids; + + 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; + KRB_SID_AND_ATTR_ARRAY extra_sids; + +} PAC_LOGON_INFO; + +typedef struct pac_info_ctr +{ + union + { + PAC_LOGON_INFO *logon_info; + PAC_SIGNATURE_DATA *srv_cksum; + PAC_SIGNATURE_DATA *privsrv_cksum; + } 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/source3/include/ntdomain.h b/source3/include/ntdomain.h index d02195b378..9216640c03 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -372,6 +372,9 @@ struct acct_info /* security descriptor structures */ #include "rpc_secdes.h" +/* pac */ +#include "authdata.h" + /* different dce/rpc pipes */ #include "rpc_lsa.h" #include "rpc_netlogon.h" @@ -382,5 +385,4 @@ struct acct_info #include "rpc_spoolss.h" #include "rpc_dfs.h" #include "rpc_ds.h" - #endif /* _NT_DOMAIN_H */ -- cgit From 1d247da97a46693f3f4c8eceef03f685de5074df Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 7 Apr 2003 20:34:46 +0000 Subject: Some comment updates, notably that I haven't seen the group membership arrays yet (the ones that are rid-only). (This used to be commit 0a5b5d00db42de868c72ec3d9d1d747c9ef391e4) --- source3/include/authdata.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include') diff --git a/source3/include/authdata.h b/source3/include/authdata.h index dc9f217549..1521185a8f 100644 --- a/source3/include/authdata.h +++ b/source3/include/authdata.h @@ -33,6 +33,11 @@ typedef struct pac_signature_data { uint8 *signature; } PAC_SIGNATURE_DATA; +typedef struct group_membership { + uint32 rid; + uint32 attrs; +} GROUP_MEMBERSHIP; + typedef struct krb_sid_and_attrs { uint32 sid_ptr; uint32 attrs; @@ -99,7 +104,11 @@ typedef struct pac_logon_info { UNISTR2 uni_dom_controller; UNISTR2 uni_dom_name; DOM_SID2 dom_sid; + /* group membership array needs to go in here. + I've not seen it on the wire */ KRB_SID_AND_ATTR_ARRAY extra_sids; + DOM_SID2 res_group_dom_sid; + /* resource group membership array needs to go in here */ } PAC_LOGON_INFO; -- cgit From 09e9e5a2fd510e01262a733384b23d0e1a1bf541 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 8 Apr 2003 04:07:22 +0000 Subject: Added some preprocessor tricks to stop TRUE and FALSE from continually creeping back in to the source. Use True and False instead. (This used to be commit 5a5a7ce7479a56ca2d472658511a47c9147c0d5b) --- source3/include/includes.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index bf71ed54cf..61aee975c0 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1274,5 +1274,18 @@ void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); BOOL krb5_get_smb_session_key(krb5_context context, krb5_auth_context auth_context, uint8 session_key[16]); #endif /* HAVE_KRB5 */ -#endif /* _INCLUDES_H */ +/* 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 + +#endif /* _INCLUDES_H */ -- cgit From d9440df5799a80357bcc51d1a8bf83f71b7f5cd9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 09:52:57 +0000 Subject: A little clarification in the rpc auth header struct. Volker (This used to be commit 9fc3e4bf9fa7845b5d4a7eb4cacfec586045ebd0) --- source3/include/rpc_dce.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/include') diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h index 7e8bc3949e..22dae7ce36 100644 --- a/source3/include/rpc_dce.h +++ b/source3/include/rpc_dce.h @@ -197,10 +197,10 @@ typedef struct rpc_hdr_auth_info { uint8 auth_type; /* 0x0a */ uint8 auth_level; /* 0x06 */ - uint8 stub_type_len; /* don't know */ - uint8 padding; /* padding */ + uint8 padding; + uint8 reserved; /* padding */ - uint32 unknown; /* pointer */ + uint32 auth_context; /* pointer */ } RPC_HDR_AUTH; @@ -229,7 +229,6 @@ typedef struct rpc_auth_netsec_chk_info struct netsec_auth_struct { - RPC_AUTH_NETSEC_NEG netsec_neg; uchar sess_key[16]; uint32 seq_num; }; -- cgit From 83479a9dc9affb36ea14e701ee8847195c6b8f7f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 9 Apr 2003 15:34:12 +0000 Subject: no needed anymore (This used to be commit 8fd9450c8363021e23256903578fabbf77083978) --- source3/include/vt_mode.h | 48 ----------------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 source3/include/vt_mode.h (limited to 'source3/include') diff --git a/source3/include/vt_mode.h b/source3/include/vt_mode.h deleted file mode 100644 index 85b481122e..0000000000 --- a/source3/include/vt_mode.h +++ /dev/null @@ -1,48 +0,0 @@ -/* vt_mode.h */ -/* -support vtp-sessions - -written by Christian A. Lademann -*/ - -/* -02.05.95:cal:ported to samba-1.9.13 -*/ - -#ifndef __vt_mode_h__ -# define __vt_mode_h__ - -# define VT_CLOSED 0 -# define VT_OPEN 1 - -# define MS_NONE 0 -# define MS_PTY 1 -# define MS_STREAM 2 -# define MS_VTY 3 - -# define VT_MAXREAD 32 - - -# undef EXTERN - -# ifndef __vt_mode_c__ -# define EXTERN extern -# define DEFAULT(v) -# else -# define EXTERN -# define DEFAULT(v) =(v) -# endif - - EXTERN int VT_Status DEFAULT(VT_CLOSED), - VT_Fd DEFAULT(-1), - VT_ChildPID DEFAULT(-1); - - EXTERN BOOL VT_Mode DEFAULT(False), - VT_ChildDied DEFAULT(False); - - EXTERN char *VT_Line DEFAULT(NULL); - -# undef EXTERN - - -#endif /* __vt_mode_h__ */ -- cgit From 803e23f403bdb38d2523d73fd12083da486bca2f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 15:47:06 +0000 Subject: This is the netlogon schannel client code. Try a rpcclient -S pdc -U% -c "samlogon user password" and it should work with the schannel. Needs testing platforms different from NT4SP6. Volker (This used to be commit ecd0ee4d248e750168597ccf79c389513bb0f740) --- source3/include/client.h | 6 ++++++ source3/include/smb.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'source3/include') diff --git a/source3/include/client.h b/source3/include/client.h index 0ea793de68..d75effd7d0 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -132,6 +132,12 @@ struct cli_state { */ uint16 nt_pipe_fnum; /* Pipe handle. */ + + uint16 saved_netlogon_pipe_fnum; /* The "first" pipe to get + the session key for the + schannel. */ + struct netsec_auth_struct auth_info; + unsigned char sess_key[16]; /* Current session key. */ unsigned char ntlmssp_hash[258]; /* ntlmssp data. */ uint32 ntlmssp_cli_flgs; /* ntlmssp client flags */ diff --git a/source3/include/smb.h b/source3/include/smb.h index 3bb6bf9237..78690cd524 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -188,6 +188,8 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; #define PIPE_SPOOLSS "\\PIPE\\spoolss" #define PIPE_NETDFS "\\PIPE\\netdfs" +#define PIPE_NETLOGON_PLAIN "\\NETLOGON" + #define PI_LSARPC 0 #define PI_LSARPC_DS 1 #define PI_SAMR 2 -- cgit From 1f04eb2e2617ac05974c21bdac9ebb4781b5a9d9 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Wed, 9 Apr 2003 16:48:59 +0000 Subject: Complete what I've seen (and then some)t of the PAC. I haven't seen the rid+attr arrays for group membership, nor sids or the same kind of arrays for resource domains, so I don't know how that will work. Also, the PAC info type 10 is now decoded, but I don't know what it's for. It has an NTTIME, a 16-bit name length, and a username. According to M$, it's not needed, because they didn't doc it... (This used to be commit 28ab8504cf6c181866106e5cc626a5896283d0a9) --- source3/include/authdata.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'source3/include') diff --git a/source3/include/authdata.h b/source3/include/authdata.h index 1521185a8f..0798b72bdf 100644 --- a/source3/include/authdata.h +++ b/source3/include/authdata.h @@ -27,6 +27,13 @@ #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; @@ -38,6 +45,11 @@ typedef struct group_membership { 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; @@ -93,7 +105,7 @@ typedef struct pac_logon_info { uint32 ptr_res_group_dom_sid; uint32 res_group_count; - uint32 ptr_res_group_sids; + uint32 ptr_res_groups; UNISTR2 uni_user_name; /* user name unicode string header */ UNISTR2 uni_full_name; /* user's full name unicode string header */ @@ -104,12 +116,11 @@ typedef struct pac_logon_info { UNISTR2 uni_dom_controller; UNISTR2 uni_dom_name; DOM_SID2 dom_sid; - /* group membership array needs to go in here. - I've not seen it on the wire */ + GROUP_MEMBERSHIP_ARRAY groups; KRB_SID_AND_ATTR_ARRAY extra_sids; DOM_SID2 res_group_dom_sid; - /* resource group membership array needs to go in here */ - + GROUP_MEMBERSHIP_ARRAY res_groups; + } PAC_LOGON_INFO; typedef struct pac_info_ctr @@ -119,6 +130,7 @@ typedef struct pac_info_ctr PAC_LOGON_INFO *logon_info; PAC_SIGNATURE_DATA *srv_cksum; PAC_SIGNATURE_DATA *privsrv_cksum; + UNKNOWN_TYPE_10 *type_10; } pac; } PAC_INFO_CTR; -- cgit From 065561932c660be13f80fefa2a310a51b0c07f9c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 11 Apr 2003 04:09:14 +0000 Subject: A new RPC pipe! The \pipe\echo named pipe is for testing large RPC requests and responses and is only compiled in when --enable-developer is passed to configure. It includes server and client side code for generating and responding to functions on this pipe. The functions are: - AddOne: add one to the uint32 argument and return ig - EchoData: echo back a variable sized char array to the caller - SourceData: request a variable sized char array - SinkData: send a variable sized char array and throw it away There's a win32 implementation of the client and server in the junkcode CVS repository in the rpcecho-win32 subdirectory. (This used to be commit 4ccd34ef836eba05f81dc2da73fd7cfaac201798) --- source3/include/ntdomain.h | 2 ++ source3/include/rpc_echo.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++ source3/include/smb.h | 4 ++- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 source3/include/rpc_echo.h (limited to 'source3/include') diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 9216640c03..b6ab4fd0c5 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -385,4 +385,6 @@ struct acct_info #include "rpc_spoolss.h" #include "rpc_dfs.h" #include "rpc_ds.h" +#include "rpc_echo.h" + #endif /* _NT_DOMAIN_H */ diff --git a/source3/include/rpc_echo.h b/source3/include/rpc_echo.h new file mode 100644 index 0000000000..8fa389cf56 --- /dev/null +++ b/source3/include/rpc_echo.h @@ -0,0 +1,74 @@ +/* + 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 +{ +} ECHO_R_SINK_DATA; + +#endif diff --git a/source3/include/smb.h b/source3/include/smb.h index 78690cd524..02b5b9435e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -187,6 +187,7 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; #define PIPE_LSARPC "\\PIPE\\lsarpc" #define PIPE_SPOOLSS "\\PIPE\\spoolss" #define PIPE_NETDFS "\\PIPE\\netdfs" +#define PIPE_ECHO "\\PIPE\\rpcecho" #define PIPE_NETLOGON_PLAIN "\\NETLOGON" @@ -199,7 +200,8 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; #define PI_WINREG 6 #define PI_SPOOLSS 7 #define PI_NETDFS 8 -#define PI_MAX_PIPES 9 +#define PI_ECHO 9 +#define PI_MAX_PIPES 10 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ typedef struct nttime_info -- cgit From 5b51fc4f065e9e68eefb530eb99ad8da9f4e5d28 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 11 Apr 2003 23:32:00 +0000 Subject: smbcquota patch from metze (This used to be commit 74fab8f0d24004b1dfd5ce0fd7402895652f941f) --- source3/include/fake_file.h | 46 +++++++++++++++++++++ source3/include/ntquotas.h | 97 +++++++++++++++++++++++++++++++++++++++++++++ source3/include/smb.h | 71 ++++++++++++++++++++------------- source3/include/trans2.h | 6 ++- 4 files changed, 191 insertions(+), 29 deletions(-) create mode 100644 source3/include/fake_file.h create mode 100644 source3/include/ntquotas.h (limited to 'source3/include') diff --git a/source3/include/fake_file.h b/source3/include/fake_file.h new file mode 100644 index 0000000000..3fe60072e9 --- /dev/null +++ b/source3/include/fake_file.h @@ -0,0 +1,46 @@ +/* + 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/source3/include/ntquotas.h b/source3/include/ntquotas.h new file mode 100644 index 0000000000..1425e59bb8 --- /dev/null +++ b/source3/include/ntquotas.h @@ -0,0 +1,97 @@ +/* + 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; + enum SMB_QUOTA_TYPE 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/source3/include/smb.h b/source3/include/smb.h index 02b5b9435e..62cc95ecb0 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -238,6 +238,8 @@ typedef struct nttime_info #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 { @@ -366,6 +368,7 @@ typedef struct SMB_STRUCT_STAT *statinfo; } smb_filename; +#include "fake_file.h" typedef struct files_struct { @@ -402,6 +405,8 @@ typedef struct files_struct char *fsp_name; } files_struct; +#include "ntquotas.h" + /* used to hold an arbitrary blob of data */ typedef struct data_blob { uint8 *data; @@ -972,23 +977,23 @@ struct bitmap { #define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53 /* 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 +#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 @@ -997,6 +1002,13 @@ 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 @@ -1237,18 +1249,23 @@ struct bitmap { #define RENAME_REPLACE_IF_EXISTS 1 /* Filesystem Attributes. */ -#define FILE_CASE_SENSITIVE_SEARCH 0x01 -#define FILE_CASE_PRESERVED_NAMES 0x02 -#define FILE_UNICODE_ON_DISK 0x04 +#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 +#define FILE_CASE_PRESERVED_NAMES 0x00000002 +#define FILE_UNICODE_ON_DISK 0x00000004 /* According to cifs9f, this is 4, not 8 */ /* Acconding to testing, this actually sets the security attribute! */ -#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 +#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 /* ChangeNotify flags. */ #define FILE_NOTIFY_CHANGE_FILE 0x001 diff --git a/source3/include/trans2.h b/source3/include/trans2.h index 3468d3b995..2ccf83478b 100644 --- a/source3/include/trans2.h +++ b/source3/include/trans2.h @@ -206,7 +206,9 @@ Byte offset Type name description #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 #define l2_vol_fdateCreation 0 #define l2_vol_cch 4 @@ -320,7 +322,7 @@ Byte offset Type name description #define SMB_FS_SIZE_INFORMATION 1003 #define SMB_FS_DEVICE_INFORMATION 1004 #define SMB_FS_ATTRIBUTE_INFORMATION 1005 -#define SMB_FS_CONTROL_INFORMATION 1006 +#define SMB_FS_QUOTA_INFORMATION 1006 #define SMB_FS_FULL_SIZE_INFORMATION 1007 #define SMB_FS_OBJECTID_INFORMATION 1008 -- cgit