Esempio n. 1
0
static ssize_t greyhole_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n)
{
	ssize_t result;
	FILE *spoolf;
	char filename[255];
	struct timeval tp;

	result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);

	if (result >= 0) {
		gettimeofday(&tp, (struct timezone *) NULL);
		char *share = lp_servicename(handle->conn->params->service);
		snprintf(filename, 39 + strlen(share) + nDigits(tofsp->fh->fd), "/var/spool/greyhole/%.0f-%s-%d", ((double) (tp.tv_sec)*1000000.0), share, tofsp->fh->fd);
		spoolf = fopen(filename, "wt");
		fprintf(spoolf, "fwrite\n%s\n%d\n\n",
			share,
			tofsp->fh->fd);
		fclose(spoolf);
	}

	return result;
}
Esempio n. 2
0
static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n)
{
	return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
}