bool allow_long_path_components = (req->flags2 & FLAGS2_LONG_PATH_COMPONENTS) ? True : False;
TALLOC_CTX *ctx = talloc_tos();
bool ask_sharemode = lp_parm_bool(SNUM(conn), "smbd", "search ask sharemode", true);
- struct dptr_struct *dirptr = NULL;
struct smbXsrv_connection *xconn = req->xconn;
struct smbd_server_connection *sconn = req->sconn;
files_struct *fsp = NULL;
goto out;
}
- dirptr = fsp->dptr;
dptr_num = dptr_dnum(fsp->dptr);
- /*
- * At this point the struct dptr_struct *dirptr
- * holds a pointer to fsp, and will automaticly
- * close it once dptr_close() is called. We will
- * fetch it as needed there.
- */
- fsp = NULL;
-
} else {
int status_dirtype;
const char *dirpath;
dirtype = status_dirtype;
}
- dirptr = dptr_fetch(sconn, status+12,&dptr_num);
- if (!dirptr) {
+ fsp = dptr_fetch_fsp(sconn, status+12,&dptr_num);
+ if (fsp == NULL) {
goto SearchEmpty;
}
dirpath = dptr_path(sconn, dptr_num);
for (i=numentries;(i<maxentries) && !finished;i++) {
finished = !get_dir_entry(ctx,
- dirptr,
+ fsp->dptr,
mask,
dirtype,
&fname,
SearchEmpty:
/* If we were called as SMBffirst with smb_search_id == NULL
- and no entries were found then return error and close dirptr
+ and no entries were found then return error and close fsp->dptr
(X/Open spec) */
if (numentries == 0) {
- fsp = dptr_fsp(sconn, dptr_num);
dptr_close(sconn, &dptr_num);
if (fsp != NULL) {
close_file(NULL, fsp, NORMAL_CLOSE);
fsp = NULL;
}
} else if(expect_close && status_len == 0) {
- fsp = dptr_fsp(sconn, dptr_num);
/* Close the dptr - we know it's gone */
dptr_close(sconn, &dptr_num);
if (fsp != NULL) {
}
}
- /* If we were called as SMBfunique, then we can close the dirptr now ! */
+ /* If we were called as SMBfunique, then we can close the fsp->dptr now ! */
if(dptr_num >= 0 && req->cmd == SMBfunique) {
- fsp = dptr_fsp(sconn, dptr_num);
dptr_close(sconn, &dptr_num);
+ /* fsp may have been closed above. */
if (fsp != NULL) {
close_file(NULL, fsp, NORMAL_CLOSE);
fsp = NULL;