From: Ralph Boehme Date: Sun, 4 Aug 2019 07:13:34 +0000 (+0200) Subject: s3: smbd: remove redundant smb_dname arg from dptr_create() X-Git-Tag: tdb-1.4.2~334 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d0924d8ea0391c5b6414a79d25e15ddfd7dd448;p=thirdparty%2Fsamba.git s3: smbd: remove redundant smb_dname arg from dptr_create() Now that dptr_create() is handle based, we can simply used the fsp name. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index bc80b4d8f1c..61c91029364 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -242,7 +242,6 @@ void dptr_closecnum(connection_struct *conn) NTSTATUS dptr_create(connection_struct *conn, struct smb_request *req, files_struct *fsp, - const struct smb_filename *smb_dname, bool old_handle, bool expect_close, uint16_t spid, @@ -255,11 +254,7 @@ NTSTATUS dptr_create(connection_struct *conn, struct dptr_struct *dptr = NULL; struct smb_Dir *dir_hnd; - if (fsp && fsp->is_directory && fsp->fh->fd != -1) { - smb_dname = fsp->fsp_name; - } - - DEBUG(5,("dptr_create dir=%s\n", smb_dname->base_name)); + DBG_INFO("dir=%s\n", fsp_str_dbg(fsp)); if (sconn == NULL) { DEBUG(0,("dptr_create: called with fake connection_struct\n")); @@ -273,7 +268,7 @@ NTSTATUS dptr_create(connection_struct *conn, if (!(fsp->access_mask & SEC_DIR_LIST)) { DBG_INFO("dptr_create: directory %s " "not open for LIST access\n", - smb_dname->base_name); + fsp_str_dbg(fsp)); return NT_STATUS_ACCESS_DENIED; } dir_hnd = OpenDir_fsp(NULL, conn, fsp, wcard, attr); @@ -288,8 +283,8 @@ NTSTATUS dptr_create(connection_struct *conn, return NT_STATUS_NO_MEMORY; } - dptr->smb_dname = cp_smb_filename(dptr, smb_dname); - if (!dptr->smb_dname) { + dptr->smb_dname = cp_smb_filename(dptr, fsp->fsp_name); + if (dptr->smb_dname == NULL) { TALLOC_FREE(dptr); TALLOC_FREE(dir_hnd); return NT_STATUS_NO_MEMORY; @@ -360,10 +355,8 @@ NTSTATUS dptr_create(connection_struct *conn, DLIST_ADD(sconn->searches.dirptrs, dptr); done: - DEBUG(3,("creating new dirptr %d for path %s, expect_close = %d\n", - dptr->dnum, - dptr->smb_dname->base_name, - expect_close)); + DBG_INFO("creating new dirptr [%d] for path [%s], expect_close = %d\n", + dptr->dnum, fsp_str_dbg(fsp), expect_close); *dptr_ret = dptr; diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index b8e1468680c..a07bb550430 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -187,7 +187,6 @@ void dptr_closecnum(connection_struct *conn); NTSTATUS dptr_create(connection_struct *conn, struct smb_request *req, files_struct *fsp, - const struct smb_filename *smb_dname, bool old_handle, bool expect_close, uint16_t spid, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 32121a322a2..ff44fe391f4 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1916,7 +1916,6 @@ void reply_search(struct smb_request *req) nt_status = dptr_create(conn, NULL, /* req */ fsp, /* fsp */ - smb_dname, True, expect_close, req->smbpid, diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c index d433f2bee42..dc8c09b8969 100644 --- a/source3/smbd/smb2_query_directory.c +++ b/source3/smbd/smb2_query_directory.c @@ -441,7 +441,6 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx, status = dptr_create(conn, NULL, /* req */ fsp, - fsp->fsp_name, false, /* old_handle */ false, /* expect_close */ 0, /* spid */ diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 2fafae56eb9..7f4ba8cafa9 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2971,7 +2971,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd ntstatus = dptr_create(conn, req, fsp, /* fsp */ - smb_dname, False, True, req->smbpid,