mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
smbd: Add smbd_dirptr_push_overflow()
This saves the result of smbd_dirptr_get_entry() for later retrieval in case we could not marshall it to the output buffer. Return this entry when calling smbd_dirptr_get_entry() again. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
91c76f6514
commit
0b27175764
@ -70,6 +70,12 @@ struct dptr_struct {
|
||||
bool did_stat; /* Optimisation for non-wcard searches. */
|
||||
bool priv; /* Directory handle opened with privilege. */
|
||||
uint32_t counter;
|
||||
|
||||
struct {
|
||||
char *fname;
|
||||
struct smb_filename *smb_fname;
|
||||
uint32_t mode;
|
||||
} overflow;
|
||||
};
|
||||
|
||||
static NTSTATUS OpenDir_fsp(
|
||||
@ -361,12 +367,16 @@ void dptr_RewindDir(struct dptr_struct *dptr)
|
||||
long offset;
|
||||
RewindDir(dptr->dir_hnd, &offset);
|
||||
dptr->did_stat = false;
|
||||
TALLOC_FREE(dptr->overflow.fname);
|
||||
TALLOC_FREE(dptr->overflow.smb_fname);
|
||||
}
|
||||
|
||||
void dptr_SeekDir(struct dptr_struct *dptr, long offset)
|
||||
{
|
||||
SeekDir(dptr->dir_hnd, offset);
|
||||
dptr->did_stat = false;
|
||||
TALLOC_FREE(dptr->overflow.fname);
|
||||
TALLOC_FREE(dptr->overflow.smb_fname);
|
||||
}
|
||||
|
||||
long dptr_TellDir(struct dptr_struct *dptr)
|
||||
@ -575,6 +585,13 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
|
||||
*_smb_fname = NULL;
|
||||
*_mode = 0;
|
||||
|
||||
if (dirptr->overflow.smb_fname != NULL) {
|
||||
*_fname = talloc_move(ctx, &dirptr->overflow.fname);
|
||||
*_smb_fname = talloc_move(ctx, &dirptr->overflow.smb_fname);
|
||||
*_mode = dirptr->overflow.mode;
|
||||
return true;
|
||||
}
|
||||
|
||||
pathlen = strlen(dpath);
|
||||
slashlen = ( dpath[pathlen-1] != '/') ? 1 : 0;
|
||||
|
||||
@ -887,6 +904,19 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
void smbd_dirptr_push_overflow(struct dptr_struct *dirptr,
|
||||
char **_fname,
|
||||
struct smb_filename **_smb_fname,
|
||||
uint32_t mode)
|
||||
{
|
||||
SMB_ASSERT(dirptr->overflow.fname == NULL);
|
||||
SMB_ASSERT(dirptr->overflow.smb_fname == NULL);
|
||||
|
||||
dirptr->overflow.fname = talloc_move(dirptr, _fname);
|
||||
dirptr->overflow.smb_fname = talloc_move(dirptr, _smb_fname);
|
||||
dirptr->overflow.mode = mode;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Check to see if a user can read an fsp . This is only approximate,
|
||||
it is used as part of the "hide unreadable" option. Don't
|
||||
|
@ -183,6 +183,10 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
|
||||
struct smb_filename **_smb_fname,
|
||||
uint32_t *_mode,
|
||||
long *_prev_offset);
|
||||
void smbd_dirptr_push_overflow(struct dptr_struct *dirptr,
|
||||
char **_fname,
|
||||
struct smb_filename **_smb_fname,
|
||||
uint32_t mode);
|
||||
|
||||
NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
|
||||
connection_struct *conn,
|
||||
|
Loading…
Reference in New Issue
Block a user