#include "includes.h"
#include "smbd/globals.h"
+#include "libcli/security/security.h"
/*
This module implements directory related functions for Samba.
return true;
}
- sconn->smb1.searches.dptr_bmap = bitmap_allocate(MAX_DIRECTORY_HANDLES);
+ sconn->smb1.searches.dptr_bmap = bitmap_talloc(
+ sconn, MAX_DIRECTORY_HANDLES);
if (sconn->smb1.searches.dptr_bmap == NULL) {
return false;
* biased by one with respect to the bitmap.
*/
- if(bitmap_query(sconn->smb1.searches.dptr_bmap, dptr->dnum - 1) != true) {
+ if (!bitmap_query(sconn->smb1.searches.dptr_bmap, dptr->dnum - 1)) {
DEBUG(0,("dptr_close_internal : Error - closing dnum = %d and bitmap not set !\n",
dptr->dnum ));
}
Wrapper functions to access the lower level directory handles.
****************************************************************************/
-int dptr_CloseDir(struct dptr_struct *dptr)
+void dptr_CloseDir(files_struct *fsp)
{
- struct smbd_server_connection *sconn = dptr->conn->sconn;
- DLIST_REMOVE(sconn->smb1.searches.dirptrs, dptr);
- TALLOC_FREE(dptr->dir_hnd);
- return 0;
+ if (fsp->dptr) {
+ if (fsp->fh->fd == dirfd(fsp->dptr->dir_hnd->dir)) {
+ /* The call below closes the underlying fd. */
+ fsp->fh->fd = -1;
+ }
+ dptr_close_internal(fsp->dptr);
+ fsp->dptr = NULL;
+ }
}
void dptr_SeekDir(struct dptr_struct *dptr, long offset)
fileid = vfs_file_id_from_sbuf(conn,
&smb_fname.st);
- get_file_infos(fileid, NULL, &write_time_ts);
+ get_file_infos(fileid, 0, NULL, &write_time_ts);
if (!null_timespec(write_time_ts)) {
update_stat_ex_mtime(&smb_fname.st,
write_time_ts);