Jeremy.
return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels);
}
+static int skel_statvfs(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct vfs_statvfs_struct *statbuf)
+{
+ return vfswrap_statvfs(NULL, conn, path, statbuf);
+}
+
static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
{
return vfswrap_opendir(NULL, conn, fname, mask, attr);
{SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(skel_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE},
+ {SMB_VFS_OP(skel_statvfs), SMB_VFS_OP_STATVFS, SMB_VFS_LAYER_OPAQUE},
/* Directory operations */
return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
}
+static int skel_statvfs(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct vfs_statvfs_struct *statbuf)
+{
+ return SMB_VFS_NEXT_STATVFS(handle, conn, path, statbuf);
+}
+
static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
{
return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
{SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(skel_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(skel_statvfs), SMB_VFS_OP_STATVFS, SMB_VFS_LAYER_TRANSPARENT},
/* Directory operations */
lib/sysquotas_xfs.o lib/sysquotas_4A.o \
smbd/change_trust_pw.o smbd/fake_file.o \
smbd/quotas.o smbd/ntquotas.o $(AFS_OBJ) smbd/msdfs.o \
- $(AFS_SETTOKEN_OBJ) smbd/aio.o \
+ $(AFS_SETTOKEN_OBJ) smbd/aio.o smbd/statvfs.o \
$(MANGLE_OBJ) @VFS_STATIC@
SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \
VFS structures and parameters
Copyright (C) Jeremy Allison 1999-2005
Copyright (C) Tim Potter 1999
- Copyright (C) Alexander Bokovoy 2002
+ Copyright (C) Alexander Bokovoy 2002-2005
Copyright (C) Stefan (metze) Metzmacher 2003
This program is free software; you can redistribute it and/or modify
Also include aio calls. JRA. */
/* Changed to version 13 as the internal structure of files_struct has changed. JRA */
/* Changed to version 14 as the we had to change DIR to SMB_STRUCT_DIR. JRA */
-#define SMB_VFS_INTERFACE_VERSION 14
+/* Changed to version 15 as the we added the statvfs call. JRA */
+#define SMB_VFS_INTERFACE_VERSION 15
/* to bug old modules which are trying to compile with the old functions */
struct connection_struct;
struct files_struct;
struct security_descriptor_info;
+struct vfs_statvfs_struct;
/*
Available VFS operations. These values must be in sync with vfs_ops struct
SMB_VFS_OP_GET_QUOTA,
SMB_VFS_OP_SET_QUOTA,
SMB_VFS_OP_GET_SHADOW_COPY_DATA,
-
+ SMB_VFS_OP_STATVFS,
/* Directory operations */
int (*get_quota)(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
int (*set_quota)(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
+ int (*statvfs)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct vfs_statvfs_struct *statbuf);
/* Directory operations */
struct vfs_handle_struct *get_quota;
struct vfs_handle_struct *set_quota;
struct vfs_handle_struct *get_shadow_copy_data;
+ struct vfs_handle_struct *statvfs;
/* Directory operations */
using this information.
*/
-typedef struct _vfs_op_tuple {
+typedef struct vfs_op_tuple {
void* op;
vfs_op_type type;
vfs_op_layer layer;
} vfs_handle_struct;
+typedef struct vfs_statvfs_struct {
+ /* For undefined recommended transfer size return -1 in that field */
+ uint32 OptimalTransferSize; /* bsize on some os, iosize on other os */
+ uint32 BlockSize;
+
+ /*
+ The next three fields are in terms of the block size.
+ (above). If block size is unknown, 4096 would be a
+ reasonable block size for a server to report.
+ Note that returning the blocks/blocksavail removes need
+ to make a second call (to QFSInfo level 0x103 to get this info.
+ UserBlockAvail is typically less than or equal to BlocksAvail,
+ if no distinction is made return the same value in each.
+ */
+
+ SMB_BIG_UINT TotalBlocks;
+ SMB_BIG_UINT BlocksAvail; /* bfree */
+ SMB_BIG_UINT UserBlocksAvail; /* bavail */
+
+ /* For undefined Node fields or FSID return -1 */
+ SMB_BIG_UINT TotalFileNodes;
+ SMB_BIG_UINT FreeFileNodes;
+ SMB_BIG_UINT FsIdentifier; /* fsid */
+ /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
+ /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */
+} vfs_statvfs_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)); \
#define SMB_VFS_GET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.get_quota((conn)->vfs.handles.get_quota, (conn), (qtype), (id), (qt)))
#define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.set_quota((conn)->vfs.handles.set_quota, (conn), (qtype), (id), (qt)))
#define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs.ops.get_shadow_copy_data((fsp)->conn->vfs.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
+#define SMB_VFS_STATVFS(conn, path, statbuf) ((conn)->vfs.ops.statvfs((conn)->vfs.handles.statvfs, (conn), (path), (statbuf)))
/* Directory operations */
#define SMB_VFS_OPENDIR(conn, fname, mask, attr) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (conn), (fname), (mask), (attr)))
#define SMB_VFS_OPAQUE_GET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.get_quota((conn)->vfs_opaque.handles.get_quota, (conn), (qtype), (id), (qt)))
#define SMB_VFS_OPAQUE_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.set_quota((conn)->vfs_opaque.handles.set_quota, (conn), (qtype), (id), (qt)))
#define SMB_VFS_OPAQUE_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs_opaque.ops.get_shadow_copy_data((fsp)->conn->vfs_opaque.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
+#define SMB_VFS_OPAQUE_STATVFS(conn, path, statbuf) ((conn)->vfs_opaque.ops.statvfs((conn)->vfs_opaque.handles.statvfs, (conn), (path), (statbuf)))
/* Directory operations */
#define SMB_VFS_OPAQUE_OPENDIR(conn, fname, mask, attr) ((conn)->vfs_opaque.ops.opendir((conn)->vfs_opaque.handles.opendir, (conn), (fname), (mask), (attr)))
#define SMB_VFS_NEXT_GET_QUOTA(handle, conn, qtype, id, qt) ((handle)->vfs_next.ops.get_quota((handle)->vfs_next.handles.get_quota, (conn), (qtype), (id), (qt)))
#define SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, qt) ((handle)->vfs_next.ops.set_quota((handle)->vfs_next.handles.set_quota, (conn), (qtype), (id), (qt)))
#define SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data ,labels) ((handle)->vfs_next.ops.get_shadow_copy_data((handle)->vfs_next.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
+#define SMB_VFS_NEXT_STATVFS(handle, conn, path, statbuf) ((handle)->vfs_next.ops.statvfs((handle)->vfs_next.handles.statvfs, (conn), (path), (statbuf)))
/* Directory operations */
#define SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (conn), (fname), (mask), (attr)))
static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
struct files_struct *fsp,
SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
+static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
+ struct connection_struct *conn,
+ const char *path,
+ struct vfs_statvfs_struct *statbuf);
static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
const char *fname, const char *mask, uint32 attr);
SMB_VFS_LAYER_LOGGER},
{SMB_VFS_OP(smb_full_audit_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,
SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_full_audit_statvfs), SMB_VFS_OP_STATVFS,
+ SMB_VFS_LAYER_LOGGER},
/* Directory operations */
{ SMB_VFS_OP_GET_QUOTA, "get_quota" },
{ SMB_VFS_OP_SET_QUOTA, "set_quota" },
{ SMB_VFS_OP_GET_SHADOW_COPY_DATA, "get_shadow_copy_data" },
+ { SMB_VFS_OP_STATVFS, "statvfs" },
{ SMB_VFS_OP_OPENDIR, "opendir" },
{ SMB_VFS_OP_READDIR, "readdir" },
{ SMB_VFS_OP_SEEKDIR, "seekdir" },
return result;
}
+static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
+ struct connection_struct *conn,
+ const char *path,
+ struct vfs_statvfs_struct *statbuf)
+{
+ int result;
+
+ result = SMB_VFS_NEXT_STATVFS(handle, conn, path, statbuf);
+
+ do_log(SMB_VFS_OP_STATVFS, (result >= 0), handle, "");
+
+ return result;
+}
+
static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
const char *fname, const char *mask, uint32 attr)
{
Copyright (C) Jeremy Allison 1994-2003
Copyright (C) Stefan (metze) Metzmacher 2003
Copyright (C) Volker Lendecke 2005
+ Copyright (C) Steve French 2005
Extensively modified by Andrew Tridgell, 1995
CIFS_UNIX_POSIX_PATHNAMES_CAP))); /* We have POSIX ACLs and pathname capability. */
break;
+ case SMB_QUERY_POSIX_FS_INFO:
+ {
+ int rc;
+ vfs_statvfs_struct svfs;
+
+ if (!lp_unix_extensions())
+ return ERROR_DOS(ERRDOS,ERRunknownlevel);
+
+ rc = SMB_VFS_STATVFS(conn, ".", &svfs);
+
+ if (!rc) {
+ data_len = 56;
+ SIVAL(pdata,0,svfs.OptimalTransferSize);
+ SIVAL(pdata,4,svfs.BlockSize);
+ SBIG_UINT(pdata,8,svfs.TotalBlocks);
+ SBIG_UINT(pdata,16,svfs.BlocksAvail);
+ SBIG_UINT(pdata,24,svfs.UserBlocksAvail);
+ SBIG_UINT(pdata,32,svfs.TotalFileNodes);
+ SBIG_UINT(pdata,40,svfs.FreeFileNodes);
+ SBIG_UINT(pdata,48,svfs.FsIdentifier);
+ DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_POSIX_FS_INFO succsessful\n"));
+#ifdef EOPNOTSUPP
+ } else if (rc == EOPNOTSUPP) {
+ return ERROR_DOS(ERRDOS, ERRunknownlevel);
+#endif /* EOPNOTSUPP */
+ } else {
+ DEBUG(0,("vfs_statvfs() failed for service [%s]\n",lp_servicename(SNUM(conn))));
+ return ERROR_DOS(ERRSRV,ERRerror);
+ }
+ break;
+ }
+
case SMB_MAC_QUERY_FS_INFO:
/*
* Thursby MAC extension... ONLY on NTFS filesystems
return -1; /* Not implemented. */
}
+int vfswrap_statvfs(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, vfs_statvfs_struct *statbuf)
+{
+ return sys_statvfs(path, statbuf);
+}
+
/* Directory operations */
SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
vfswrap_get_quota,
vfswrap_set_quota,
vfswrap_get_shadow_copy_data,
+ vfswrap_statvfs,
/* Directory operations */
return 0;
}
+#ifdef HAVE_LDAP
static void print_ldap_srvlist(char *srvlist)
{
char *cur, *next;
cur = next;
} while (next);
}
-
+#endif
static int net_lookup_ldap(int argc, const char **argv)
{
DATA_BLOB token;
NTSTATUS status;
ssize_t len;
- TALLOC_CTX *mem_ctx = talloc_init("manage_gss_spnego_request");
char *user = NULL;
char *domain = NULL;
#ifdef HAVE_KRB5
if (strcmp(request.negTokenInit.mechTypes[0], OID_KERBEROS5_OLD) == 0) {
+ TALLOC_CTX *mem_ctx = talloc_init("manage_gss_spnego_request");
char *principal;
DATA_BLOB ap_rep;
DATA_BLOB session_key;