mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r7893: Add in the extra parameters to opendir() to fix the large directory/insane app
problem. Rev vfs version. Doesn't change the normal codepath.
Jeremy.
(This used to be commit 0f03a6bdcd
)
This commit is contained in:
parent
b8e787bcac
commit
ff7e5c2673
@ -71,9 +71,9 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs
|
|||||||
return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels);
|
return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
|
static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
return vfswrap_opendir(NULL, conn, fname);
|
return vfswrap_opendir(NULL, conn, fname, mask, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
|
static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
|
||||||
|
@ -70,9 +70,9 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs
|
|||||||
return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
|
return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
|
static 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);
|
return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
|
static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
|
||||||
|
@ -56,7 +56,8 @@
|
|||||||
/* Changed to version 9 to include the get_shadow_data call. --metze */
|
/* Changed to version 9 to include the get_shadow_data call. --metze */
|
||||||
/* Changed to version 10 to include pread/pwrite calls. */
|
/* Changed to version 10 to include pread/pwrite calls. */
|
||||||
/* Changed to version 11 to include seekdir/telldir/rewinddir calls. JRA */
|
/* Changed to version 11 to include seekdir/telldir/rewinddir calls. JRA */
|
||||||
#define SMB_VFS_INTERFACE_VERSION 11
|
/* Changed to version 12 to add mask and attributes to opendir(). JRA */
|
||||||
|
#define SMB_VFS_INTERFACE_VERSION 12
|
||||||
|
|
||||||
|
|
||||||
/* to bug old modules witch are trying to compile with the old functions */
|
/* to bug old modules witch are trying to compile with the old functions */
|
||||||
@ -212,7 +213,7 @@ struct vfs_ops {
|
|||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
|
|
||||||
DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname);
|
DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attributes);
|
||||||
SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
|
SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
|
||||||
void (*seekdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp, long offset);
|
void (*seekdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp, long offset);
|
||||||
long (*telldir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
|
long (*telldir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#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_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)))
|
||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
#define SMB_VFS_OPENDIR(conn, fname) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (conn), (fname)))
|
#define SMB_VFS_OPENDIR(conn, fname, mask, attr) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (conn), (fname), (mask), (attr)))
|
||||||
#define SMB_VFS_READDIR(conn, dirp) ((conn)->vfs.ops.readdir((conn)->vfs.handles.readdir, (conn), (dirp)))
|
#define SMB_VFS_READDIR(conn, dirp) ((conn)->vfs.ops.readdir((conn)->vfs.handles.readdir, (conn), (dirp)))
|
||||||
#define SMB_VFS_SEEKDIR(conn, dirp, offset) ((conn)->vfs.ops.seekdir((conn)->vfs.handles.seekdir, (conn), (dirp), (offset)))
|
#define SMB_VFS_SEEKDIR(conn, dirp, offset) ((conn)->vfs.ops.seekdir((conn)->vfs.handles.seekdir, (conn), (dirp), (offset)))
|
||||||
#define SMB_VFS_TELLDIR(conn, dirp) ((conn)->vfs.ops.telldir((conn)->vfs.handles.telldir, (conn), (dirp)))
|
#define SMB_VFS_TELLDIR(conn, dirp) ((conn)->vfs.ops.telldir((conn)->vfs.handles.telldir, (conn), (dirp)))
|
||||||
@ -137,7 +137,7 @@
|
|||||||
#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_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)))
|
||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
#define SMB_VFS_OPAQUE_OPENDIR(conn, fname) ((conn)->vfs_opaque.ops.opendir((conn)->vfs_opaque.handles.opendir, (conn), (fname)))
|
#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_OPAQUE_READDIR(conn, dirp) ((conn)->vfs_opaque.ops.readdir((conn)->vfs_opaque.handles.readdir, (conn), (dirp)))
|
#define SMB_VFS_OPAQUE_READDIR(conn, dirp) ((conn)->vfs_opaque.ops.readdir((conn)->vfs_opaque.handles.readdir, (conn), (dirp)))
|
||||||
#define SMB_VFS_OPAQUE_SEEKDIR(conn, dirp, offset) ((conn)->vfs_opaque.ops.seekdir((conn)->vfs_opaque.handles.seekdir, (conn), (dirp), (offset)))
|
#define SMB_VFS_OPAQUE_SEEKDIR(conn, dirp, offset) ((conn)->vfs_opaque.ops.seekdir((conn)->vfs_opaque.handles.seekdir, (conn), (dirp), (offset)))
|
||||||
#define SMB_VFS_OPAQUE_TELLDIR(conn, dirp) ((conn)->vfs_opaque.ops.telldir((conn)->vfs_opaque.handles.telldir, (conn), (dirp)))
|
#define SMB_VFS_OPAQUE_TELLDIR(conn, dirp) ((conn)->vfs_opaque.ops.telldir((conn)->vfs_opaque.handles.telldir, (conn), (dirp)))
|
||||||
@ -238,7 +238,7 @@
|
|||||||
#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_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)))
|
||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
#define SMB_VFS_NEXT_OPENDIR(handle, conn, fname) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (conn), (fname)))
|
#define SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (conn), (fname), (mask), (attr)))
|
||||||
#define SMB_VFS_NEXT_READDIR(handle, conn, dirp) ((handle)->vfs_next.ops.readdir((handle)->vfs_next.handles.readdir, (conn), (dirp)))
|
#define SMB_VFS_NEXT_READDIR(handle, conn, dirp) ((handle)->vfs_next.ops.readdir((handle)->vfs_next.handles.readdir, (conn), (dirp)))
|
||||||
#define SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset) ((handle)->vfs_next.ops.seekdir((handle)->vfs_next.handles.seekdir, (conn), (dirp), (offset)))
|
#define SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset) ((handle)->vfs_next.ops.seekdir((handle)->vfs_next.handles.seekdir, (conn), (dirp), (offset)))
|
||||||
#define SMB_VFS_NEXT_TELLDIR(handle, conn, dirp) ((handle)->vfs_next.ops.telldir((handle)->vfs_next.handles.telldir, (conn), (dirp)))
|
#define SMB_VFS_NEXT_TELLDIR(handle, conn, dirp) ((handle)->vfs_next.ops.telldir((handle)->vfs_next.handles.telldir, (conn), (dirp)))
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user);
|
static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user);
|
||||||
static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn);
|
static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn);
|
||||||
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname);
|
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr);
|
||||||
static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode);
|
static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode);
|
||||||
static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path);
|
static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path);
|
||||||
static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode);
|
static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode);
|
||||||
@ -119,11 +119,11 @@ static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
|
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
DIR *result;
|
DIR *result;
|
||||||
|
|
||||||
result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname);
|
result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
|
||||||
|
|
||||||
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
|
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
|
||||||
fname,
|
fname,
|
||||||
|
@ -38,11 +38,11 @@ static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, connection_struct *
|
|||||||
dfree, dsize);
|
dfree, dsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
|
static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
pstring capname;
|
pstring capname;
|
||||||
capencode(capname, fname);
|
capencode(capname, fname);
|
||||||
return SMB_VFS_NEXT_OPENDIR(handle, conn, capname);
|
return SMB_VFS_NEXT_OPENDIR(handle, conn, capname, mask, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
|
static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
|
||||||
|
@ -72,13 +72,13 @@ static void to_unix(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DIR *catia_opendir(vfs_handle_struct *handle, connection_struct
|
static DIR *catia_opendir(vfs_handle_struct *handle, connection_struct
|
||||||
*conn, const char *fname)
|
*conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
pstring name;
|
pstring name;
|
||||||
pstrcpy(name, fname);
|
pstrcpy(name, fname);
|
||||||
to_unix(name);
|
to_unix(name);
|
||||||
|
|
||||||
return SMB_VFS_NEXT_OPENDIR(handle, conn, name);
|
return SMB_VFS_NEXT_OPENDIR(handle, conn, name, mask, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SMB_STRUCT_DIRENT *catia_readdir(vfs_handle_struct *handle,
|
static SMB_STRUCT_DIRENT *catia_readdir(vfs_handle_struct *handle,
|
||||||
|
@ -34,7 +34,7 @@ static int vfs_extd_audit_debug_level = DBGC_VFS;
|
|||||||
|
|
||||||
static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user);
|
static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user);
|
||||||
static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn);
|
static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn);
|
||||||
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname);
|
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr);
|
||||||
static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode);
|
static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode);
|
||||||
static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path);
|
static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path);
|
||||||
static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode);
|
static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode);
|
||||||
@ -125,11 +125,11 @@ static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
|
static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
DIR *result;
|
DIR *result;
|
||||||
|
|
||||||
result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname);
|
result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
|
||||||
|
|
||||||
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
|
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
|
||||||
fname,
|
fname,
|
||||||
|
@ -87,7 +87,7 @@ static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
|
|||||||
SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
|
SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
|
||||||
|
|
||||||
static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
|
static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
|
||||||
const char *fname);
|
const char *fname, const char *mask, uint32 attr);
|
||||||
static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle,
|
static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle,
|
||||||
connection_struct *conn, DIR *dirp);
|
connection_struct *conn, DIR *dirp);
|
||||||
static void smb_full_audit_seekdir(vfs_handle_struct *handle, connection_struct *conn,
|
static void smb_full_audit_seekdir(vfs_handle_struct *handle, connection_struct *conn,
|
||||||
@ -816,11 +816,11 @@ static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
|
static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
|
||||||
const char *fname)
|
const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
DIR *result;
|
DIR *result;
|
||||||
|
|
||||||
result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname);
|
result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
|
||||||
|
|
||||||
do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
|
do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
|
||||||
|
|
||||||
|
@ -172,11 +172,11 @@ static void atalk_rrmdir(TALLOC_CTX *ctx, char *path)
|
|||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
|
|
||||||
DIR *atalk_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname)
|
DIR *atalk_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
DIR *ret = 0;
|
DIR *ret = 0;
|
||||||
|
|
||||||
ret = SMB_VFS_NEXT_OPENDIR(handle, conn, fname);
|
ret = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* when we try to perform delete operation upon file which has fork
|
* when we try to perform delete operation upon file which has fork
|
||||||
@ -379,7 +379,7 @@ static vfs_op_tuple atalk_ops[] = {
|
|||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
|
|
||||||
{SMB_VFS_OP(atalk_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT},
|
{SMB_VFS_OP(atalk_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT},
|
||||||
{SMB_VFS_OP(atalk_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT},
|
{SMB_VFS_OP(atalk_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT},
|
||||||
|
|
||||||
/* File operations */
|
/* File operations */
|
||||||
|
@ -72,10 +72,10 @@ static BOOL shadow_copy_match_name(const char *name)
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
|
static DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
shadow_copy_Dir *dirp;
|
shadow_copy_Dir *dirp;
|
||||||
DIR *p = SMB_VFS_NEXT_OPENDIR(handle,conn,fname);
|
DIR *p = SMB_VFS_NEXT_OPENDIR(handle,conn,fname,mask,attr);
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() failed for [%s]\n",fname));
|
DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() failed for [%s]\n",fname));
|
||||||
@ -166,7 +166,7 @@ int shadow_copy_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR
|
|||||||
|
|
||||||
static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels)
|
static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels)
|
||||||
{
|
{
|
||||||
DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn,fsp->conn->connectpath);
|
DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn,fsp->conn->connectpath,NULL,0);
|
||||||
|
|
||||||
shadow_copy_data->num_volumes = 0;
|
shadow_copy_data->num_volumes = 0;
|
||||||
shadow_copy_data->labels = NULL;
|
shadow_copy_data->labels = NULL;
|
||||||
|
@ -53,7 +53,7 @@ struct dptr_struct {
|
|||||||
struct smb_Dir *dir_hnd;
|
struct smb_Dir *dir_hnd;
|
||||||
BOOL expect_close;
|
BOOL expect_close;
|
||||||
char *wcard;
|
char *wcard;
|
||||||
uint16 attr;
|
uint32 attr;
|
||||||
char *path;
|
char *path;
|
||||||
BOOL has_wild; /* Set to true if the wcard entry has MS wildcard characters in it. */
|
BOOL has_wild; /* Set to true if the wcard entry has MS wildcard characters in it. */
|
||||||
};
|
};
|
||||||
@ -68,7 +68,7 @@ static int dirhandles_open = 0;
|
|||||||
Make a dir struct.
|
Make a dir struct.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T size,int mode,time_t date, BOOL uc)
|
void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T size,uint32 mode,time_t date, BOOL uc)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
pstring mask2;
|
pstring mask2;
|
||||||
@ -175,7 +175,7 @@ static struct dptr_struct *dptr_get(int key, BOOL forclose)
|
|||||||
if (dirhandles_open >= MAX_OPEN_DIRECTORIES)
|
if (dirhandles_open >= MAX_OPEN_DIRECTORIES)
|
||||||
dptr_idleoldest();
|
dptr_idleoldest();
|
||||||
DEBUG(4,("dptr_get: Reopening dptr key %d\n",key));
|
DEBUG(4,("dptr_get: Reopening dptr key %d\n",key));
|
||||||
if (!(dptr->dir_hnd = OpenDir(dptr->conn, dptr->path))) {
|
if (!(dptr->dir_hnd = OpenDir(dptr->conn, dptr->path, dptr->wcard, dptr->attr))) {
|
||||||
DEBUG(4,("dptr_get: Failed to open %s (%s)\n",dptr->path,
|
DEBUG(4,("dptr_get: Failed to open %s (%s)\n",dptr->path,
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
return False;
|
return False;
|
||||||
@ -224,30 +224,6 @@ uint16 dptr_attr(int key)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
Set the dir wcard for a dir index.
|
|
||||||
Returns 0 on ok, 1 on fail.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
BOOL dptr_set_wcard_and_attributes(int key, const char *wcard, uint16 attr)
|
|
||||||
{
|
|
||||||
struct dptr_struct *dptr = dptr_get(key, False);
|
|
||||||
|
|
||||||
if (dptr) {
|
|
||||||
dptr->attr = attr;
|
|
||||||
dptr->wcard = SMB_STRDUP(wcard);
|
|
||||||
if (!dptr->wcard)
|
|
||||||
return False;
|
|
||||||
if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) {
|
|
||||||
dptr->has_wild = True;
|
|
||||||
} else {
|
|
||||||
dptr->has_wild = ms_has_wild(wcard);
|
|
||||||
}
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Close a dptr (internal func).
|
Close a dptr (internal func).
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -399,7 +375,8 @@ static void dptr_close_oldest(BOOL old)
|
|||||||
a directory handle is never zero.
|
a directory handle is never zero.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL expect_close,uint16 spid)
|
int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL expect_close,uint16 spid,
|
||||||
|
const char *wcard, uint32 attr)
|
||||||
{
|
{
|
||||||
struct dptr_struct *dptr = NULL;
|
struct dptr_struct *dptr = NULL;
|
||||||
struct smb_Dir *dir_hnd;
|
struct smb_Dir *dir_hnd;
|
||||||
@ -415,7 +392,7 @@ int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL exp
|
|||||||
if (!*dir2)
|
if (!*dir2)
|
||||||
dir2 = ".";
|
dir2 = ".";
|
||||||
|
|
||||||
dir_hnd = OpenDir(conn, dir2);
|
dir_hnd = OpenDir(conn, dir2, wcard, attr);
|
||||||
if (!dir_hnd) {
|
if (!dir_hnd) {
|
||||||
return (-2);
|
return (-2);
|
||||||
}
|
}
|
||||||
@ -503,9 +480,23 @@ int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL exp
|
|||||||
dptr->dir_hnd = dir_hnd;
|
dptr->dir_hnd = dir_hnd;
|
||||||
dptr->spid = spid;
|
dptr->spid = spid;
|
||||||
dptr->expect_close = expect_close;
|
dptr->expect_close = expect_close;
|
||||||
dptr->wcard = NULL; /* Only used in lanman2 searches */
|
if (wcard) {
|
||||||
dptr->attr = 0; /* Only used in lanman2 searches */
|
dptr->wcard = SMB_STRDUP(wcard);
|
||||||
dptr->has_wild = True; /* Only used in lanman2 searches */
|
if (!dptr->wcard) {
|
||||||
|
bitmap_clear(dptr_bmap, dptr->dnum - 1);
|
||||||
|
SAFE_FREE(dptr);
|
||||||
|
CloseDir(dir_hnd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dptr->wcard = NULL;
|
||||||
|
}
|
||||||
|
dptr->attr = attr;
|
||||||
|
if (lp_posix_pathnames() || (wcard && (wcard[0] == '.' && wcard[1] == 0))) {
|
||||||
|
dptr->has_wild = True;
|
||||||
|
} else {
|
||||||
|
dptr->has_wild = ms_has_wild(wcard);
|
||||||
|
}
|
||||||
|
|
||||||
DLIST_ADD(dirptrs, dptr);
|
DLIST_ADD(dirptrs, dptr);
|
||||||
|
|
||||||
@ -715,9 +706,9 @@ struct dptr_struct *dptr_fetch_lanman2(int dptr_num)
|
|||||||
Check a filetype for being valid.
|
Check a filetype for being valid.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
BOOL dir_check_ftype(connection_struct *conn,int mode,int dirtype)
|
BOOL dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype)
|
||||||
{
|
{
|
||||||
int mask;
|
uint32 mask;
|
||||||
|
|
||||||
/* Check the "may have" search bits. */
|
/* Check the "may have" search bits. */
|
||||||
if (((mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0)
|
if (((mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0)
|
||||||
@ -747,8 +738,8 @@ static BOOL mangle_mask_match(connection_struct *conn, fstring filename, char *m
|
|||||||
Get an 8.3 directory entry.
|
Get an 8.3 directory entry.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype, pstring fname,
|
BOOL get_dir_entry(connection_struct *conn,char *mask,uint32 dirtype, pstring fname,
|
||||||
SMB_OFF_T *size,int *mode,time_t *date,BOOL check_descend)
|
SMB_OFF_T *size,uint32 *mode,time_t *date,BOOL check_descend)
|
||||||
{
|
{
|
||||||
const char *dname;
|
const char *dname;
|
||||||
BOOL found = False;
|
BOOL found = False;
|
||||||
@ -804,7 +795,7 @@ BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype, pstring fname
|
|||||||
*mode = dos_mode(conn,pathreal,&sbuf);
|
*mode = dos_mode(conn,pathreal,&sbuf);
|
||||||
|
|
||||||
if (!dir_check_ftype(conn,*mode,dirtype)) {
|
if (!dir_check_ftype(conn,*mode,dirtype)) {
|
||||||
DEBUG(5,("[%s] attribs didn't match %x\n",filename,dirtype));
|
DEBUG(5,("[%s] attribs didn't match %x\n",filename,(unsigned int)dirtype));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,7 +991,7 @@ BOOL is_visible_file(connection_struct *conn, const char *dir_path, const char *
|
|||||||
Open a directory.
|
Open a directory.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
struct smb_Dir *OpenDir(connection_struct *conn, const char *name)
|
struct smb_Dir *OpenDir(connection_struct *conn, const char *name, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
struct smb_Dir *dirp = SMB_MALLOC_P(struct smb_Dir);
|
struct smb_Dir *dirp = SMB_MALLOC_P(struct smb_Dir);
|
||||||
if (!dirp) {
|
if (!dirp) {
|
||||||
@ -1014,7 +1005,7 @@ struct smb_Dir *OpenDir(connection_struct *conn, const char *name)
|
|||||||
if (!dirp->dir_path) {
|
if (!dirp->dir_path) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
dirp->dir = SMB_VFS_OPENDIR(conn, dirp->dir_path);
|
dirp->dir = SMB_VFS_OPENDIR(conn, dirp->dir_path, mask, attr);
|
||||||
if (!dirp->dir) {
|
if (!dirp->dir) {
|
||||||
DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path, strerror(errno) ));
|
DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path, strerror(errno) ));
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -450,7 +450,7 @@ static BOOL scan_directory(connection_struct *conn, const char *path, char *name
|
|||||||
mangled = !mangle_check_cache( name, maxlength, SNUM(conn));
|
mangled = !mangle_check_cache( name, maxlength, SNUM(conn));
|
||||||
|
|
||||||
/* open the directory */
|
/* open the directory */
|
||||||
if (!(cur_dir = OpenDir(conn, path))) {
|
if (!(cur_dir = OpenDir(conn, path, NULL, 0))) {
|
||||||
DEBUG(3,("scan dir didn't open dir [%s]\n",path));
|
DEBUG(3,("scan dir didn't open dir [%s]\n",path));
|
||||||
return(False);
|
return(False);
|
||||||
}
|
}
|
||||||
|
@ -989,7 +989,7 @@ static BOOL form_junctions(int snum, struct junction_map* jucn, int* jn_count)
|
|||||||
cnt++;
|
cnt++;
|
||||||
|
|
||||||
/* Now enumerate all dfs links */
|
/* Now enumerate all dfs links */
|
||||||
dirp = SMB_VFS_OPENDIR(conn, ".");
|
dirp = SMB_VFS_OPENDIR(conn, ".", NULL, 0);
|
||||||
if(!dirp)
|
if(!dirp)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ static BOOL notify_hash(connection_struct *conn, char *path, uint32 flags,
|
|||||||
* larger than the max time_t value).
|
* larger than the max time_t value).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dp = OpenDir(conn, path);
|
dp = OpenDir(conn, path, NULL, 0);
|
||||||
if (dp == NULL)
|
if (dp == NULL)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
|
@ -1014,9 +1014,9 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
|
|||||||
pstring directory;
|
pstring directory;
|
||||||
pstring fname;
|
pstring fname;
|
||||||
SMB_OFF_T size;
|
SMB_OFF_T size;
|
||||||
int mode;
|
uint32 mode;
|
||||||
time_t date;
|
time_t date;
|
||||||
int dirtype;
|
uint32 dirtype;
|
||||||
int outsize = 0;
|
int outsize = 0;
|
||||||
unsigned int numentries = 0;
|
unsigned int numentries = 0;
|
||||||
unsigned int maxentries = 0;
|
unsigned int maxentries = 0;
|
||||||
@ -1115,7 +1115,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
|
|||||||
ok = True;
|
ok = True;
|
||||||
|
|
||||||
if (status_len == 0) {
|
if (status_len == 0) {
|
||||||
dptr_num = dptr_create(conn,directory,True,expect_close,SVAL(inbuf,smb_pid));
|
dptr_num = dptr_create(conn,directory,True,expect_close,SVAL(inbuf,smb_pid), mask, dirtype);
|
||||||
if (dptr_num < 0) {
|
if (dptr_num < 0) {
|
||||||
if(dptr_num == -2) {
|
if(dptr_num == -2) {
|
||||||
END_PROFILE(SMBsearch);
|
END_PROFILE(SMBsearch);
|
||||||
@ -1124,10 +1124,6 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
|
|||||||
END_PROFILE(SMBsearch);
|
END_PROFILE(SMBsearch);
|
||||||
return ERROR_DOS(ERRDOS,ERRnofids);
|
return ERROR_DOS(ERRDOS,ERRnofids);
|
||||||
}
|
}
|
||||||
if (!dptr_set_wcard_and_attributes(dptr_num, mask, dirtype)) {
|
|
||||||
END_PROFILE(SMBsearch);
|
|
||||||
return ERROR_DOS(ERRDOS,ERRnomem);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dirtype = dptr_attr(dptr_num);
|
dirtype = dptr_attr(dptr_num);
|
||||||
}
|
}
|
||||||
@ -1743,10 +1739,10 @@ static NTSTATUS can_rename(connection_struct *conn, char *fname, uint16 dirtype,
|
|||||||
Check if a user is allowed to delete a file.
|
Check if a user is allowed to delete a file.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
NTSTATUS can_delete(connection_struct *conn, char *fname, int dirtype, BOOL bad_path, BOOL check_is_at_open)
|
NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype, BOOL bad_path, BOOL check_is_at_open)
|
||||||
{
|
{
|
||||||
SMB_STRUCT_STAT sbuf;
|
SMB_STRUCT_STAT sbuf;
|
||||||
int fmode;
|
uint32 fmode;
|
||||||
int smb_action;
|
int smb_action;
|
||||||
int access_mode;
|
int access_mode;
|
||||||
files_struct *fsp;
|
files_struct *fsp;
|
||||||
@ -1817,7 +1813,7 @@ NTSTATUS can_delete(connection_struct *conn, char *fname, int dirtype, BOOL bad_
|
|||||||
code.
|
code.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name)
|
NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name)
|
||||||
{
|
{
|
||||||
pstring directory;
|
pstring directory;
|
||||||
pstring mask;
|
pstring mask;
|
||||||
@ -1879,8 +1875,11 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name)
|
|||||||
struct smb_Dir *dir_hnd = NULL;
|
struct smb_Dir *dir_hnd = NULL;
|
||||||
const char *dname;
|
const char *dname;
|
||||||
|
|
||||||
|
if (strequal(mask,"????????.???"))
|
||||||
|
pstrcpy(mask,"*");
|
||||||
|
|
||||||
if (check_name(directory,conn))
|
if (check_name(directory,conn))
|
||||||
dir_hnd = OpenDir(conn, directory);
|
dir_hnd = OpenDir(conn, directory, mask, dirtype);
|
||||||
|
|
||||||
/* XXXX the CIFS spec says that if bit0 of the flags2 field is set then
|
/* XXXX the CIFS spec says that if bit0 of the flags2 field is set then
|
||||||
the pattern matches against the long name, otherwise the short name
|
the pattern matches against the long name, otherwise the short name
|
||||||
@ -1891,9 +1890,6 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name)
|
|||||||
long offset = 0;
|
long offset = 0;
|
||||||
error = NT_STATUS_NO_SUCH_FILE;
|
error = NT_STATUS_NO_SUCH_FILE;
|
||||||
|
|
||||||
if (strequal(mask,"????????.???"))
|
|
||||||
pstrcpy(mask,"*");
|
|
||||||
|
|
||||||
while ((dname = ReadDirName(dir_hnd, &offset))) {
|
while ((dname = ReadDirName(dir_hnd, &offset))) {
|
||||||
SMB_STRUCT_STAT st;
|
SMB_STRUCT_STAT st;
|
||||||
pstring fname;
|
pstring fname;
|
||||||
@ -1954,7 +1950,7 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
|
|||||||
{
|
{
|
||||||
int outsize = 0;
|
int outsize = 0;
|
||||||
pstring name;
|
pstring name;
|
||||||
int dirtype;
|
uint32 dirtype;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
START_PROFILE(SMBunlink);
|
START_PROFILE(SMBunlink);
|
||||||
|
|
||||||
@ -3707,7 +3703,7 @@ static BOOL recursive_rmdir(connection_struct *conn, char *directory)
|
|||||||
const char *dname = NULL;
|
const char *dname = NULL;
|
||||||
BOOL ret = False;
|
BOOL ret = False;
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
struct smb_Dir *dir_hnd = OpenDir(conn, directory);
|
struct smb_Dir *dir_hnd = OpenDir(conn, directory, NULL, 0);
|
||||||
|
|
||||||
if(dir_hnd == NULL)
|
if(dir_hnd == NULL)
|
||||||
return True;
|
return True;
|
||||||
@ -3775,7 +3771,7 @@ BOOL rmdir_internals(connection_struct *conn, char *directory)
|
|||||||
*/
|
*/
|
||||||
BOOL all_veto_files = True;
|
BOOL all_veto_files = True;
|
||||||
const char *dname;
|
const char *dname;
|
||||||
struct smb_Dir *dir_hnd = OpenDir(conn, directory);
|
struct smb_Dir *dir_hnd = OpenDir(conn, directory, NULL, 0);
|
||||||
|
|
||||||
if(dir_hnd != NULL) {
|
if(dir_hnd != NULL) {
|
||||||
long dirpos = 0;
|
long dirpos = 0;
|
||||||
@ -3997,7 +3993,7 @@ static void rename_open_files(connection_struct *conn, SMB_DEV_T dev, SMB_INO_T
|
|||||||
Rename an open file - given an fsp.
|
Rename an open file - given an fsp.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, char *newname, uint16 attrs, BOOL replace_if_exists)
|
NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, char *newname, uint32 attrs, BOOL replace_if_exists)
|
||||||
{
|
{
|
||||||
SMB_STRUCT_STAT sbuf;
|
SMB_STRUCT_STAT sbuf;
|
||||||
BOOL bad_path = False;
|
BOOL bad_path = False;
|
||||||
@ -4111,7 +4107,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, char *
|
|||||||
code.
|
code.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
NTSTATUS rename_internals(connection_struct *conn, char *name, char *newname, uint16 attrs, BOOL replace_if_exists)
|
NTSTATUS rename_internals(connection_struct *conn, char *name, char *newname, uint32 attrs, BOOL replace_if_exists)
|
||||||
{
|
{
|
||||||
pstring directory;
|
pstring directory;
|
||||||
pstring mask;
|
pstring mask;
|
||||||
@ -4333,17 +4329,17 @@ directory = %s, newname = %s, last_component_dest = %s, is_8_3 = %d\n",
|
|||||||
const char *dname;
|
const char *dname;
|
||||||
pstring destname;
|
pstring destname;
|
||||||
|
|
||||||
|
if (strequal(mask,"????????.???"))
|
||||||
|
pstrcpy(mask,"*");
|
||||||
|
|
||||||
if (check_name(directory,conn))
|
if (check_name(directory,conn))
|
||||||
dir_hnd = OpenDir(conn, directory);
|
dir_hnd = OpenDir(conn, directory, mask, attrs);
|
||||||
|
|
||||||
if (dir_hnd) {
|
if (dir_hnd) {
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
error = NT_STATUS_NO_SUCH_FILE;
|
error = NT_STATUS_NO_SUCH_FILE;
|
||||||
/* Was error = NT_STATUS_OBJECT_NAME_NOT_FOUND; - gentest fix. JRA */
|
/* Was error = NT_STATUS_OBJECT_NAME_NOT_FOUND; - gentest fix. JRA */
|
||||||
|
|
||||||
if (strequal(mask,"????????.???"))
|
|
||||||
pstrcpy(mask,"*");
|
|
||||||
|
|
||||||
while ((dname = ReadDirName(dir_hnd, &offset))) {
|
while ((dname = ReadDirName(dir_hnd, &offset))) {
|
||||||
pstring fname;
|
pstring fname;
|
||||||
BOOL sysdir_entry = False;
|
BOOL sysdir_entry = False;
|
||||||
@ -4444,7 +4440,7 @@ int reply_mv(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
|
|||||||
pstring name;
|
pstring name;
|
||||||
pstring newname;
|
pstring newname;
|
||||||
char *p;
|
char *p;
|
||||||
uint16 attrs = SVAL(inbuf,smb_vwv0);
|
uint32 attrs = SVAL(inbuf,smb_vwv0);
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
START_PROFILE(SMBmv);
|
START_PROFILE(SMBmv);
|
||||||
@ -4689,16 +4685,16 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
|
|||||||
const char *dname;
|
const char *dname;
|
||||||
pstring destname;
|
pstring destname;
|
||||||
|
|
||||||
|
if (strequal(mask,"????????.???"))
|
||||||
|
pstrcpy(mask,"*");
|
||||||
|
|
||||||
if (check_name(directory,conn))
|
if (check_name(directory,conn))
|
||||||
dir_hnd = OpenDir(conn, directory);
|
dir_hnd = OpenDir(conn, directory, mask, 0);
|
||||||
|
|
||||||
if (dir_hnd) {
|
if (dir_hnd) {
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
error = ERRbadfile;
|
error = ERRbadfile;
|
||||||
|
|
||||||
if (strequal(mask,"????????.???"))
|
|
||||||
pstrcpy(mask,"*");
|
|
||||||
|
|
||||||
while ((dname = ReadDirName(dir_hnd, &offset))) {
|
while ((dname = ReadDirName(dir_hnd, &offset))) {
|
||||||
pstring fname;
|
pstring fname;
|
||||||
pstrcpy(fname,dname);
|
pstrcpy(fname,dname);
|
||||||
|
@ -996,7 +996,7 @@ static mode_t unix_perms_from_wire( connection_struct *conn, SMB_STRUCT_STAT *ps
|
|||||||
|
|
||||||
static BOOL get_lanman2_dir_entry(connection_struct *conn,
|
static BOOL get_lanman2_dir_entry(connection_struct *conn,
|
||||||
void *inbuf, void *outbuf,
|
void *inbuf, void *outbuf,
|
||||||
char *path_mask,int dirtype,int info_level,
|
char *path_mask,uint32 dirtype,int info_level,
|
||||||
int requires_resume_key,
|
int requires_resume_key,
|
||||||
BOOL dont_descend,char **ppdata,
|
BOOL dont_descend,char **ppdata,
|
||||||
char *base_data, int space_remaining,
|
char *base_data, int space_remaining,
|
||||||
@ -1012,7 +1012,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
|
|||||||
char *p, *q, *pdata = *ppdata;
|
char *p, *q, *pdata = *ppdata;
|
||||||
uint32 reskey=0;
|
uint32 reskey=0;
|
||||||
long prev_dirpos=0;
|
long prev_dirpos=0;
|
||||||
int mode=0;
|
uint32 mode=0;
|
||||||
SMB_OFF_T file_size = 0;
|
SMB_OFF_T file_size = 0;
|
||||||
SMB_BIG_UINT allocation_size = 0;
|
SMB_BIG_UINT allocation_size = 0;
|
||||||
uint32 len;
|
uint32 len;
|
||||||
@ -1020,7 +1020,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
|
|||||||
char *nameptr;
|
char *nameptr;
|
||||||
char *last_entry_ptr;
|
char *last_entry_ptr;
|
||||||
BOOL was_8_3;
|
BOOL was_8_3;
|
||||||
int nt_extmode; /* Used for NT connections instead of mode */
|
uint32 nt_extmode; /* Used for NT connections instead of mode */
|
||||||
BOOL needslash = ( conn->dirpath[strlen(conn->dirpath) -1] != '/');
|
BOOL needslash = ( conn->dirpath[strlen(conn->dirpath) -1] != '/');
|
||||||
BOOL check_mangled_names = lp_manglednames(SNUM(conn));
|
BOOL check_mangled_names = lp_manglednames(SNUM(conn));
|
||||||
|
|
||||||
@ -1576,7 +1576,7 @@ static int call_trans2findfirst(connection_struct *conn, char *inbuf, char *outb
|
|||||||
requested. */
|
requested. */
|
||||||
char *params = *pparams;
|
char *params = *pparams;
|
||||||
char *pdata = *ppdata;
|
char *pdata = *ppdata;
|
||||||
int dirtype = SVAL(params,0);
|
uint32 dirtype = SVAL(params,0);
|
||||||
int maxentries = SVAL(params,2);
|
int maxentries = SVAL(params,2);
|
||||||
uint16 findfirst_flags = SVAL(params,4);
|
uint16 findfirst_flags = SVAL(params,4);
|
||||||
BOOL close_after_first = (findfirst_flags & FLAG_TRANS2_FIND_CLOSE);
|
BOOL close_after_first = (findfirst_flags & FLAG_TRANS2_FIND_CLOSE);
|
||||||
@ -1606,9 +1606,9 @@ static int call_trans2findfirst(connection_struct *conn, char *inbuf, char *outb
|
|||||||
|
|
||||||
*directory = *mask = 0;
|
*directory = *mask = 0;
|
||||||
|
|
||||||
DEBUG(3,("call_trans2findfirst: dirtype = %d, maxentries = %d, close_after_first=%d, \
|
DEBUG(3,("call_trans2findfirst: dirtype = %x, maxentries = %d, close_after_first=%d, \
|
||||||
close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
|
close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
|
||||||
dirtype, maxentries, close_after_first, close_if_end, requires_resume_key,
|
(unsigned int)dirtype, maxentries, close_after_first, close_if_end, requires_resume_key,
|
||||||
info_level, max_data_bytes));
|
info_level, max_data_bytes));
|
||||||
|
|
||||||
if (!maxentries) {
|
if (!maxentries) {
|
||||||
@ -1711,19 +1711,13 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
|
|||||||
}
|
}
|
||||||
*pparams = params;
|
*pparams = params;
|
||||||
|
|
||||||
dptr_num = dptr_create(conn,directory, False, True ,SVAL(inbuf,smb_pid));
|
|
||||||
if (dptr_num < 0) {
|
|
||||||
talloc_destroy(ea_ctx);
|
|
||||||
return(UNIXERROR(ERRDOS,ERRbadfile));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save the wildcard match and attribs we are using on this directory -
|
/* Save the wildcard match and attribs we are using on this directory -
|
||||||
needed as lanman2 assumes these are being saved between calls */
|
needed as lanman2 assumes these are being saved between calls */
|
||||||
|
|
||||||
if (!dptr_set_wcard_and_attributes(dptr_num, mask, dirtype)) {
|
dptr_num = dptr_create(conn,directory, False, True ,SVAL(inbuf,smb_pid), mask, dirtype);
|
||||||
dptr_close(&dptr_num);
|
if (dptr_num < 0) {
|
||||||
talloc_destroy(ea_ctx);
|
talloc_destroy(ea_ctx);
|
||||||
return ERROR_NT(NT_STATUS_NO_MEMORY);
|
return(UNIXERROR(ERRDOS,ERRbadfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(4,("dptr_num is %d, wcard = %s, attr = %d\n",dptr_num, mask, dirtype));
|
DEBUG(4,("dptr_num is %d, wcard = %s, attr = %d\n",dptr_num, mask, dirtype));
|
||||||
|
@ -88,7 +88,7 @@ int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle, struct files_
|
|||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
|
|
||||||
DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
|
DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
|
||||||
{
|
{
|
||||||
DIR *result;
|
DIR *result;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user