1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-05 12:23:50 +03:00

s3: libsmbclient: Add new function SMBC_readdirplus_ctx().

New ABI function, move to library version 0.33.

Signed-off-by: Puran Chand <pchand@vmware.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
Puran Chand
2018-04-09 10:10:28 -07:00
committed by Jeremy Allison
parent dd3f019d58
commit 2166c2d3ee
8 changed files with 272 additions and 1 deletions

View File

@@ -1140,6 +1140,52 @@ SMBC_readdir_ctx(SMBCCTX *context,
return dirp;
}
/*
* Routine to get a directory entry with all attributes
*/
const struct libsmb_file_info *
SMBC_readdirplus_ctx(SMBCCTX *context,
SMBCFILE *dir)
{
struct libsmb_file_info *smb_finfo = NULL;
TALLOC_CTX *frame = talloc_stackframe();
/* Check that all is ok first ... */
if (context == NULL || !context->internal->initialized) {
DBG_ERR("Invalid context in SMBC_readdirplus_ctx()\n");
TALLOC_FREE(frame);
errno = EINVAL;
return NULL;
}
if (dir == NULL ||
SMBC_dlist_contains(context->internal->files,
dir) == 0) {
DBG_ERR("Invalid dir in SMBC_readdirplus_ctx()\n");
TALLOC_FREE(frame);
errno = EBADF;
return NULL;
}
if (dir->dirplus_next == NULL) {
TALLOC_FREE(frame);
return NULL;
}
smb_finfo = dir->dirplus_next->smb_finfo;
if (smb_finfo == NULL) {
TALLOC_FREE(frame);
errno = ENOENT;
return NULL;
}
dir->dirplus_next = dir->dirplus_next->next;
TALLOC_FREE(frame);
return smb_finfo;
}
/*
* Routine to get directory entries
*/