time_t t = time(NULL);
for (i=0;i<MAX_OLD_SEARCHES;i++) {
- struct pvfs_search_state *search = idr_find(pvfs->search.idtree, i);
- if (search == NULL) return;
+ struct pvfs_search_state *search;
+ void *p = idr_find(pvfs->search.idtree, i);
+
+ if (p == NULL) return;
+
+ search = talloc_get_type(p, struct pvfs_search_state);
if (pvfs_list_eos(search->dir, search->current_index) &&
search->last_used != 0 &&
t > search->last_used + 30) {
bool (*callback)(void *, const union smb_search_data *))
{
struct pvfs_dir *dir;
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib;
void *search_private,
bool (*callback)(void *, const union smb_search_data *))
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
+ void *p;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count, max_count;
handle = io->search_next.in.id.handle | (io->search_next.in.id.reserved<<8);
max_count = io->search_next.in.max_count;
- search = idr_find(pvfs->search.idtree, handle);
- if (search == NULL) {
+ p = idr_find(pvfs->search.idtree, handle);
+ if (p == NULL) {
/* we didn't find the search handle */
return NT_STATUS_INVALID_HANDLE;
}
+ search = talloc_get_type(p, struct pvfs_search_state);
+
dir = search->dir;
status = pvfs_list_seek_ofs(dir, io->search_next.in.id.server_cookie,
bool (*callback)(void *, const union smb_search_data *))
{
struct pvfs_dir *dir;
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib, max_count;
void *search_private,
bool (*callback)(void *, const union smb_search_data *))
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
+ void *p;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count;
handle = io->t2fnext.in.handle;
- search = idr_find(pvfs->search.idtree, handle);
- if (search == NULL) {
+ p = idr_find(pvfs->search.idtree, handle);
+ if (p == NULL) {
/* we didn't find the search handle */
return NT_STATUS_INVALID_HANDLE;
}
-
+
+ search = talloc_get_type(p, struct pvfs_search_state);
+
dir = search->dir;
status = NT_STATUS_OK;
bool (*callback)(void *, const union smb_search_data *))
{
struct pvfs_dir *dir;
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t max_count;
void *search_private,
bool (*callback)(void *, const union smb_search_data *))
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t max_count;
NTSTATUS pvfs_search_close(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_close *io)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
+ void *p;
struct pvfs_search_state *search;
uint16_t handle = INVALID_SEARCH_HANDLE;
break;
}
- search = idr_find(pvfs->search.idtree, handle);
- if (search == NULL) {
+ p = idr_find(pvfs->search.idtree, handle);
+ if (p == NULL) {
/* we didn't find the search handle */
return NT_STATUS_INVALID_HANDLE;
}
+ search = talloc_get_type(p, struct pvfs_search_state);
+
talloc_free(search);
return NT_STATUS_OK;