summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-07-16 05:34:56 +0000
committerGerald Carter <jerry@samba.org>2003-07-16 05:34:56 +0000
commit4a090ba06a54f5da179ac02bb307cc03d08831bf (patch)
treeed652ef36be7f16682c358816334f969a22f1c27 /source3/include
parent95fe82670032a3a43571b46d7bbf2c26bc8cdcd9 (diff)
downloadsamba-4a090ba06a54f5da179ac02bb307cc03d08831bf.tar.gz
samba-4a090ba06a54f5da179ac02bb307cc03d08831bf.tar.bz2
samba-4a090ba06a54f5da179ac02bb307cc03d08831bf.zip
trying to get HEAD building again. If you want the code
prior to this merge, checkout HEAD_PRE_3_0_0_BETA_3_MERGE (This used to be commit adb98e7b7cd0f025b52c570e4034eebf4047b1ad)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/.cvsignore1
-rw-r--r--source3/include/ads.h1
-rw-r--r--source3/include/auth.h2
-rw-r--r--source3/include/client.h17
-rw-r--r--source3/include/idmap.h19
-rw-r--r--source3/include/includes.h33
-rw-r--r--source3/include/mapping.h28
-rw-r--r--source3/include/ntioctl.h44
-rw-r--r--source3/include/ntlmssp.h9
-rw-r--r--source3/include/passdb.h27
-rw-r--r--source3/include/privileges.h25
-rw-r--r--source3/include/rpc_dce.h26
-rw-r--r--source3/include/rpc_lsa.h20
-rw-r--r--source3/include/rpc_samr.h10
-rw-r--r--source3/include/rpc_secdes.h19
-rw-r--r--source3/include/rpc_srvsvc.h8
-rw-r--r--source3/include/safe_string.h23
-rw-r--r--source3/include/smb.h35
-rw-r--r--source3/include/smb_macros.h60
-rw-r--r--source3/include/smbprofile.h8
-rw-r--r--source3/include/trans2.h1
-rw-r--r--source3/include/version.h2
-rw-r--r--source3/include/vfs.h420
23 files changed, 509 insertions, 329 deletions
diff --git a/source3/include/.cvsignore b/source3/include/.cvsignore
index 4bff170b3b..bff248727f 100644
--- a/source3/include/.cvsignore
+++ b/source3/include/.cvsignore
@@ -3,5 +3,4 @@ config.h
stamp-h
proto.h
wrepld_proto.h
-tdbsam2_parse_info.h
config.h.in
diff --git a/source3/include/ads.h b/source3/include/ads.h
index 7f7568d8b0..0961c9581c 100644
--- a/source3/include/ads.h
+++ b/source3/include/ads.h
@@ -205,6 +205,7 @@ typedef void **ADS_MODLIST;
#define ADS_AUTH_NO_BIND 0x02
#define ADS_AUTH_ANON_BIND 0x04
#define ADS_AUTH_SIMPLE_BIND 0x08
+#define ADS_AUTH_ALLOW_NTLMSSP 0x10
/* Kerberos environment variable names */
#define KRB5_ENV_CCNAME "KRB5CCNAME"
diff --git a/source3/include/auth.h b/source3/include/auth.h
index eb80e3c5b4..6b42418be8 100644
--- a/source3/include/auth.h
+++ b/source3/include/auth.h
@@ -96,6 +96,8 @@ typedef struct auth_serversupplied_info
SAM_ACCOUNT *sam_account;
void *pam_handle;
+
+ char *unix_name;
} auth_serversupplied_info;
diff --git a/source3/include/client.h b/source3/include/client.h
index d75effd7d0..fad2c099b9 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -66,7 +66,7 @@ typedef struct smb_sign_info {
BOOL negotiated_smb_signing;
BOOL allow_smb_signing;
BOOL doing_signing;
- BOOL mandetory_signing;
+ BOOL mandatory_signing;
} smb_sign_info;
struct cli_state {
@@ -131,25 +131,30 @@ struct cli_state {
* 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_CLIENT_STATE *ntlmssp_pipe_state;
+
unsigned char sess_key[16]; /* Current session key. */
- unsigned char ntlmssp_hash[258]; /* ntlmssp data. */
- uint32 ntlmssp_cli_flgs; /* ntlmssp client flags */
- uint32 ntlmssp_srv_flgs; /* ntlmssp server flags */
- uint32 ntlmssp_seq_num; /* ntlmssp sequence number */
DOM_CRED clnt_cred; /* Client credential. */
fstring mach_acct; /* MYNAME$. */
fstring srv_name_slash; /* \\remote server. */
fstring clnt_name_slash; /* \\local client. */
uint16 max_xmit_frag;
uint16 max_recv_frag;
- uint32 ntlmssp_flags;
+
BOOL use_kerberos;
BOOL use_spnego;
diff --git a/source3/include/idmap.h b/source3/include/idmap.h
index 1e56519453..ae7e4e5101 100644
--- a/source3/include/idmap.h
+++ b/source3/include/idmap.h
@@ -1,3 +1,5 @@
+#ifndef _IDMAP_H_
+#define _IDMAP_H_
/*
Unix SMB/CIFS implementation.
@@ -22,6 +24,9 @@
Boston, MA 02111-1307, USA.
*/
+#define SMB_IDMAP_INTERFACE_VERSION 2
+
+
#define ID_EMPTY 0x00
#define ID_USERID 0x01
#define ID_GROUPID 0x02
@@ -29,20 +34,16 @@
#define ID_TYPEMASK 0x0f
-#define ID_NOMAP 0x10
-#define ID_CACHE 0x20
-
-typedef union unid_t {
- uid_t uid;
- gid_t gid;
-} unid_t;
+#define ID_QUERY_ONLY 0x10
/* Filled out by IDMAP backends */
struct idmap_methods {
/* Called when backend is first loaded */
- NTSTATUS (*init)(void);
+ 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);
@@ -53,4 +54,4 @@ struct idmap_methods {
/* Called to dump backend status */
void (*status)(void);
};
-
+#endif /* _IDMAP_H_ */
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 534bbfbf26..edaeda3abe 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -437,6 +437,18 @@
#include <com_err.h>
#endif
+#if HAVE_ATTR_XATTR_H
+#include <attr/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
@@ -769,9 +781,6 @@ extern int errno;
#include "version.h"
#include "smb.h"
-/*
-#include "smbw.h"
-*/
#include "nameserv.h"
@@ -808,14 +817,12 @@ extern int errno;
#include "auth.h"
-#include "sam.h"
-
-#include "gums.h"
-
#include "idmap.h"
#include "client.h"
+
#include "smbw.h"
+
#include "session.h"
#include "asn_1.h"
@@ -828,8 +835,6 @@ extern int errno;
#include "nsswitch/winbind_client.h"
-#include "genparser.h"
-
/*
* Type for wide character dirent structure.
* Only d_name is defined by POSIX.
@@ -876,6 +881,10 @@ struct printjob;
struct smb_ldap_privates;
+/* forward declarations from smbldap.c */
+
+#include "smbldap.h"
+
/***** automatically generated prototypes *****/
#ifndef NO_PROTO_H
#include "proto.h"
@@ -1034,10 +1043,6 @@ 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
@@ -1283,7 +1288,7 @@ 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 krb5_get_smb_session_key(krb5_context context, krb5_auth_context auth_context, uint8 session_key[16]);
+BOOL get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, uint8 session_key[16]);
#endif /* HAVE_KRB5 */
/* TRUE and FALSE are part of the C99 standard and gcc, but
diff --git a/source3/include/mapping.h b/source3/include/mapping.h
index d4f2d28e6a..fdaa2b0453 100644
--- a/source3/include/mapping.h
+++ b/source3/include/mapping.h
@@ -19,29 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#define PRIV_ALL_INDEX 5
-
-#define SE_PRIV_NONE 0x0000
-#define SE_PRIV_ADD_MACHINES 0x0006
-#define SE_PRIV_SEC_PRIV 0x0008
-#define SE_PRIV_TAKE_OWNER 0x0009
-#define SE_PRIV_ADD_USERS 0xff01
-#define SE_PRIV_PRINT_OPERATOR 0xff03
-#define SE_PRIV_ALL 0xffff
-
#define ENUM_ONLY_MAPPED True
#define ENUM_ALL_MAPPED False
-#define MAPPING_WITH_PRIV True
-#define MAPPING_WITHOUT_PRIV False
-
-#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
-
-
typedef struct _GROUP_MAP {
struct pdb_methods *methods;
gid_t gid;
@@ -49,13 +29,5 @@ typedef struct _GROUP_MAP {
enum SID_NAME_USE sid_name_use;
fstring nt_name;
fstring comment;
- uint32 systemaccount;
- PRIVILEGE_SET priv_set;
} GROUP_MAP;
-typedef struct _PRIVS {
- uint32 se_priv;
- const char *priv;
- const char *description;
-} PRIVS;
-
diff --git a/source3/include/ntioctl.h b/source3/include/ntioctl.h
index 4749842ddc..17791fde18 100644
--- a/source3/include/ntioctl.h
+++ b/source3/include/ntioctl.h
@@ -23,4 +23,46 @@
we only need the sparse flag
*/
-#define NTIOCTL_SET_SPARSE 0x900c4
+
+/* 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
+
+#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
diff --git a/source3/include/ntlmssp.h b/source3/include/ntlmssp.h
index cfbbb00381..562e4853cc 100644
--- a/source3/include/ntlmssp.h
+++ b/source3/include/ntlmssp.h
@@ -64,8 +64,8 @@ enum NTLM_MESSAGE_TYPE
#define NTLMSSP_NAME_TYPE_SERVER 0x01
#define NTLMSSP_NAME_TYPE_DOMAIN 0x02
-#define NTLMSSP_NAME_TYPE_DOMAIN_DNS 0x03
-#define NTLMSSP_NAME_TYPE_SERVER_DNS 0x04
+#define NTLMSSP_NAME_TYPE_SERVER_DNS 0x03
+#define NTLMSSP_NAME_TYPE_DOMAIN_DNS 0x04
typedef struct ntlmssp_state
{
@@ -129,5 +129,10 @@ typedef struct ntlmssp_client_state
/* 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_CLIENT_STATE;
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index e14e250d34..e3077eee70 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -61,6 +61,7 @@ enum pdb_elements {
PDB_UNKNOWN6,
PDB_LMPASSWD,
PDB_NTPASSWD,
+ PDB_BACKEND_PRIVATE_DATA,
/* this must be the last element */
PDB_COUNT
@@ -137,6 +138,10 @@ typedef struct sam_passwd
uint32 unknown_5; /* 0x0002 0000 */
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
@@ -203,14 +208,11 @@ typedef struct pdb_context
NTSTATUS (*pdb_delete_sam_account)(struct pdb_context *, SAM_ACCOUNT *username);
- NTSTATUS (*pdb_getgrsid)(struct pdb_context *context, GROUP_MAP *map,
- DOM_SID sid, BOOL with_priv);
+ 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, BOOL with_priv);
+ NTSTATUS (*pdb_getgrgid)(struct pdb_context *context, GROUP_MAP *map, gid_t gid);
- NTSTATUS (*pdb_getgrnam)(struct pdb_context *context, GROUP_MAP *map,
- char *name, BOOL with_priv);
+ 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);
@@ -224,7 +226,7 @@ typedef struct pdb_context
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, BOOL with_priv);
+ BOOL unix_only);
void (*free_fn)(struct pdb_context **);
@@ -257,14 +259,11 @@ typedef struct pdb_methods
NTSTATUS (*delete_sam_account)(struct pdb_methods *, SAM_ACCOUNT *username);
- NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map,
- DOM_SID sid, BOOL with_priv);
+ NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map, DOM_SID sid);
- NTSTATUS (*getgrgid)(struct pdb_methods *methods, GROUP_MAP *map,
- gid_t gid, BOOL with_priv);
+ NTSTATUS (*getgrgid)(struct pdb_methods *methods, GROUP_MAP *map, gid_t gid);
- NTSTATUS (*getgrnam)(struct pdb_methods *methods, GROUP_MAP *map,
- char *name, BOOL with_priv);
+ NTSTATUS (*getgrnam)(struct pdb_methods *methods, GROUP_MAP *map, const char *name);
NTSTATUS (*add_group_mapping_entry)(struct pdb_methods *methods,
GROUP_MAP *map);
@@ -278,7 +277,7 @@ typedef struct pdb_methods
NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods,
enum SID_NAME_USE sid_name_use,
GROUP_MAP **rmap, int *num_entries,
- BOOL unix_only, BOOL with_priv);
+ BOOL unix_only);
void *private_data; /* Private data of some kind */
diff --git a/source3/include/privileges.h b/source3/include/privileges.h
index 404c5d246b..67d8a2cbcc 100644
--- a/source3/include/privileges.h
+++ b/source3/include/privileges.h
@@ -23,6 +23,22 @@
#ifndef PRIVILEGES_H
#define PRIVILEGES_H
+#define PRIV_ALL_INDEX 5
+
+#define SE_PRIV_NONE 0x0000
+#define SE_PRIV_ADD_MACHINES 0x0006
+#define SE_PRIV_SEC_PRIV 0x0008
+#define SE_PRIV_TAKE_OWNER 0x0009
+#define SE_PRIV_ADD_USERS 0xff01
+#define SE_PRIV_PRINT_OPERATOR 0xff03
+#define SE_PRIV_ALL 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
+
typedef struct LUID
{
uint32 low;
@@ -42,4 +58,11 @@ typedef struct privilege_set
LUID_ATTR *set;
} PRIVILEGE_SET;
-#endif /* _RPC_LSA_H */
+typedef struct _PRIVS {
+ uint32 se_priv;
+ const char *priv;
+ const char *description;
+} PRIVS;
+
+
+#endif /* PRIVILEGES_H */
diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h
index b99639d68d..dc82f45368 100644
--- a/source3/include/rpc_dce.h
+++ b/source3/include/rpc_dce.h
@@ -51,17 +51,32 @@ enum RPC_PKT_TYPE
/* NTLMSSP signature version */
#define NTLMSSP_SIGN_VERSION 0x01
-/* NTLMSSP auth type and level. */
+/* NTLMSSP auth type */
#define NTLMSSP_AUTH_TYPE 0xa
-#define NTLMSSP_AUTH_LEVEL 0x6
+
+/* 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_AUTH_LEVEL 0x6
#define NETSEC_SIGNATURE { 0x77, 0x00, 0x7a, 0x00, 0xff, 0xff, 0x00, 0x00 }
#define RPC_AUTH_NETSEC_CHK_LEN 0x20
#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
/* #define MAX_PDU_FRAG_LEN 0x10b8 this is what w2k sets */
@@ -222,8 +237,8 @@ typedef struct rpc_auth_netsec_neg_info
typedef struct rpc_auth_netsec_chk_info
{
uint8 sig [8]; /* 77 00 7a 00 ff ff 00 00 */
- uint8 data1[8];
- uint8 data3[8]; /* verifier, seq num */
+ uint8 packet_digest[8]; /* checksum over the packet, MD5'ed with session key */
+ uint8 seq_num[8]; /* verifier, seq num */
uint8 data8[8]; /* random 8-byte nonce */
} RPC_AUTH_NETSEC_CHK;
@@ -350,5 +365,4 @@ typedef struct rpc_auth_ntlmssp_chk_info
#define RPC_AUTH_NTLMSSP_CHK_LEN 16
-
#endif /* _DCE_RPC_H */
diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h
index d4136a9fde..135fd76d6c 100644
--- a/source3/include/rpc_lsa.h
+++ b/source3/include/rpc_lsa.h
@@ -237,7 +237,7 @@ typedef struct r_lsa_query_sec_obj_info
typedef struct lsa_query_info
{
POLICY_HND pol; /* policy handle */
- uint16 info_class; /* info class */
+ uint16 info_class; /* info class */
} LSA_Q_QUERY_INFO;
@@ -537,6 +537,7 @@ 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 */
@@ -553,6 +554,7 @@ typedef struct
DOM_SID2 sid;
uint32 removeall;
UNISTR2_ARRAY rights;
+ uint32 count;
} LSA_Q_REMOVE_ACCT_RIGHTS;
/* LSA_R_REMOVE_ACCT_RIGHTS - LSA remove account rights */
@@ -561,22 +563,6 @@ typedef struct
NTSTATUS status;
} LSA_R_REMOVE_ACCT_RIGHTS;
-/* LSA_Q_ENUM_ACCT_WITH_RIGHT - LSA enum accounts with right */
-typedef struct
-{
- POLICY_HND pol;
- STRHDR right_hdr;
- UNISTR2 right;
-} LSA_Q_ENUM_ACCT_WITH_RIGHT;
-
-/* LSA_R_ENUM_ACCT_WITH_RIGHT - LSA enum accounts with right */
-typedef struct
-{
- uint32 count;
- SID_ARRAY sids;
- NTSTATUS status;
-} LSA_R_ENUM_ACCT_WITH_RIGHT;
-
/* LSA_Q_PRIV_GET_DISPNAME - LSA get privilege display name */
typedef struct lsa_q_priv_get_dispname
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h
index e1fa9c06bc..7d28a0f3a7 100644
--- a/source3/include/rpc_samr.h
+++ b/source3/include/rpc_samr.h
@@ -147,16 +147,6 @@ SamrTestPrivateFunctionsUser
#define SAMR_SET_USERINFO 0x3A
#define SAMR_CONNECT4 0x3E
-
-typedef struct _DISP_USER_INFO {
- SAM_ACCOUNT *sam;
-} DISP_USER_INFO;
-
-typedef struct _DISP_GROUP_INFO {
- DOMAIN_GRP *grp;
-} DISP_GROUP_INFO;
-
-
typedef struct logon_hours_info
{
uint32 len; /* normally 21 bytes */
diff --git a/source3/include/rpc_secdes.h b/source3/include/rpc_secdes.h
index 1bb25e8651..fb7060cde3 100644
--- a/source3/include/rpc_secdes.h
+++ b/source3/include/rpc_secdes.h
@@ -78,7 +78,8 @@
#define SEC_DESC_DACL_DEFAULTED 0x0008
#define SEC_DESC_SACL_PRESENT 0x0010
#define SEC_DESC_SACL_DEFAULTED 0x0020
-#define SEC_DESC_SELF_RELATIVE 0x8000
+#define SEC_DESC_DACL_TRUSTED 0x0040
+#define SEC_DESC_SERVER_SECURITY 0x0080
/*
* New Windows 2000 bits.
*/
@@ -89,14 +90,28 @@
#define SE_DESC_DACL_PROTECTED 0x1000
#define SE_DESC_SACL_PROTECTED 0x2000
+/* Don't know what this means. */
+#define SEC_DESC_RM_CONTROL_VALID 0x4000
+
+#define SEC_DESC_SELF_RELATIVE 0x8000
+
/* security information */
#define OWNER_SECURITY_INFORMATION 0x00000001
#define GROUP_SECURITY_INFORMATION 0x00000002
#define DACL_SECURITY_INFORMATION 0x00000004
#define SACL_SECURITY_INFORMATION 0x00000008
+/* Extra W2K flags. */
+#define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000
+#define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000
+#define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000
+#define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000
#define ALL_SECURITY_INFORMATION (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|\
- DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION)
+ DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION|\
+ UNPROTECTED_SACL_SECURITY_INFORMATION|\
+ UNPROTECTED_DACL_SECURITY_INFORMATION|\
+ PROTECTED_SACL_SECURITY_INFORMATION|\
+ PROTECTED_DACL_SECURITY_INFORMATION)
/* Globally Unique ID */
#define GUID_SIZE 16
diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h
index 94d23bb4bc..5ebb77a8c2 100644
--- a/source3/include/rpc_srvsvc.h
+++ b/source3/include/rpc_srvsvc.h
@@ -463,9 +463,15 @@ typedef struct ptr_info_1004_info
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 dfs_root_flag;
+ uint32 share_info_flags;
} SRV_SHARE_INFO_1005;
typedef struct share_info_1006_info
diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h
index a6b352b02e..6656f4f6bb 100644
--- a/source3/include/safe_string.h
+++ b/source3/include/safe_string.h
@@ -113,24 +113,24 @@ size_t __unsafe_string_function_usage_here_char__(void);
#endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */
-/* 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
- * functions that provide the lengths with less pain */
-#define pstrcpy_base(dest, src, pstring_base) \
- safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1)
-
#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 */
+/* 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 */
#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)
+/* 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
+ * functions that provide the lengths with less pain */
+#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
@@ -209,9 +209,4 @@ size_t __unsafe_string_function_usage_here_char__(void);
#endif
-/* replace some string functions with multi-byte
- versions */
-#define strlower(s) strlower_m(s)
-#define strupper(s) strupper_m(s)
-
#endif
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 0889abf038..d2714e78bc 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -45,6 +45,7 @@
#define False (0)
#define True (1)
#define Auto (2)
+#define Required (3)
#ifndef _BOOL
typedef int BOOL;
@@ -66,6 +67,7 @@ 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)
@@ -155,6 +157,11 @@ 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.
*/
@@ -404,9 +411,11 @@ typedef struct files_struct
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 {
@@ -442,18 +451,10 @@ typedef struct
#include "smb_acls.h"
#include "vfs.h"
-typedef struct smb_vfs_handle_struct
-{
- void *data;
- /* Handle on dlopen() call */
- void *handle;
- struct smb_vfs_handle_struct *next, *prev;
-
-} smb_vfs_handle_struct;
-
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;
@@ -468,8 +469,9 @@ typedef struct connection_struct
char *connectpath;
char *origpath;
- struct vfs_ops vfs_ops; /* Filesystem operations */
- struct smb_vfs_handle_struct *vfs_private;
+ 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 */
@@ -1617,4 +1619,15 @@ typedef struct {
#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;
+};
+
#endif /* _SMB_H */
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 8e2cb1c818..21ccdf295c 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -77,12 +77,15 @@
#define OPEN_CONN(conn) ((conn) && (conn)->open)
#define IS_IPC(conn) ((conn) && (conn)->ipc)
#define IS_PRINT(conn) ((conn) && (conn)->printer)
-#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn)
+#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn && current_user.vuid==(fsp)->vuid)
-#define CHECK_FSP(fsp,conn) if (!FNUM_OK(fsp,conn)) \
+#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))
+ return(ERROR_DOS(ERRDOS,ERRbadaccess));\
+ } while(0)
#define CHECK_READ(fsp) if (!(fsp)->can_read) \
return(ERROR_DOS(ERRDOS,ERRbadaccess))
@@ -199,6 +202,7 @@ 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
@@ -244,52 +248,10 @@ copy an IP address from one buffer to another
#define dos_format(fname) string_replace(fname,'/','\\')
-/*******************************************************************
- vfs stat wrapper that calls internal2unix.
-********************************************************************/
-
-#define vfs_stat(conn, fname, st) ((conn)->vfs_ops.stat((conn), fname,(st)))
-
-/*******************************************************************
- vfs lstat wrapper that calls internal2unix.
-********************************************************************/
-
-#define vfs_lstat(conn, fname, st) ((conn)->vfs_ops.lstat((conn), fname,(st)))
-
-/*******************************************************************
- vfs fstat wrapper
-********************************************************************/
-
-#define vfs_fstat(fsp, fd, st) ((fsp)->conn->vfs_ops.fstat((fsp),(fd),(st)))
-
-/*******************************************************************
- vfs rmdir wrapper that calls internal2unix.
-********************************************************************/
-
-#define vfs_rmdir(conn,fname) ((conn)->vfs_ops.rmdir((conn),fname))
-
-/*******************************************************************
- vfs Unlink wrapper that calls internal2unix.
-********************************************************************/
-
-#define vfs_unlink(conn, fname) ((conn)->vfs_ops.unlink((conn),fname))
-
-/*******************************************************************
- vfs chmod wrapper that calls internal2unix.
-********************************************************************/
-
-#define vfs_chmod(conn,fname,mode) ((conn)->vfs_ops.chmod((conn),fname,(mode)))
-
-/*******************************************************************
- vfs chown wrapper that calls internal2unix.
-********************************************************************/
-
-#define vfs_chown(conn,fname,uid,gid) ((conn)->vfs_ops.chown((conn),fname,(uid),(gid)))
-
-/*******************************************************************
- A wrapper for vfs_chdir().
-********************************************************************/
+/*****************************************************************************
+ Check to see if we are a DO for this domain
+*****************************************************************************/
-#define vfs_chdir(conn,fname) ((conn)->vfs_ops.chdir((conn),fname))
+#define IS_DC (lp_server_role()==ROLE_DOMAIN_PDC || lp_server_role()==ROLE_DOMAIN_BDC)
#endif /* _SMB_MACROS_H */
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index e501de8c0e..a64c2ce69e 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -108,6 +108,10 @@ struct profile_stats {
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;
@@ -326,6 +330,10 @@ struct profile_stats {
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;
diff --git a/source3/include/trans2.h b/source3/include/trans2.h
index 2ccf83478b..eb5b1bc79f 100644
--- a/source3/include/trans2.h
+++ b/source3/include/trans2.h
@@ -224,6 +224,7 @@ Byte offset Type name description
#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
diff --git a/source3/include/version.h b/source3/include/version.h
index c0a1c702f2..5e2d47e1de 100644
--- a/source3/include/version.h
+++ b/source3/include/version.h
@@ -1 +1 @@
-#define VERSION "post3.0-HEAD"
+#define VERSION "3.0.0beta3"
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 756e417814..924d706321 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -1,8 +1,10 @@
/*
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
@@ -45,150 +47,41 @@
/* 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. */
-#define SMB_VFS_INTERFACE_VERSION 5
+/* 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. */
+#define SMB_VFS_INTERFACE_VERSION 8
-/* Version of supported cascaded interface backward compatibility.
- (version 5 corresponds to SMB_VFS_INTERFACE_VERSION 5)
- It is used in vfs_init_custom() to detect VFS modules which conform to cascaded
- VFS interface but implement elder version than current version of Samba uses.
- This allows to use old modules with new VFS interface as far as combined VFS operation
- set is coherent (will be in most cases).
-*/
-#define SMB_VFS_INTERFACE_CASCADED 5
+
+/* 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 };
/*
- Each VFS module must provide following global functions:
- vfs_init -- initialization function
- vfs_done -- finalization function
-
- vfs_init must return proper initialized vfs_op_tuple[] array
- which describes all operations this module claims to intercept. This function
- is called whenever module is loaded into smbd process using sys_dlopen().
-
- vfs_init must store somewhere vfs_handle reference if module wants to store per-instance
- private information for further usage. vfs_handle->data should be used to
- store such information. Do not try to change other fields in this structure
- or results likely to be unpredictable.
-
- vfs_done must perform finalization of the module. In particular,
- this function must free vfs_ops structure returned to module from smb_vfs_get_opaque_ops()
- function if it is used (see below). This function is called whenever module
- is unloaded from smbd process using sys_dlclose().
-
- Prototypes:
- vfs_op_tuple *vfs_init(const struct vfs_ops *def_vfs_ops,
- struct smb_vfs_handle_struct *vfs_handle);
- void vfs_done(connection_struct *conn);
-
All intercepted VFS operations must be declared as static functions inside module source
- in order to keep smbd namespace unpolluted. See source of skel, audit, and recycle bin
+ 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;
-struct vfs_ops {
-
- /* Disk operations */
-
- int (*connect)(struct connection_struct *conn, const char *service, const char *user);
- void (*disconnect)(struct connection_struct *conn);
- SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-
- /* Directory operations */
-
- DIR *(*opendir)(struct connection_struct *conn, const char *fname);
- struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
- int (*mkdir)(struct connection_struct *conn, const char *path, mode_t mode);
- int (*rmdir)(struct connection_struct *conn, const char *path);
- int (*closedir)(struct connection_struct *conn, DIR *dir);
-
- /* File operations */
-
- int (*open)(struct connection_struct *conn, const char *fname, int flags, mode_t mode);
- int (*close)(struct files_struct *fsp, int fd);
- ssize_t (*read)(struct files_struct *fsp, int fd, void *data, size_t n);
- ssize_t (*write)(struct files_struct *fsp, int fd, const void *data, size_t n);
- SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence);
- ssize_t (*sendfile)(int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
- int (*rename)(struct connection_struct *conn, const char *old, const char *new);
- int (*fsync)(struct files_struct *fsp, int fd);
- int (*stat)(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf);
- int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
- int (*lstat)(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf);
- int (*unlink)(struct connection_struct *conn, const char *path);
- int (*chmod)(struct connection_struct *conn, const char *path, mode_t mode);
- int (*fchmod)(struct files_struct *fsp, int fd, mode_t mode);
- int (*chown)(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid);
- int (*fchown)(struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
- int (*chdir)(struct connection_struct *conn, const char *path);
- char *(*getwd)(struct connection_struct *conn, char *buf);
- int (*utime)(struct connection_struct *conn, const char *path, struct utimbuf *times);
- int (*ftruncate)(struct files_struct *fsp, int fd, SMB_OFF_T offset);
- BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
- int (*symlink)(struct connection_struct *conn, const char *oldpath, const char *newpath);
- int (*readlink)(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz);
- int (*link)(struct connection_struct *conn, const char *oldpath, const char *newpath);
- int (*mknod)(struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev);
- char *(*realpath)(struct connection_struct *conn, const char *path, char *resolved_path);
-
- /* NT ACL operations. */
-
- size_t (*fget_nt_acl)(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc);
- size_t (*get_nt_acl)(struct files_struct *fsp, const char *name, struct security_descriptor_info **ppdesc);
- BOOL (*fset_nt_acl)(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd);
- BOOL (*set_nt_acl)(struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd);
-
- /* POSIX ACL operations. */
-
- int (*chmod_acl)(struct connection_struct *conn, const char *name, mode_t mode);
- int (*fchmod_acl)(struct files_struct *fsp, int fd, mode_t mode);
-
- int (*sys_acl_get_entry)(struct connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
- int (*sys_acl_get_tag_type)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
- int (*sys_acl_get_permset)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
- void * (*sys_acl_get_qualifier)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d);
- SMB_ACL_T (*sys_acl_get_file)(struct connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type);
- SMB_ACL_T (*sys_acl_get_fd)(struct files_struct *fsp, int fd);
- int (*sys_acl_clear_perms)(struct connection_struct *conn, SMB_ACL_PERMSET_T permset);
- int (*sys_acl_add_perm)(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
- char * (*sys_acl_to_text)(struct connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen);
- SMB_ACL_T (*sys_acl_init)(struct connection_struct *conn, int count);
- int (*sys_acl_create_entry)(struct connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
- int (*sys_acl_set_tag_type)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
- int (*sys_acl_set_qualifier)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual);
- int (*sys_acl_set_permset)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
- int (*sys_acl_valid)(struct connection_struct *conn, SMB_ACL_T theacl );
- int (*sys_acl_set_file)(struct connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
- int (*sys_acl_set_fd)(struct files_struct *fsp, int fd, SMB_ACL_T theacl);
- int (*sys_acl_delete_def_file)(struct connection_struct *conn, const char *path);
- int (*sys_acl_get_perm)(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
- int (*sys_acl_free_text)(struct connection_struct *conn, char *text);
- int (*sys_acl_free_acl)(struct connection_struct *conn, SMB_ACL_T posix_acl);
- int (*sys_acl_free_qualifier)(struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype);
-};
-
-struct vfs_options {
- struct vfs_options *prev, *next;
- char *name;
- char *value;
-};
-
/*
- Available VFS operations. These values must be in sync with vfs_ops struct.
+ 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 */
@@ -196,6 +89,8 @@ typedef enum _vfs_op_type {
SMB_VFS_OP_CONNECT = 0,
SMB_VFS_OP_DISCONNECT,
SMB_VFS_OP_DISK_FREE,
+ SMB_VFS_OP_GET_QUOTA,
+ SMB_VFS_OP_SET_QUOTA,
/* Directory operations */
@@ -269,12 +164,225 @@ typedef enum _vfs_op_type {
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);
+
+ /* 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 (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n);
+ 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;
+
+ /* 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 *write;
+ 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
@@ -300,7 +408,7 @@ typedef enum _vfs_op_layer {
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 does not */
+ 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 */
@@ -309,10 +417,10 @@ typedef enum _vfs_op_layer {
} vfs_op_layer;
/*
- VFS operation description. Each VFS module initialization function returns to VFS subsystem
- an array of vfs_op_tuple which describes all operations this module is willing to intercept.
- VFS subsystem initializes then vfs_ops using this information and passes it
- to next VFS module as underlying vfs_ops and to connection after all VFS modules are initialized.
+ 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 {
@@ -321,18 +429,46 @@ typedef struct _vfs_op_tuple {
vfs_op_layer layer;
} vfs_op_tuple;
-/*
- Return vfs_ops filled with current opaque VFS operations. This function is designed to
- be called from VFS module initialization function for those modules which needs 'direct' VFS
- access (loggers or initiators of file operations other than connection asks for).
-
- Returned vfs_ops must be cleaned up in VFS module's finalizer function (vfs_done_<module_name>)
- using safe_free().
-
- Prototype:
- struct vfs_ops *smb_vfs_get_opaque_ops();
-
- This prototype will be available via include/proto.h
-*/
+
+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); \
+ } \
+}
+
+#define SMB_VFS_OP(x) ((void *) x)
+
+
+#include "vfs_macros.h"
#endif /* _VFS_H */