summaryrefslogtreecommitdiffstats
path: root/sesman/chansrv
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-11-07 23:38:28 -0800
committerJay Sorg <jay.sorg@gmail.com>2012-11-07 23:38:28 -0800
commit0e111e64dec0e4b3b2c36d9d7b4b42994e5f498e (patch)
treee3f0e709a7020428cdbc9a8d99f1568f3f26d132 /sesman/chansrv
parent514c9ad8467c5b93b4d50f6bf846424e3b747e33 (diff)
downloadxrdp-proprietary-0e111e64dec0e4b3b2c36d9d7b4b42994e5f498e.tar.gz
xrdp-proprietary-0e111e64dec0e4b3b2c36d9d7b4b42994e5f498e.zip
chansrv: ignore directory clipboard copies for now and clean up logging
Diffstat (limited to 'sesman/chansrv')
-rw-r--r--sesman/chansrv/chansrv_fuse.c18
-rw-r--r--sesman/chansrv/clipboard.c59
-rw-r--r--sesman/chansrv/clipboard_file.c25
3 files changed, 55 insertions, 47 deletions
diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c
index aa9f4c94..eb60f63a 100644
--- a/sesman/chansrv/chansrv_fuse.c
+++ b/sesman/chansrv/chansrv_fuse.c
@@ -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)
{
@@ -612,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;
}
@@ -622,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)
{
diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c
index d4e8c645..38dcf5d1 100644
--- a/sesman/chansrv/clipboard.c
+++ b/sesman/chansrv/clipboard.c
@@ -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;
}
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index b46fa236..54a7b46a 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -36,7 +36,7 @@
#include "xcommon.h"
#include "chansrv_fuse.h"
-#define LLOG_LEVEL 11
+#define LLOG_LEVEL 1
#define LLOGLN(_level, _args) \
do \
{ \
@@ -117,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;
}
@@ -193,8 +193,8 @@ clipboard_get_file(char* file, int bytes)
cfi->size = g_file_get_size(full_fn);
cfi->flags = flags;
cfi->time = (g_time1() + CB_EPOCH_DIFF) * 10000000LL;
- LLOGLN(0, ("ok filename [%s] pathname [%s] size [%d]",
- cfi->filename, cfi->pathname, cfi->size));
+ LLOGLN(10, ("ok filename [%s] pathname [%s] size [%d]",
+ cfi->filename, cfi->pathname, cfi->size));
}
return 0;
}
@@ -424,8 +424,8 @@ clipboard_send_file_data(int streamId, int lindex,
size = g_file_read(fd, s->data + 12, cbRequested);
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;
@@ -526,13 +526,13 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
int streamId;
int file_size;
- 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);
}
@@ -595,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;
@@ -603,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://");