Ejemplo n.º 1
0
void process_searcher_request(int sock, int type, const void *data, int size) {
	switch (type) {
		case OP_GET_NODES: cli_get_nodes(sock, (struct get_nodes_packet*)data); break;
		case OP_NODE_LIST: cli_node_list(sock, (struct node_list_packet*)data, (struct node_list_entry*)((const char*)data + sizeof(struct node_list_packet))); break;

		case OP_RESERVE_LOCK: cli_reserve_lock(sock, (oid_t*)data); break;
		case OP_LOCK: cli_lock(sock, (oid_t*)data); break;
		case OP_UNLOCK: cli_unlock(sock, (oid_t*)data); break;

		case OP_GETMETA: reqc_getmeta(sock, (struct getmeta_packet*)data); break;
		case OP_CREATE: reqm_create(sock, (struct create_packet*)data);	break;
		case OP_REMOVE: reqc_remove(sock, (struct remove_packet*)data); break;
		case OP_READ: reqc_read(sock, (struct read_packet*)data); break;
		case OP_WRITE: reqc_write(sock, (struct write_packet*)data, ((const char*)data + sizeof(struct write_packet))); break;

		default: break;
	}
}
Ejemplo n.º 2
0
BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len)
{
	char *p;

	if (! (cli->capabilities & CAP_LARGE_FILES)) {
		return cli_unlock(cli, fnum, offset, len);
	}

	memset(cli->outbuf,'\0',smb_size);
	memset(cli->inbuf,'\0',smb_size);

	set_message(cli->outbuf,8,0,True);

	SCVAL(cli->outbuf,smb_com,SMBlockingX);
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);

	SCVAL(cli->outbuf,smb_vwv0,0xFF);
	SSVAL(cli->outbuf,smb_vwv2,fnum);
	SCVAL(cli->outbuf,smb_vwv3,LOCKING_ANDX_LARGE_FILES);
	SIVALS(cli->outbuf, smb_vwv4, 0);
	SSVAL(cli->outbuf,smb_vwv6,1);
	SSVAL(cli->outbuf,smb_vwv7,0);

	p = smb_buf(cli->outbuf);
	SIVAL(p, 0, cli->pid);
	SOFF_T_R(p, 4, offset);
	SOFF_T_R(p, 12, len);
	p += 20;
	cli_setup_bcc(cli, p);
	cli_send_smb(cli);
	if (!cli_receive_smb(cli)) {
		return False;
	}

	if (cli_is_error(cli)) {
		return False;
	}

	return True;
}