Merge branch 'master' of github.com:FreeRDP/xrdp

ulab-next
Laxmikant Rashinkar 12 years ago
commit 0d3a2c7207

@ -168,7 +168,7 @@ xrdp_ffi2stat(struct xfuse_file_info *ffi, struct stat *stbuf)
}
else
{
stbuf->st_mode = S_IFREG | 0444;
stbuf->st_mode = S_IFREG | 0664;
stbuf->st_nlink = 1;
stbuf->st_size = ffi->size;
stbuf->st_uid = g_uid;
@ -187,7 +187,7 @@ xrdp_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
struct xfuse_file_info *ffi;
struct fuse_entry_param e;
LLOGLN(0, ("xrdp_ll_lookup: name %s", name));
LLOGLN(10, ("xrdp_ll_lookup: name %s", name));
if (parent != 1)
{
fuse_reply_err(req, ENOENT);
@ -197,7 +197,7 @@ xrdp_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
ffi = fuse_find_file_info_by_name(g_fuse_files, name);
if (ffi != 0)
{
LLOGLN(0, ("xrdp_ll_lookup: name %s ino %d", name, ffi->ino));
LLOGLN(10, ("xrdp_ll_lookup: name %s ino %d", name, ffi->ino));
g_memset(&e, 0, sizeof(e));
e.ino = ffi->ino;
e.attr_timeout = 1.0;
@ -217,7 +217,7 @@ xrdp_ll_getattr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
struct stat stbuf;
struct xfuse_file_info *ffi;
LLOGLN(0, ("xrdp_ll_getattr: ino %d", ino));
LLOGLN(10, ("xrdp_ll_getattr: ino %d", ino));
g_memset(&stbuf, 0, sizeof(stbuf));
if (ino == 1)
{
@ -300,7 +300,7 @@ xrdp_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
struct xfuse_file_info *ffi;
struct dirbuf b;
LLOGLN(0, ("xrdp_ll_readdir: ino %d", ino));
LLOGLN(10, ("xrdp_ll_readdir: ino %d", ino));
if (ino != 1)
{
fuse_reply_err(req, ENOTDIR);
@ -326,7 +326,7 @@ xrdp_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
static void DEFAULT_CC
xrdp_ll_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
{
LLOGLN(0, ("xrdp_ll_open: ino %d", (int)ino));
LLOGLN(10, ("xrdp_ll_open: ino %d", (int)ino));
if (ino == 1)
{
fuse_reply_err(req, EISDIR);
@ -351,7 +351,7 @@ xrdp_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size,
struct xfuse_file_info *ffi;
struct req_list_item *rli;
LLOGLN(0, ("xrdp_ll_read: %d %d %d", (int)ino, (int)off, (int)size));
LLOGLN(10, ("xrdp_ll_read: %d %d %d", (int)ino, (int)off, (int)size));
ffi = fuse_find_file_info_by_ino(g_fuse_files, ino);
if (ffi != 0)
{
@ -455,7 +455,7 @@ fuse_add_clip_dir_item(char *filename, int flags, int size, int lindex)
struct xfuse_file_info *ffi;
struct xfuse_file_info *ffi1;
LLOGLN(0, ("fuse_add_clip_dir_item: adding %s ino %d", filename, g_ino));
LLOGLN(10, ("fuse_add_clip_dir_item: adding %s ino %d", filename, g_ino));
ffi = g_fuse_files;
if (ffi == 0)
{
@ -541,12 +541,21 @@ fuse_init(void)
char *param0 = "xrdp-chansrv";
char *argv[4];
g_snprintf(g_fuse_root_path, 255, "%s/xrdp_client", g_getenv("HOME"));
LLOGLN(0, ("fuse_init: using root_path [%s]", g_fuse_root_path));
if (g_ch != 0)
{
return 0;
}
g_snprintf(g_fuse_root_path, 255, "%s/xrdp_client", g_getenv("HOME"));
LLOGLN(0, ("fuse_init: using root_path [%s]", g_fuse_root_path));
if (!g_directory_exist(g_fuse_root_path))
{
if (!g_create_dir(g_fuse_root_path))
{
LLOGLN(0, ("fuse_init: g_create_dir failed [%s]",
g_fuse_root_path));
return 1;
}
}
g_time = g_time1();
g_uid = g_getuid();
g_gid = g_getgid();
@ -603,7 +612,7 @@ fuse_deinit(void)
int APP_CC
fuse_file_contents_size(int stream_id, int file_size)
{
LLOGLN(0, ("fuse_file_contents_size: file_size %d", file_size));
LLOGLN(10, ("fuse_file_contents_size: file_size %d", file_size));
return 0;
}
@ -613,7 +622,7 @@ fuse_file_contents_range(int stream_id, char *data, int data_bytes)
{
struct req_list_item *rli;
LLOGLN(0, ("fuse_file_contents_range: data_bytes %d", data_bytes));
LLOGLN(10, ("fuse_file_contents_range: data_bytes %d", data_bytes));
rli = (struct req_list_item *)list_get_item(g_req_list, 0);
if (rli != 0)
{
@ -645,6 +654,8 @@ fuse_file_contents_range(int stream_id, char *data, int data_bytes)
#include "arch.h"
char g_fuse_root_path[256] = "";
/*****************************************************************************/
int APP_CC
fuse_get_wait_objs(tbus *objs, int *count, int *timeout)

@ -169,7 +169,7 @@ x-special/gnome-copied-files
#include "xcommon.h"
#include "chansrv_fuse.h"
#define LLOG_LEVEL 11
#define LLOG_LEVEL 1
#define LLOGLN(_level, _args) \
do \
{ \
@ -824,7 +824,7 @@ clipboard_set_selection_owner(void)
{
Window owner;
LLOGLN(0, ("clipboard_set_selection_owner:"));
LLOGLN(10, ("clipboard_set_selection_owner:"));
g_selection_time = clipboard_get_server_time();
XSetSelectionOwner(g_display, g_clipboard_atom, g_wnd, g_selection_time);
owner = XGetSelectionOwner(g_display, g_clipboard_atom);
@ -846,8 +846,8 @@ clipboard_provide_selection_c2s(XSelectionRequestEvent *req, Atom type)
XEvent xev;
long val1[2];
LLOGLN(0, ("clipboard_provide_selection_c2s: bytes %d",
g_clip_c2s.total_bytes));
LLOGLN(10, ("clipboard_provide_selection_c2s: bytes %d",
g_clip_c2s.total_bytes));
if (g_clip_c2s.total_bytes < g_incr_max_req_size)
{
XChangeProperty(g_display, req->requestor, req->property,
@ -872,8 +872,8 @@ clipboard_provide_selection_c2s(XSelectionRequestEvent *req, Atom type)
g_clip_c2s.type = type;
g_clip_c2s.property = req->property;
g_clip_c2s.window = req->requestor;
LLOGLN(0, ("clipboard_provide_selection_c2s: start INCR property %s "
"type %s", XGetAtomName(g_display, req->property),
LLOGLN(10, ("clipboard_provide_selection_c2s: start INCR property %s "
"type %s", XGetAtomName(g_display, req->property),
XGetAtomName(g_display, type)));
val1[0] = g_clip_c2s.total_bytes;
val1[1] = 0;
@ -905,7 +905,7 @@ clipboard_provide_selection(XSelectionRequestEvent *req, Atom type, int format,
bytes = FORMAT_TO_BYTES(format);
bytes *= length;
LLOGLN(0, ("clipboard_provide_selection: bytes %d", bytes));
LLOGLN(10, ("clipboard_provide_selection: bytes %d", bytes));
if (bytes < g_incr_max_req_size)
{
XChangeProperty(g_display, req->requestor, req->property,
@ -990,7 +990,7 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
desc[15] = 0;
clip_msg_len -= 32;
}
LLOGLN(0, ("clipboard_process_format_announce: formatId 0x%8.8x "
LLOGLN(10, ("clipboard_process_format_announce: formatId 0x%8.8x "
"wszFormatName [%s] clip_msg_len %d", formatId, desc,
clip_msg_len));
g_formatIds[g_num_formatIds] = formatId;
@ -1067,8 +1067,8 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
LOGM((LOG_LEVEL_DEBUG, "clipboard_process_data_request: "
"CLIPRDR_DATA_REQUEST"));
LLOGLN(0, ("clipboard_process_data_request:"));
LLOGLN(0, (" %d", g_clip_s2c.xrdp_clip_type));
LLOGLN(10, ("clipboard_process_data_request:"));
LLOGLN(10, (" %d", g_clip_s2c.xrdp_clip_type));
in_uint32_le(s, requestedFormatId);
switch (requestedFormatId)
{
@ -1188,7 +1188,7 @@ clipboard_process_data_response(struct stream *s, int clip_msg_status,
int len;
int index;
LLOGLN(0, ("clipboard_process_data_response:"));
LLOGLN(10, ("clipboard_process_data_response:"));
lxev = &g_saved_selection_req_event;
g_clip_c2s.converted = 1;
if (g_clip_c2s.xrdp_clip_type == XRDP_CB_BITMAP)
@ -1329,7 +1329,7 @@ clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length,
LOG(10, ("clipboard_data_in: chan_is %d "
"chan_flags %d length %d total_length %d",
chan_id, chan_flags, length, total_length));
//LLOGLN(10, ("clipboard_data_in:"));
LLOGLN(10, ("clipboard_data_in:"));
if ((chan_flags & 3) == 3)
{
@ -1437,14 +1437,14 @@ clipboard_event_selection_owner_notify(XEvent *xevent)
XFixesSelectionNotifyEvent *lxevent;
lxevent = (XFixesSelectionNotifyEvent *)xevent;
LLOGLN(0, ("clipboard_event_selection_owner_notify: %p", lxevent->owner));
LLOGLN(10, ("clipboard_event_selection_owner_notify: %p", lxevent->owner));
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_owner_notify: "
"window %d subtype %d owner %d g_wnd %d",
lxevent->window, lxevent->subtype, lxevent->owner, g_wnd));
if (lxevent->owner == g_wnd)
{
LLOGLN(0, ("clipboard_event_selection_owner_notify: matches g_wnd"));
LLOGLN(10, ("clipboard_event_selection_owner_notify: matches g_wnd"));
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_owner_notify: skipping, "
"onwer == g_wnd"));
g_got_selection = 1;
@ -1474,8 +1474,8 @@ clipboard_get_window_property(Window wnd, Atom prop, Atom *type, int *fmt,
tui8 *lxdata;
Atom ltype;
LLOGLN(0, ("clipboard_get_window_property:"));
LLOGLN(0, (" prop %d name %s", prop, XGetAtomName(g_display, prop)));
LLOGLN(10, ("clipboard_get_window_property:"));
LLOGLN(10, (" prop %d name %s", prop, XGetAtomName(g_display, prop)));
lxdata = 0;
ltype = 0;
XGetWindowProperty(g_display, wnd, prop, 0, 0, 0,
@ -1614,8 +1614,9 @@ clipboard_event_selection_notify(XEvent *xevent)
if (rv == 0)
{
LLOGLN(0, ("clipboard_event_selection_notify: wnd %p prop %s", lxevent->requestor,
XGetAtomName(g_display, lxevent->property)));
LLOGLN(10, ("clipboard_event_selection_notify: wnd %p prop %s",
lxevent->requestor,
XGetAtomName(g_display, lxevent->property)));
rv = clipboard_get_window_property(lxevent->requestor, lxevent->property,
&type, &fmt,
&n_items, &data, &data_size);
@ -1631,10 +1632,10 @@ clipboard_event_selection_notify(XEvent *xevent)
{
/* nothing more to do here, the data is comming in through
PropertyNotify */
LLOGLN(0, ("clipboard_event_selection_notify: type is INCR "
"data_size %d property name %s type %s", data_size,
XGetAtomName(g_display, lxevent->property),
XGetAtomName(g_display, lxevent->type)));
LLOGLN(10, ("clipboard_event_selection_notify: type is INCR "
"data_size %d property name %s type %s", data_size,
XGetAtomName(g_display, lxevent->property),
XGetAtomName(g_display, lxevent->type)));
g_clip_s2c.incr_in_progress = 1;
g_clip_s2c.property = lxevent->property;
g_clip_s2c.type = lxevent->target;
@ -2078,7 +2079,7 @@ clipboard_event_property_notify(XEvent *xevent)
(xevent->xproperty.atom == g_clip_c2s.property) &&
(xevent->xproperty.state == PropertyDelete))
{
LLOGLN(0, ("clipboard_event_property_notify: INCR PropertyDelete"));
LLOGLN(10, ("clipboard_event_property_notify: INCR PropertyDelete"));
/* this is used for when copying a large clipboard to the other app,
it will delete the property so we know to send the next one */
@ -2094,13 +2095,13 @@ clipboard_event_property_notify(XEvent *xevent)
bytes = g_incr_max_req_size;
}
g_clip_c2s.incr_bytes_done += bytes;
LLOGLN(0, ("clipboard_event_property_notify: bytes %d", bytes));
LLOGLN(10, ("clipboard_event_property_notify: bytes %d", bytes));
XChangeProperty(xevent->xproperty.display, xevent->xproperty.window,
xevent->xproperty.atom, g_clip_c2s.type, 8,
PropModeReplace, data, bytes);
if (bytes < 1)
{
LLOGLN(0, ("clipboard_event_property_notify: INCR done"));
LLOGLN(10, ("clipboard_event_property_notify: INCR done"));
g_clip_c2s.incr_in_progress = 0;
/* we no longer need property notify */
XSelectInput(xevent->xproperty.display, xevent->xproperty.window,
@ -2112,7 +2113,7 @@ clipboard_event_property_notify(XEvent *xevent)
(xevent->xproperty.atom == g_clip_s2c.property) &&
(xevent->xproperty.state == PropertyNewValue))
{
LLOGLN(0, ("clipboard_event_property_notify: INCR PropertyNewValue"));
LLOGLN(10, ("clipboard_event_property_notify: INCR PropertyNewValue"));
rv = XGetWindowProperty(g_display, g_wnd, g_clip_s2c.property, 0, 0, 0,
AnyPropertyType, &actual_type_return, &actual_format_return,
&nitems_returned, &bytes_left, &data);
@ -2238,20 +2239,20 @@ clipboard_xevent(void *xevent)
if (lxevent->type == g_xfixes_event_base +
XFixesSetSelectionOwnerNotify)
{
LLOGLN(0, ("clipboard_xevent: got XFixesSetSelectionOwnerNotify"));
LLOGLN(10, ("clipboard_xevent: got XFixesSetSelectionOwnerNotify"));
clipboard_event_selection_owner_notify(lxevent);
break;
}
if (lxevent->type == g_xfixes_event_base +
XFixesSelectionWindowDestroyNotify)
{
LLOGLN(0, ("clipboard_xevent: got XFixesSelectionWindowDestroyNotify"));
LLOGLN(10, ("clipboard_xevent: got XFixesSelectionWindowDestroyNotify"));
break;
}
if (lxevent->type == g_xfixes_event_base +
XFixesSelectionClientCloseNotify)
{
LLOGLN(0, ("clipboard_xevent: got XFixesSelectionClientCloseNotify"));
LLOGLN(10, ("clipboard_xevent: got XFixesSelectionClientCloseNotify"));
break;
}

@ -28,6 +28,7 @@
#include "arch.h"
#include "parse.h"
#include "os_calls.h"
#include "list.h"
#include "chansrv.h"
#include "clipboard.h"
#include "clipboard_file.h"
@ -35,7 +36,7 @@
#include "xcommon.h"
#include "chansrv_fuse.h"
#define LLOG_LEVEL 11
#define LLOG_LEVEL 1
#define LLOGLN(_level, _args) \
do \
{ \
@ -63,8 +64,9 @@ struct cb_file_info
tui64 time;
};
static struct cb_file_info g_files[64];
static int g_num_files = 0;
static struct list *g_files_list = 0;
/* used when server is asking for file info from the client */
static int g_file_request_sent_type = 0;
/* number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC */
@ -115,7 +117,7 @@ clipboard_check_file(char *filename)
index++;
}
}
LLOGLN(0, ("[%s] [%s]", filename, lfilename));
LLOGLN(10, ("[%s] [%s]", filename, lfilename));
g_strcpy(filename, lfilename);
return 0;
}
@ -130,17 +132,15 @@ clipboard_get_file(char* file, int bytes)
char full_fn[256]; /* /etc/xrdp/xrdp.ini */
char filename[256]; /* xrdp.ini */
char pathname[256]; /* /etc/xrdp */
struct cb_file_info *cfi;
/* x-special/gnome-copied-files */
if ((g_strncmp(file, "copy", 4) == 0) && (bytes == 4))
{
g_writeln("jay");
return 0;
}
if ((g_strncmp(file, "cut", 3) == 0) && (bytes == 3))
{
g_writeln("jay");
return 0;
}
sindex = 0;
@ -186,16 +186,15 @@ clipboard_get_file(char* file, int bytes)
}
else
{
g_strcpy(g_files[g_num_files].filename, filename);
g_strcpy(g_files[g_num_files].pathname, pathname);
g_files[g_num_files].size = g_file_get_size(full_fn);
g_files[g_num_files].flags = flags;
g_files[g_num_files].time = (g_time1() + CB_EPOCH_DIFF) * 10000000LL;
g_writeln("ok filename [%s] pathname [%s] size [%d]",
g_files[g_num_files].filename,
g_files[g_num_files].pathname,
g_files[g_num_files].size);
g_num_files++;
cfi = (struct cb_file_info*)g_malloc(sizeof(struct cb_file_info), 1);
list_add_item(g_files_list, (tintptr)cfi);
g_strcpy(cfi->filename, filename);
g_strcpy(cfi->pathname, pathname);
cfi->size = g_file_get_size(full_fn);
cfi->flags = flags;
cfi->time = (g_time1() + CB_EPOCH_DIFF) * 10000000LL;
LLOGLN(10, ("ok filename [%s] pathname [%s] size [%d]",
cfi->filename, cfi->pathname, cfi->size));
}
return 0;
}
@ -208,7 +207,6 @@ clipboard_get_files(char *files, int bytes)
int file_index;
char file[512];
g_num_files = 0;
file_index = 0;
for (index = 0; index < bytes; index++)
{
@ -227,10 +225,6 @@ clipboard_get_files(char *files, int bytes)
file[file_index] = files[index];
file_index++;
}
if (g_num_files > 60)
{
break;
}
}
if (file_index > 0)
{
@ -238,7 +232,7 @@ clipboard_get_files(char *files, int bytes)
{
}
}
if (g_num_files < 1)
if (g_files_list->count < 1)
{
return 1;
}
@ -260,12 +254,19 @@ clipboard_send_data_response_for_file(char *data, int data_size)
int index;
tui32 ui32;
char fn[256];
struct cb_file_info *cfi;
LLOGLN(10, ("clipboard_send_data_response_for_file: data_size %d",
data_size));
//g_hexdump(data, data_size);
if (g_files_list == 0)
{
g_files_list = list_create();
g_files_list->auto_free = 1;
}
list_clear(g_files_list);
clipboard_get_files(data, data_size);
cItems = g_num_files;
cItems = g_files_list->count;
bytes_after_header = cItems * 592 + 4;
make_stream(s);
init_stream(s, 64 + bytes_after_header);
@ -275,32 +276,31 @@ clipboard_send_data_response_for_file(char *data, int data_size)
out_uint32_le(s, cItems);
for (index = 0; index < cItems; index++)
{
cfi = (struct cb_file_info *)list_get_item(g_files_list, index);
flags = CB_FD_ATTRIBUTES | CB_FD_FILESIZE | CB_FD_WRITESTIME | CB_FD_PROGRESSUI;
out_uint32_le(s, flags);
out_uint8s(s, 32); /* reserved1 */
flags = g_files[index].flags;
flags = cfi->flags;
out_uint32_le(s, flags);
out_uint8s(s, 16); /* reserved2 */
/* file time */
/* 100-nanoseconds intervals since 1 January 1601 */
//out_uint32_le(s, 0x2c305d08); /* 25 October 2009, 21:17 */
//out_uint32_le(s, 0x01ca55f3);
ui32 = g_files[index].time & 0xffffffff;
ui32 = cfi->time & 0xffffffff;
out_uint32_le(s, ui32);
ui32 = g_files[index].time >> 32;
ui32 = cfi->time >> 32;
out_uint32_le(s, ui32);
/* file size */
out_uint32_le(s, 0);
out_uint32_le(s, g_files[index].size);
//g_writeln("jay size %d", g_files[index].size);
g_snprintf(fn, 255, "%s", g_files[index].filename);
out_uint32_le(s, cfi->size);
g_snprintf(fn, 255, "%s", cfi->filename);
clipboard_out_unicode(s, fn, 256);
out_uint8s(s, 8); /* pad */
}
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
//g_hexdump(s->data, size);
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@ -315,8 +315,20 @@ clipboard_send_file_size(int streamId, int lindex)
int size;
int rv;
int file_size;
struct cb_file_info *cfi;
file_size = g_files[lindex].size;
if (g_files_list == 0)
{
LLOGLN(10, ("clipboard_send_file_size: error g_files_list is nil"));
return 1;
}
cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
if (cfi == 0)
{
LLOGLN(10, ("clipboard_send_file_size: error cfi is nil"));
return 1;
}
file_size = cfi->size;
LLOGLN(10, ("clipboard_send_file_size: streamId %d file_size %d",
streamId, file_size));
make_stream(s);
@ -326,7 +338,6 @@ clipboard_send_file_size(int streamId, int lindex)
out_uint32_le(s, 12);
out_uint32_le(s, streamId);
out_uint32_le(s, file_size);
g_writeln("file_size %d", file_size);
out_uint32_le(s, 0);
out_uint32_le(s, 0);
s_mark_end(s);
@ -344,9 +355,7 @@ clipboard_request_file_size(int stream_id, int lindex)
struct stream *s;
int size;
int rv;
int file_size;
file_size = g_files[lindex].size;
LLOGLN(10, ("clipboard_request_file_size:"));
if (g_file_request_sent_type != 0)
{
@ -385,12 +394,23 @@ clipboard_send_file_data(int streamId, int lindex,
int rv;
int fd;
char full_fn[256];
struct cb_file_info *cfi;
if (g_files_list == 0)
{
LLOGLN(10, ("clipboard_send_file_data: error g_files_list is nil"));
return 1;
}
cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
if (cfi == 0)
{
LLOGLN(10, ("clipboard_send_file_data: error cfi is nil"));
return 1;
}
LLOGLN(10, ("clipboard_send_file_data: streamId %d lindex %d "
"nPositionLow %d cbRequested %d", streamId, lindex,
nPositionLow, cbRequested));
g_snprintf(full_fn, 255, "%s/%s", g_files[lindex].pathname,
g_files[lindex].filename);
g_snprintf(full_fn, 255, "%s/%s", cfi->pathname, cfi->filename);
fd = g_file_open_ex(full_fn, 1, 0, 0, 0);
if (fd == -1)
{
@ -401,13 +421,11 @@ clipboard_send_file_data(int streamId, int lindex,
g_file_seek(fd, nPositionLow);
make_stream(s);
init_stream(s, cbRequested + 64);
//g_memset(s->data + 12, 26, cbRequested);
size = g_file_read(fd, s->data + 12, cbRequested);
//g_writeln("size %d", size);
if (size < 1)
{
LLOGLN(10, ("clipboard_send_file_data: read error, want %d got %d",
cbRequested, size));
LLOGLN(0, ("clipboard_send_file_data: read error, want %d got %d",
cbRequested, size));
free_stream(s);
g_file_close(fd);
return 1;
@ -435,9 +453,7 @@ clipboard_request_file_data(int stream_id, int lindex, int offset,
struct stream *s;
int size;
int rv;
int file_size;
file_size = g_files[lindex].size;
LLOGLN(10, ("clipboard_request_file_data:"));
if (g_file_request_sent_type != 0)
{
@ -467,6 +483,7 @@ clipboard_request_file_data(int stream_id, int lindex, int offset,
/*****************************************************************************/
/* client is asking from info about a file */
int APP_CC
clipboard_process_file_request(struct stream *s, int clip_msg_status,
int clip_msg_len)
@ -508,15 +525,14 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
{
int streamId;
int file_size;
char *data;
LLOGLN(0, ("clipboard_process_file_response:"));
LLOGLN(10, ("clipboard_process_file_response:"));
if (g_file_request_sent_type == CB_FILECONTENTS_SIZE)
{
g_file_request_sent_type = 0;
in_uint32_le(s, streamId);
in_uint32_le(s, file_size);
LLOGLN(0, ("clipboard_process_file_response: streamId %d "
LLOGLN(10, ("clipboard_process_file_response: streamId %d "
"file_size %d", streamId, file_size));
fuse_file_contents_size(streamId, file_size);
}
@ -579,7 +595,7 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
in_uint32_le(s, cItems);
fuse_clear_clip_dir();
LLOGLN(0, ("clipboard_c2s_in_files: cItems %d", cItems));
LLOGLN(10, ("clipboard_c2s_in_files: cItems %d", cItems));
cfd = (struct clip_file_desc *)
g_malloc(sizeof(struct clip_file_desc), 0);
ptr = file_list;
@ -587,6 +603,13 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
{
g_memset(cfd, 0, sizeof(struct clip_file_desc));
clipboard_c2s_in_file_info(s, cfd);
if ((g_pos(cfd->cFileName, "\\") >= 0) ||
(cfd->fileAttributes & CB_FILE_ATTRIBUTE_DIRECTORY))
{
LLOGLN(0, ("clipboard_c2s_in_files: skipping directory not "
"supported [%s]", cfd->cFileName));
continue;
}
fuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
g_strcpy(ptr, "file://");

Loading…
Cancel
Save