summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-10-20 17:33:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:08 -0500
commita5b339c799b39d5147c6d31f94cc0b2ea9c865db (patch)
tree0382efacfd7b5d944f1c1903df0243956e67cbab /source3
parentfc8292f38151705e520880acbf57a87982e4325c (diff)
downloadsamba-a5b339c799b39d5147c6d31f94cc0b2ea9c865db.tar.gz
samba-a5b339c799b39d5147c6d31f94cc0b2ea9c865db.tar.bz2
samba-a5b339c799b39d5147c6d31f94cc0b2ea9c865db.zip
r11232: Added ab's POSIX statvfs vfs call. Sorry for the delay ab.
Jeremy. (This used to be commit af8545806770a7530eecc184bdd230ca14999884)
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in2
-rw-r--r--source3/include/vfs.h40
-rw-r--r--source3/include/vfs_macros.h3
-rw-r--r--source3/modules/vfs_full_audit.c21
-rw-r--r--source3/smbd/trans2.c33
-rw-r--r--source3/smbd/vfs-wrap.c5
-rw-r--r--source3/smbd/vfs.c1
-rw-r--r--source3/utils/net_lookup.c3
-rw-r--r--source3/utils/ntlm_auth.c2
9 files changed, 103 insertions, 7 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 77e79d5b17..f6564d7d52 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -400,7 +400,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
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) \
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 3bd0fda9a4..cde2039d1a 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -3,7 +3,7 @@
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
@@ -60,7 +60,8 @@
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 */
@@ -82,6 +83,7 @@ struct vfs_handle_struct;
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
@@ -101,7 +103,7 @@ typedef enum _vfs_op_type {
SMB_VFS_OP_GET_QUOTA,
SMB_VFS_OP_SET_QUOTA,
SMB_VFS_OP_GET_SHADOW_COPY_DATA,
-
+ SMB_VFS_OP_STATVFS,
/* Directory operations */
@@ -222,6 +224,7 @@ struct vfs_ops {
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 */
@@ -334,6 +337,7 @@ struct vfs_ops {
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 */
@@ -478,7 +482,7 @@ typedef enum _vfs_op_layer {
using this information.
*/
-typedef struct _vfs_op_tuple {
+typedef struct vfs_op_tuple {
void* op;
vfs_op_type type;
vfs_op_layer layer;
@@ -495,6 +499,34 @@ typedef struct vfs_handle_struct {
} 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)); \
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index e6bfb1f527..33810c301f 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -34,6 +34,7 @@
#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)))
@@ -144,6 +145,7 @@
#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)))
@@ -254,6 +256,7 @@
#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)))
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 99d5244482..d9d898dc0e 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -85,6 +85,10 @@ static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
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);
@@ -317,6 +321,8 @@ static vfs_op_tuple audit_op_tuples[] = {
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 */
@@ -518,6 +524,7 @@ static struct {
{ 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" },
@@ -864,6 +871,20 @@ static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
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)
{
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index cfb630a572..155f8b384c 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -4,6 +4,7 @@
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
@@ -2403,6 +2404,38 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
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
diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c
index c203af0c55..bbb7b5bb30 100644
--- a/source3/smbd/vfs-wrap.c
+++ b/source3/smbd/vfs-wrap.c
@@ -86,6 +86,11 @@ int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle, struct files_
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)
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 67970f203a..52966d59ae 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -57,6 +57,7 @@ static struct vfs_ops default_vfs = {
vfswrap_get_quota,
vfswrap_set_quota,
vfswrap_get_shadow_copy_data,
+ vfswrap_statvfs,
/* Directory operations */
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index 9ddfe62508..7f79b6d4f1 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -60,6 +60,7 @@ static int net_lookup_host(int argc, const char **argv)
return 0;
}
+#ifdef HAVE_LDAP
static void print_ldap_srvlist(char *srvlist)
{
char *cur, *next;
@@ -80,7 +81,7 @@ static void print_ldap_srvlist(char *srvlist)
cur = next;
} while (next);
}
-
+#endif
static int net_lookup_ldap(int argc, const char **argv)
{
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 41203dac74..d61abb6465 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -795,7 +795,6 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode,
DATA_BLOB token;
NTSTATUS status;
ssize_t len;
- TALLOC_CTX *mem_ctx = talloc_init("manage_gss_spnego_request");
char *user = NULL;
char *domain = NULL;
@@ -898,6 +897,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode,
#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;