From 91be5fe9ad8f0ee28fe6744a5a0b39eab4631d17 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 21 Oct 2012 22:15:31 -0700 Subject: chansrv: work on clipboard --- sesman/chansrv/clipboard_file.c | 43 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'sesman/chansrv/clipboard_file.c') diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c index 33df6f3e..526633d4 100644 --- a/sesman/chansrv/clipboard_file.c +++ b/sesman/chansrv/clipboard_file.c @@ -56,15 +56,50 @@ struct cb_file_info static struct cb_file_info g_files[64]; static int g_num_files = 0; +/*****************************************************************************/ +static int APP_CC +clipboard_check_file(char *filename) +{ + char lfilename[256]; + char jchr[8]; + int lindex; + int index; + + g_memset(lfilename, 0, 256); + lindex = 0; + index = 0; + while (filename[index] != 0) + { + if (filename[index] == '%') + { + jchr[0] = filename[index + 1]; + jchr[1] = filename[index + 2]; + jchr[2] = 0; + index += 3; + lfilename[lindex] = g_htoi(jchr); + lindex++; + } + else + { + lfilename[lindex] = filename[index]; + lindex++; + index++; + } + } + LLOGLN(0, ("[%s] [%s]", filename, lfilename)); + g_strcpy(filename, lfilename); + return 0; +} + /*****************************************************************************/ static int APP_CC clipboard_get_file(char* file, int bytes) { int sindex; int pindex; - char full_fn[256]; - char filename[256]; - char pathname[256]; + char full_fn[256]; /* /etc/xrdp/xrdp.ini */ + char filename[256]; /* xrdp.ini */ + char pathname[256]; /* /etc/xrdp */ sindex = 0; if (g_strncmp(file, "file:///", 8) == 0) @@ -88,6 +123,8 @@ clipboard_get_file(char* file, int bytes) pathname[0] = '/'; } g_memcpy(filename, file + pindex + 1, (bytes - 1) - pindex); + /* this should replace %20 with space */ + clipboard_check_file(filename); g_snprintf(full_fn, 255, "%s/%s", pathname, filename); if (g_directory_exist(full_fn)) { -- cgit v1.2.1