From: Ralph Boehme Date: Wed, 18 Mar 2020 11:05:06 +0000 (+0100) Subject: smbd: use OpenDir() in count_dfs_links() X-Git-Tag: ldb-2.2.0~1251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a9d8c41e010d796f0e25ece6c6409b48fb5082c;p=thirdparty%2Fsamba.git smbd: use OpenDir() in count_dfs_links() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index cc32ebc9d29..274e9d0f720 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -1514,7 +1514,6 @@ static size_t count_dfs_links(TALLOC_CTX *ctx, const struct loadparm_substitution *lp_sub = loadparm_s3_global_substitution(); size_t cnt = 0; - DIR *dirp = NULL; const char *dname = NULL; char *talloced = NULL; const char *connect_path = lp_path(frame, lp_sub, snum); @@ -1523,6 +1522,8 @@ static size_t count_dfs_links(TALLOC_CTX *ctx, connection_struct *conn = NULL; NTSTATUS status; struct smb_filename *smb_fname = NULL; + struct smb_Dir *dir_hnd = NULL; + long offset = 0; if(*connect_path == '\0') { TALLOC_FREE(frame); @@ -1564,13 +1565,14 @@ static size_t count_dfs_links(TALLOC_CTX *ctx, } /* Now enumerate all dfs links */ - dirp = SMB_VFS_OPENDIR(conn, smb_fname, NULL, 0); - if(!dirp) { + dir_hnd = OpenDir(frame, conn, smb_fname, NULL, 0); + if (dir_hnd == NULL) { goto out; } - while ((dname = vfs_readdirname(conn, dirp, NULL, &talloced)) - != NULL) { + while ((dname = ReadDirName(dir_hnd, &offset, NULL, &talloced)) + != NULL) + { struct smb_filename *smb_dname = synthetic_smb_fname(frame, dname, @@ -1591,8 +1593,6 @@ static size_t count_dfs_links(TALLOC_CTX *ctx, TALLOC_FREE(smb_dname); } - SMB_VFS_CLOSEDIR(conn,dirp); - out: TALLOC_FREE(frame); return cnt;