[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Fri Apr 12 08:22:02 MDT 2013
The branch, master has been updated
via 7a4dd84 Remove dependency on detection of HAVE_DIRFD for use of fdopendir().
via 0fe894f Remove the "Ugly hack" that was the second use of dirfd().
via ea14c94 In the struct smb_Dir destructor, use the fsp back pointer to release resources.
via e89ec64 Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.
from 237ec2f libsmbclient: Use async cli_full_connection in python connection setup
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 7a4dd845958f1411daa8031ca242987001ab2f26
Author: Jeremy Allison <jra at samba.org>
Date: Wed Apr 10 16:30:10 2013 -0700
Remove dependency on detection of HAVE_DIRFD for use of fdopendir().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Fri Apr 12 16:21:10 CEST 2013 on sn-devel-104
commit 0fe894fb89f4867e266bb04670a58101311e0234
Author: Jeremy Allison <jra at samba.org>
Date: Wed Apr 10 16:29:03 2013 -0700
Remove the "Ugly hack" that was the second use of dirfd().
The destructor does all the resource deallocation needed.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit ea14c9443178da9ae6ccbe71e573156396f6f699
Author: Jeremy Allison <jra at samba.org>
Date: Wed Apr 10 16:24:15 2013 -0700
In the struct smb_Dir destructor, use the fsp back pointer to release resources.
Removes one use of dirfd().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit e89ec641fc98ffd7f7193deb3728b0a284a093eb
Author: Jeremy Allison <jra at samba.org>
Date: Wed Apr 10 16:21:39 2013 -0700
Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/lib/system.c | 4 +---
source3/smbd/dir.c | 47 +++++++++++++++++++++++------------------------
2 files changed, 24 insertions(+), 27 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/lib/system.c b/source3/lib/system.c
index d69f1c6..8dbf7dc 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -634,13 +634,11 @@ void kernel_flock(int fd, uint32 share_mode, uint32 access_mask)
/*******************************************************************
An fdopendir wrapper.
- Ugly hack - we need dirfd for this to work correctly in the
- calling code.. JRA.
********************************************************************/
DIR *sys_fdopendir(int fd)
{
-#if defined(HAVE_FDOPENDIR) && defined(HAVE_DIRFD)
+#if defined(HAVE_FDOPENDIR)
return fdopendir(fd);
#else
errno = ENOSYS;
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index f1c177f..00c33d6 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -50,6 +50,8 @@ struct smb_Dir {
struct name_cache_entry *name_cache;
unsigned int name_cache_index;
unsigned int file_number;
+ files_struct *fsp; /* Back pointer to containing fsp, only
+ set from OpenDir_fsp(). */
};
struct dptr_struct {
@@ -677,20 +679,12 @@ done:
void dptr_CloseDir(files_struct *fsp)
{
if (fsp->dptr) {
-/*
- * Ugly hack. We have defined fdopendir to return ENOSYS if dirfd also isn't
- * present. I hate Solaris. JRA.
- */
-#ifdef HAVE_DIRFD
- if (fsp->fh->fd != -1 &&
- fsp->dptr->dir_hnd &&
- dirfd(fsp->dptr->dir_hnd->dir)) {
- /* The call below closes the underlying fd. */
- fsp->fh->fd = -1;
- }
-#endif
+ /*
+ * The destructor for the struct smb_Dir
+ * (fsp->dptr->dir_hnd) now handles
+ * all resource deallocation.
+ */
dptr_close_internal(fsp->dptr);
- fsp->dptr = NULL;
}
}
@@ -1445,18 +1439,21 @@ bool is_visible_file(connection_struct *conn, const char *dir_path,
static int smb_Dir_destructor(struct smb_Dir *dirp)
{
- if (dirp->dir) {
-#ifdef HAVE_DIRFD
- if (dirp->conn->sconn) {
- files_struct *fsp = file_find_fd(dirp->conn->sconn,
- dirfd(dirp->dir));
- if (fsp) {
- /* The call below closes the underlying fd. */
- fsp->fh->fd = -1;
+ if (dirp->dir != NULL) {
+ SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir);
+ if (dirp->fsp != NULL) {
+ /*
+ * The SMB_VFS_CLOSEDIR above
+ * closes the underlying fd inside
+ * dirp->fsp.
+ */
+ dirp->fsp->fh->fd = -1;
+ if (dirp->fsp->dptr != NULL) {
+ SMB_ASSERT(dirp->fsp->dptr->dir_hnd == dirp);
+ dirp->fsp->dptr->dir_hnd = NULL;
}
+ dirp->fsp = NULL;
}
-#endif
- SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir);
}
if (dirp->conn->sconn && !dirp->conn->sconn->using_smb2) {
dirp->conn->sconn->searches.dirhandles_open--;
@@ -1540,7 +1537,9 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
if (fsp->is_directory && fsp->fh->fd != -1) {
dirp->dir = SMB_VFS_FDOPENDIR(fsp, mask, attr);
- if (dirp->dir == NULL) {
+ if (dirp->dir != NULL) {
+ dirp->fsp = fsp;
+ } else {
DEBUG(10,("OpenDir_fsp: SMB_VFS_FDOPENDIR on %s returned "
"NULL (%s)\n",
dirp->dir_path,
--
Samba Shared Repository
More information about the samba-cvs
mailing list