Commit c33b3c5b authored by Mati's avatar Mati

Imported Upstream version 1.7.1

parents
This diff is collapsed.
#
# rdesktop: A Remote Desktop Protocol client
# Makefile.in
# Copyright (C) Matthew Chapman 1999-2007
#
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
datarootdir = @datarootdir@
datadir = @datadir@
VERSION = @PACKAGE_VERSION@
KEYMAP_PATH = $(datadir)/rdesktop/keymaps/
CC = @CC@
INSTALL = @INSTALL@
CFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ -DKEYMAP_PATH=\"$(KEYMAP_PATH)\"
LDFLAGS = @LDFLAGS@ @LIBS@ @X_LIBS@ @X_EXTRA_LIBS@
STRIP = @STRIP@
TARGETS = rdesktop @RDP2VNCTARGET@
VNCINC = @VNCINC@
LDVNC = @LDVNC@
VNCLINK = @VNCLINK@
SOUNDOBJ = @SOUNDOBJ@
SCARDOBJ = @SCARDOBJ@
RDPOBJ = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o seamless.o ssl.o
X11OBJ = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
VNCOBJ = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
.PHONY: all
all: $(TARGETS)
rdesktop: $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ)
$(CC) $(CFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) -lX11
rdp2vnc: $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ)
$(VNCLINK) $(CFLAGS) -o rdp2vnc $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) $(LDVNC)
vnc/rdp2vnc.o: rdesktop.c
$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/rdp2vnc.o -c rdesktop.c
vnc/vnc.o: vnc/vnc.c
$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/vnc.o -c vnc/vnc.c
vnc/xkeymap.o: xkeymap.c
$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/xkeymap.o -c xkeymap.c
vnc/x11stubs.o: vnc/x11stubs.c
$(CC) $(CFLAGS) $(VNCINC) -o vnc/x11stubs.o -c vnc/x11stubs.c
.PHONY: install
install: installbin installkeymaps installman
.PHONY: installbin
installbin: rdesktop
mkdir -p $(DESTDIR)$(bindir)
$(INSTALL) rdesktop $(DESTDIR)$(bindir)
$(STRIP) $(DESTDIR)$(bindir)/rdesktop
chmod 755 $(DESTDIR)$(bindir)/rdesktop
.PHONY: installman
installman: doc/rdesktop.1
mkdir -p $(DESTDIR)$(mandir)/man1
cp doc/rdesktop.1 $(DESTDIR)$(mandir)/man1
chmod 644 $(DESTDIR)$(mandir)/man1/rdesktop.1
.PHONY: installkeymaps
installkeymaps:
mkdir -p $(DESTDIR)$(KEYMAP_PATH)
# Prevent copying the CVS directory
cp keymaps/?? keymaps/??-?? $(DESTDIR)$(KEYMAP_PATH)
cp keymaps/common $(DESTDIR)$(KEYMAP_PATH)
cp keymaps/modifiers $(DESTDIR)$(KEYMAP_PATH)
chmod 644 $(DESTDIR)$(KEYMAP_PATH)/*
.PHONY: proto
proto:
cat proto.head > proto.h
cproto -DMAKE_PROTO \
bitmap.c cache.c channels.c cliprdr.c disk.c mppc.c ewmhints.c \
iso.c licence.c mcs.c orders.c parallel.c printer.c printercache.c \
pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c \
secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c lspci.c seamless.c \
scard.c >> proto.h
cat proto.tail >> proto.h
.PHONY: clean
clean:
rm -f *.o *~ vnc/*.o vnc/*~ rdesktop rdp2vnc
.PHONY: distclean
distclean: clean
rm -rf autom4te.cache config.log config.status Makefile rdesktop-$(VERSION).tar.gz
.PHONY: dist
dist: rdesktop-$(VERSION).tar.gz
rdesktop-$(VERSION).tar.gz: Makefile configure
mkdir -p /tmp/rdesktop-make-dist-dir
ln -sf `pwd` /tmp/rdesktop-make-dist-dir/rdesktop-$(VERSION)
(cd /tmp/rdesktop-make-dist-dir; \
tar zcvf rdesktop-$(VERSION)/rdesktop-$(VERSION).tar.gz \
rdesktop-$(VERSION)/COPYING \
rdesktop-$(VERSION)/README \
rdesktop-$(VERSION)/configure \
rdesktop-$(VERSION)/configure.ac \
rdesktop-$(VERSION)/config.sub \
rdesktop-$(VERSION)/config.guess \
rdesktop-$(VERSION)/bootstrap \
rdesktop-$(VERSION)/install-sh \
rdesktop-$(VERSION)/Makefile.in \
rdesktop-$(VERSION)/rdesktop.spec \
rdesktop-$(VERSION)/*.c \
rdesktop-$(VERSION)/*.h \
rdesktop-$(VERSION)/proto.head \
rdesktop-$(VERSION)/proto.tail \
rdesktop-$(VERSION)/keymaps/?? \
rdesktop-$(VERSION)/keymaps/??-?? \
rdesktop-$(VERSION)/keymaps/common \
rdesktop-$(VERSION)/keymaps/modifiers \
rdesktop-$(VERSION)/keymaps/convert-map \
rdesktop-$(VERSION)/doc/HACKING \
rdesktop-$(VERSION)/doc/AUTHORS \
rdesktop-$(VERSION)/doc/TODO \
rdesktop-$(VERSION)/doc/ChangeLog \
rdesktop-$(VERSION)/doc/keymapping.txt \
rdesktop-$(VERSION)/doc/keymap-names.txt \
rdesktop-$(VERSION)/doc/ipv6.txt \
rdesktop-$(VERSION)/doc/licensing.txt \
rdesktop-$(VERSION)/doc/patches.txt \
rdesktop-$(VERSION)/doc/redirection.txt \
rdesktop-$(VERSION)/doc/rdesktop.1 )
rm -rf /tmp/rdesktop-make-dist-dir
.PHONY: dist-noversion
dist-noversion: rdesktop.tar.gz
rdesktop.tar.gz: rdesktop-$(VERSION).tar.gz
mkdir -p /tmp/rdesktop-make-dist-dir
tar zxvf $< -C /tmp/rdesktop-make-dist-dir
mv /tmp/rdesktop-make-dist-dir/rdesktop-$(VERSION) /tmp/rdesktop-make-dist-dir/rdesktop
ls /tmp/rdesktop-make-dist-dir/rdesktop
tar zcvf $@ -C /tmp/rdesktop-make-dist-dir rdesktop
rm -rf /tmp/rdesktop-make-dist-dir
Makefile: Makefile.in configure
./config.status
configure: configure.ac
./bootstrap
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
.PHONY: doc/AUTHORS
doc/AUTHORS:
./genauthors *.c
==========================================
rdesktop: A Remote Desktop Protocol client
==========================================
rdesktop is an open source client for Microsoft's RDP protocol. It is
known to work with Windows versions such as NT 4 Terminal Server,
2000, XP, 2003, 2003 R2, Vista, 2008, 7, and 2008 R2. rdesktop
currently implements the RDP version 4 and 5 protocols.
Installation
------------
rdesktop uses a GNU-style build procedure. Typically all that is necessary
to install rdesktop is the following::
% ./configure
% make
% make install
The default is to install under /usr/local. This can be changed by adding
--prefix=directory to the configure line.
Note for Subversion users
-------------------------
If you have downloaded a snapshot of rdesktop using Subversion, you
will first need to run ./bootstrap in order to generate the build
infrastructure. This is not necessary for release versions of
rdesktop.
Invocation
----------
Simply run::
% rdesktop server
where server is the name of the Terminal Services machine. (If you receive
"Connection refused", this probably means that the server does not have
Terminal Services enabled, or there is a firewall blocking access.)
You can also specify a number of options on the command line. These are listed
in the rdesktop manual page (run "man rdesktop").
Smart-card support notes
------------------------
The smart-card support module uses PCSC-lite. You should use PCSC-lite 1.2.9 or
later.
To enable smart-card support in the rdesktop just run "./configure" with the
"--enable-smartcard" option. Also you can enable smart-card debug with
additional "--with-debug-smartcard" option.
This diff is collapsed.
#!/bin/sh
rm -rf autom4te.cache
autoreconf -i
This diff is collapsed.
/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Protocol services - Virtual channels
Copyright 2003 Erik Forsberg <forsberg@cendio.se> for Cendio AB
Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rdesktop.h"
#define MAX_CHANNELS 6
#define CHANNEL_CHUNK_LENGTH 1600
#define CHANNEL_FLAG_FIRST 0x01
#define CHANNEL_FLAG_LAST 0x02
#define CHANNEL_FLAG_SHOW_PROTOCOL 0x10
extern RD_BOOL g_use_rdp5;
extern RD_BOOL g_encryption;
VCHANNEL g_channels[MAX_CHANNELS];
unsigned int g_num_channels;
/* FIXME: We should use the information in TAG_SRV_CHANNELS to map RDP5
channels to MCS channels.
The format of TAG_SRV_CHANNELS seems to be
global_channel_no (uint16le)
number_of_other_channels (uint16le)
..followed by uint16les for the other channels.
*/
VCHANNEL *
channel_register(char *name, uint32 flags, void (*callback) (STREAM))
{
VCHANNEL *channel;
if (!g_use_rdp5)
return NULL;
if (g_num_channels >= MAX_CHANNELS)
{
error("Channel table full, increase MAX_CHANNELS\n");
return NULL;
}
channel = &g_channels[g_num_channels];
channel->mcs_id = MCS_GLOBAL_CHANNEL + 1 + g_num_channels;
strncpy(channel->name, name, 8);
channel->flags = flags;
channel->process = callback;
g_num_channels++;
return channel;
}
STREAM
channel_init(VCHANNEL * channel, uint32 length)
{
STREAM s;
s = sec_init(g_encryption ? SEC_ENCRYPT : 0, length + 8);
s_push_layer(s, channel_hdr, 8);
return s;
}
void
channel_send(STREAM s, VCHANNEL * channel)
{
uint32 length, flags;
uint32 thislength, remaining;
uint8 *data;
#ifdef WITH_SCARD
scard_lock(SCARD_LOCK_CHANNEL);
#endif
/* first fragment sent in-place */
s_pop_layer(s, channel_hdr);
length = s->end - s->p - 8;
DEBUG_CHANNEL(("channel_send, length = %d\n", length));
thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
/* Note: In the original clipboard implementation, this number was
1592, not 1600. However, I don't remember the reason and 1600 seems
to work so.. This applies only to *this* length, not the length of
continuation or ending packets. */
remaining = length - thislength;
flags = (remaining == 0) ? CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST : CHANNEL_FLAG_FIRST;
if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
out_uint32_le(s, length);
out_uint32_le(s, flags);
data = s->end = s->p + thislength;
DEBUG_CHANNEL(("Sending %d bytes with FLAG_FIRST\n", thislength));
sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
/* subsequent segments copied (otherwise would have to generate headers backwards) */
while (remaining > 0)
{
thislength = MIN(remaining, CHANNEL_CHUNK_LENGTH);
remaining -= thislength;
flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0;
if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
DEBUG_CHANNEL(("Sending %d bytes with flags %d\n", thislength, flags));
s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);
out_uint32_le(s, length);
out_uint32_le(s, flags);
out_uint8p(s, data, thislength);
s_mark_end(s);
sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
data += thislength;
}
#ifdef WITH_SCARD
scard_unlock(SCARD_LOCK_CHANNEL);
#endif
}
void
channel_process(STREAM s, uint16 mcs_channel)
{
uint32 length, flags;
uint32 thislength;
VCHANNEL *channel = NULL;
unsigned int i;
STREAM in;
for (i = 0; i < g_num_channels; i++)
{
channel = &g_channels[i];
if (channel->mcs_id == mcs_channel)
break;
}
if (i >= g_num_channels)
return;
in_uint32_le(s, length);
in_uint32_le(s, flags);
if ((flags & CHANNEL_FLAG_FIRST) && (flags & CHANNEL_FLAG_LAST))
{
/* single fragment - pass straight up */
channel->process(s);
}
else
{
/* add fragment to defragmentation buffer */
in = &channel->in;
if (flags & CHANNEL_FLAG_FIRST)
{
if (length > in->size)
{
in->data = (uint8 *) xrealloc(in->data, length);
in->size = length;
}
in->p = in->data;
}
thislength = MIN(s->end - s->p, in->data + in->size - in->p);
memcpy(in->p, s->p, thislength);
in->p += thislength;
if (flags & CHANNEL_FLAG_LAST)
{
in->end = in->p;
in->p = in->data;
channel->process(in);
}
}
}
/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Protocol services - Clipboard functions
Copyright 2003 Erik Forsberg <forsberg@cendio.se> for Cendio AB
Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rdesktop.h"
#define CLIPRDR_CONNECT 1
#define CLIPRDR_FORMAT_ANNOUNCE 2
#define CLIPRDR_FORMAT_ACK 3
#define CLIPRDR_DATA_REQUEST 4
#define CLIPRDR_DATA_RESPONSE 5
#define CLIPRDR_REQUEST 0
#define CLIPRDR_RESPONSE 1
#define CLIPRDR_ERROR 2
static VCHANNEL *cliprdr_channel;
static uint8 *last_formats = NULL;
static uint32 last_formats_length = 0;
static void
cliprdr_send_packet(uint16 type, uint16 status, uint8 * data, uint32 length)
{
STREAM s;
DEBUG_CLIPBOARD(("CLIPRDR send: type=%d, status=%d, length=%d\n", type, status, length));
s = channel_init(cliprdr_channel, length + 12);
out_uint16_le(s, type);
out_uint16_le(s, status);
out_uint32_le(s, length);
out_uint8p(s, data, length);
out_uint32(s, 0); /* pad? */
s_mark_end(s);
channel_send(s, cliprdr_channel);
}
/* Helper which announces our readiness to supply clipboard data
in a single format (such as CF_TEXT) to the RDP side.
To announce more than one format at a time, use
cliprdr_send_native_format_announce.
*/
void
cliprdr_send_simple_native_format_announce(uint32 format)
{
uint8 buffer[36];
DEBUG_CLIPBOARD(("cliprdr_send_simple_native_format_announce\n"));
buf_out_uint32(buffer, format);
memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */
cliprdr_send_native_format_announce(buffer, sizeof(buffer));
}
/* Announces our readiness to supply clipboard data in multiple
formats, each denoted by a 36-byte format descriptor of
[ uint32 format + 32-byte description ].
*/
void
cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length)
{
DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n"));
cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data,
formats_data_length);
if (formats_data != last_formats)
{
if (last_formats)
xfree(last_formats);
last_formats = xmalloc(formats_data_length);
memcpy(last_formats, formats_data, formats_data_length);
last_formats_length = formats_data_length;
}
}
void
cliprdr_send_data_request(uint32 format)
{
uint8 buffer[4];
DEBUG_CLIPBOARD(("cliprdr_send_data_request\n"));
buf_out_uint32(buffer, format);
cliprdr_send_packet(CLIPRDR_DATA_REQUEST, CLIPRDR_REQUEST, buffer, sizeof(buffer));
}
void
cliprdr_send_data(uint8 * data, uint32 length)
{
DEBUG_CLIPBOARD(("cliprdr_send_data\n"));
cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length);
}
static void
cliprdr_process(STREAM s)
{
uint16 type, status;
uint32 length, format;
uint8 *data;
in_uint16_le(s, type);
in_uint16_le(s, status);
in_uint32_le(s, length);
data = s->p;
DEBUG_CLIPBOARD(("CLIPRDR recv: type=%d, status=%d, length=%d\n", type, status, length));
if (status == CLIPRDR_ERROR)
{
switch (type)
{
case CLIPRDR_FORMAT_ACK:
/* FIXME: We seem to get this when we send an announce while the server is
still processing a paste. Try sending another announce. */
cliprdr_send_native_format_announce(last_formats,
last_formats_length);
break;
case CLIPRDR_DATA_RESPONSE:
ui_clip_request_failed();
break;
default:
DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type));
}
return;
}
switch (type)
{
case CLIPRDR_CONNECT:
ui_clip_sync();
break;
case CLIPRDR_FORMAT_ANNOUNCE:
ui_clip_format_announce(data, length);
cliprdr_send_packet(CLIPRDR_FORMAT_ACK, CLIPRDR_RESPONSE, NULL, 0);
return;
case CLIPRDR_FORMAT_ACK:
break;
case CLIPRDR_DATA_REQUEST:
in_uint32_le(s, format);
ui_clip_request_data(format);
break;
case CLIPRDR_DATA_RESPONSE:
ui_clip_handle_data(data, length);
break;
case 7: /* TODO: W2K3 SP1 sends this on connect with a value of 1 */
break;
default:
unimpl("CLIPRDR packet type %d\n", type);
}
}
void
cliprdr_set_mode(const char *optarg)
{
ui_clip_set_mode(optarg);
}
RD_BOOL
cliprdr_init(void)
{
cliprdr_channel =
channel_register("cliprdr",
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL,
cliprdr_process);
return (cliprdr_channel != NULL);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* *INDENT-OFF* */