summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-04-11 23:32:00 +0000
committerGerald Carter <jerry@samba.org>2003-04-11 23:32:00 +0000
commit5b51fc4f065e9e68eefb530eb99ad8da9f4e5d28 (patch)
treee0b97b40a4e42e5ccd1ca9de7b2cf4a4c837a899 /source3/include
parent04bb7e808ae391d207afb2d87e55ea0d20659dd4 (diff)
downloadsamba-5b51fc4f065e9e68eefb530eb99ad8da9f4e5d28.tar.gz
samba-5b51fc4f065e9e68eefb530eb99ad8da9f4e5d28.tar.bz2
samba-5b51fc4f065e9e68eefb530eb99ad8da9f4e5d28.zip
smbcquota patch from metze
(This used to be commit 74fab8f0d24004b1dfd5ce0fd7402895652f941f)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/fake_file.h46
-rw-r--r--source3/include/ntquotas.h97
-rw-r--r--source3/include/smb.h71
-rw-r--r--source3/include/trans2.h6
4 files changed, 191 insertions, 29 deletions
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