Beispiel #1
0
/*
  check if a directory exists
*/
static NTSTATUS cvfs_chkpath(struct ntvfs_module_context *ntvfs, 
			     struct ntvfs_request *req, union smb_chkpath *cp)
{
	struct cvfs_private *p = ntvfs->private_data;
	struct smb2_request *c_req;
	struct smb2_find f;

	CHECK_ASYNC(req);
	
	/* SMB2 doesn't have a chkpath operation, and also doesn't
	 have a query path info call, so the best seems to be to do a
	 find call, using the roothandle we established at connect
	 time */
	ZERO_STRUCT(f);
	f.in.file.handle	= p->roothandle;
	f.in.level              = SMB2_FIND_DIRECTORY_INFO;
	f.in.pattern		= cp->chkpath.in.path;
	/* SMB2 find doesn't accept \ or the empty string - this is the best
	   approximation */
	if (strcmp(f.in.pattern, "\\") == 0 || 
	    strcmp(f.in.pattern, "") == 0) {
		f.in.pattern		= "?";
	}
	f.in.continue_flags	= SMB2_CONTINUE_FLAG_SINGLE | SMB2_CONTINUE_FLAG_RESTART;
	f.in.max_response_size	= 0x1000;
	
	c_req = smb2_find_send(p->tree, &f);

	SIMPLE_ASYNC_TAIL;
}
Beispiel #2
0
/*
  a varient of smb2_find that parses the resulting blob into
  smb_search_data structures
*/
NTSTATUS smb2_find_level(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
                         struct smb2_find *f,
                         unsigned int *count, union smb_search_data **io)
{
    struct smb2_request *req;

    req = smb2_find_send(tree, f);
    return smb2_find_level_recv(req, mem_ctx, f->in.level, count, io);
}
Beispiel #3
0
/*
  sync find request
*/
NTSTATUS smb2_find(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
                   struct smb2_find *io)
{
    struct smb2_request *req = smb2_find_send(tree, io);
    return smb2_find_recv(req, mem_ctx, io);
}