From 60704a5c005586c1d459d704af3b02da56c6a55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Mon, 9 Aug 2004 13:50:41 +0000 Subject: [PATCH] Disk redirection actually uses share names; not drive letters. Make sure we truncate share names longer than 8 chars. Documentation updated. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@746 423420c4-83ab-492f-b58f-81f9feb106b5 --- disk.c | 10 ++++------ doc/rdesktop.1 | 7 ++++--- doc/redirection.txt | 4 ++-- rdesktop.c | 4 ++-- rdpdr.c | 2 ++ 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/disk.c b/disk.c index 965d810..e8f9285 100644 --- a/disk.c +++ b/disk.c @@ -149,16 +149,14 @@ disk_enum_devices(uint32 * id, char *optarg) while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES) { pos2 = next_arg(optarg, '='); - strcpy(g_rdpdr_device[*id].name, optarg); - toupper_str(g_rdpdr_device[*id].name); - - /* add trailing colon to name. */ - strcat(g_rdpdr_device[*id].name, ":"); + strncpy(g_rdpdr_device[*id].name, optarg, sizeof(g_rdpdr_device[*id].name)); + if (strlen(optarg) > 8) + fprintf(stderr, "share name %s truncated to %s\n", optarg, + g_rdpdr_device[*id].name); g_rdpdr_device[*id].local_path = xmalloc(strlen(pos2) + 1); strcpy(g_rdpdr_device[*id].local_path, pos2); - printf("DISK %s to %s\n", g_rdpdr_device[*id].name, g_rdpdr_device[*id].local_path); g_rdpdr_device[*id].device_type = DEVICE_TYPE_DISK; count++; (*id)++; diff --git a/doc/rdesktop.1 b/doc/rdesktop.1 index bf1ac4b..4ed013c 100644 --- a/doc/rdesktop.1 +++ b/doc/rdesktop.1 @@ -138,9 +138,10 @@ OSes you would use stty. Bidirectional/Read support requires Windows XP or newer In Windows 2000 it will create a port, but it's not seamless, most shell programs will not work with it. .TP -.BR "-r disk:=,..." -Redirects a path to the drive letter of your choice on the server. -(requires Windows XP or newer). +.BR "-r disk:=,..." +Redirects a path to the share \\\\tsclient\\ on the server +(requires Windows XP or newer). The share name is limited to 8 +characters. .TP .BR "-r lptport:=,..." Redirects parallel devices on your client to the server. diff --git a/doc/redirection.txt b/doc/redirection.txt index ecb01e5..0265045 100644 --- a/doc/redirection.txt +++ b/doc/redirection.txt @@ -22,8 +22,8 @@ disk mapping ------------- Multiple mappings possible: yes Default: no disk redirected -Syntax: -r disk:= -Example: -r disk:H=/home/johndoe +Syntax: -r disk:= +Example: -r disk:home=/home/johndoe printer mapping diff --git a/rdesktop.c b/rdesktop.c index 9f556f7..8cfcbfb 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -129,8 +129,8 @@ usage(char *program) " '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n"); fprintf(stderr, " or COM1=/dev/ttyS0,COM2=/dev/ttyS1\n"); fprintf(stderr, - " '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n"); - fprintf(stderr, " or A=/mnt/floppy,D=/mnt/cdrom'\n"); + " '-r disk:floppy=/mnt/floppy': enable redirection of /mnt/floppy to 'floppy' share\n"); + fprintf(stderr, " or 'floppy=/mnt/floppy,cdrom=/mnt/cdrom'\n"); fprintf(stderr, " '-r clientname=': Set the client name displayed\n"); fprintf(stderr, " for redirected disks\n"); fprintf(stderr, diff --git a/rdpdr.c b/rdpdr.c index ed9f94a..f76ba0c 100644 --- a/rdpdr.c +++ b/rdpdr.c @@ -266,6 +266,8 @@ rdpdr_send_available(void) { out_uint32_le(s, g_rdpdr_device[i].device_type); out_uint32_le(s, i); /* RDP Device ID */ + /* Is it possible to use share names longer than 8 chars? + /astrand */ out_uint8p(s, g_rdpdr_device[i].name, 8); switch (g_rdpdr_device[i].device_type)