xrdp server

This commit is contained in:
Georgy Kovtunov
2012-02-04 12:15:08 +04:00
parent ce1bca1b79
commit 8ae88a4ba9
17 changed files with 636 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# use the gentoo startDM to start the default WM
#
# see /usr/share/doc/xrdp-version/startwm.sh for the factory version of this
# script.
source /etc/rc.conf
/etc/X11/Sessions/"${XSESSION}"

View File

@@ -0,0 +1,50 @@
diff -ur xrdp-0.3.1.orig/sesman/Makefile xrdp-0.3.1/sesman/Makefile
--- xrdp-0.3.1.orig/sesman/Makefile 2006-08-01 19:35:48.000000000 -0400
+++ xrdp-0.3.1/sesman/Makefile 2006-08-01 20:48:52.000000000 -0400
@@ -13,7 +13,8 @@
DOCDIR = /usr/doc/xrdp
DEFINES = -DSESMAN_CFG_FILE=\"$(CFGDIR)/sesman.ini\" \
- -DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\"
+ -DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\" \
+ -DSESMAN_DESTDIR=\"$(DESTDIR)\"
CFLAGS = $(MYCFLAGS) -I../common $(DEFINES)
LDFLAGS = -L /usr/gnu/lib $(DEFINES)
diff -ur xrdp-0.3.1.orig/sesman/sesman.c xrdp-0.3.1/sesman/sesman.c
--- xrdp-0.3.1.orig/sesman/sesman.c 2006-08-01 19:35:48.000000000 -0400
+++ xrdp-0.3.1/sesman/sesman.c 2006-08-01 20:48:15.000000000 -0400
@@ -137,6 +137,8 @@
int pid;
char pid_s[8];
+ chdir(SESMAN_DESTDIR);
+
if (1 == argc)
{
/* no options on command line. normal startup */
diff -ur xrdp-0.3.1.orig/xrdp/Makefile xrdp-0.3.1/xrdp/Makefile
--- xrdp-0.3.1.orig/xrdp/Makefile 2006-08-01 19:35:48.000000000 -0400
+++ xrdp-0.3.1/xrdp/Makefile 2006-08-01 19:56:15.000000000 -0400
@@ -12,7 +12,8 @@
DOCDIR = /usr/doc/xrdp
DEFINES = -DXRDP_CFG_FILE=\"$(CFGDIR)/xrdp.ini\" \
- -DXRDP_PID_FILE=\"$(PIDDIR)/xrdp.pid\"
+ -DXRDP_PID_FILE=\"$(PIDDIR)/xrdp.pid\" \
+ -DXRDP_DESTDIR=\"$(DESTDIR)\"
CFLAGS = $(MYCFLAGS) -I../common -I../libxrdp $(DEFINES)
#CFLAGS += -DXRDP_DEBUG
diff -ur xrdp-0.3.1.orig/xrdp/xrdp.c xrdp-0.3.1/xrdp/xrdp.c
--- xrdp-0.3.1.orig/xrdp/xrdp.c 2006-08-01 19:35:48.000000000 -0400
+++ xrdp-0.3.1/xrdp/xrdp.c 2006-08-01 19:55:45.000000000 -0400
@@ -291,6 +291,8 @@
char text[32];
#endif
+ chdir(XRDP_DESTDIR);
+
/* check compiled endian with actual endian */
test = 1;
host_be = !((int)(*(unsigned char*)(&test)));

View File

@@ -0,0 +1,72 @@
diff -ur xrdp-0.3.1.orig/libxrdp/Makefile xrdp-0.3.1/libxrdp/Makefile
--- xrdp-0.3.1.orig/libxrdp/Makefile 2006-03-12 19:58:12.000000000 -0500
+++ xrdp-0.3.1/libxrdp/Makefile 2006-08-01 16:44:51.000000000 -0400
@@ -13,7 +13,7 @@
DEFINES = -DXRDP_CFG_FILE=\"$(CFGDIR)/xrdp.ini\" \
-DXRDP_KEY_FILE=\"$(CFGDIR)/rsakeys.ini\"
-CFLAGS = -Wall -O2 -I../common -fPIC $(DEFINES)
+CFLAGS = $(MYCFLAGS) -I../common -fPIC $(DEFINES)
#CFLAGS += -DXRDP_DEBUG
C_OS_FLAGS = $(CFLAGS) -c
LDFLAGS = -shared
diff -ur xrdp-0.3.1.orig/rdp/Makefile xrdp-0.3.1/rdp/Makefile
--- xrdp-0.3.1.orig/rdp/Makefile 2006-03-03 20:02:04.000000000 -0500
+++ xrdp-0.3.1/rdp/Makefile 2006-08-01 16:44:51.000000000 -0400
@@ -10,7 +10,7 @@
DEFINES =
-CFLAGS = -Wall -O2 -I../common -fPIC $(DEFINES)
+CFLAGS = $(MYCFLAGS) -I../common -fPIC $(DEFINES)
#CFLAGS += -DXRDP_DEBUG
C_OS_FLAGS = $(CFLAGS) -c
LDFLAGS = -shared
diff -ur xrdp-0.3.1.orig/sesman/Makefile xrdp-0.3.1/sesman/Makefile
--- xrdp-0.3.1.orig/sesman/Makefile 2006-05-26 09:10:14.000000000 -0400
+++ xrdp-0.3.1/sesman/Makefile 2006-08-01 16:44:51.000000000 -0400
@@ -15,7 +15,7 @@
DEFINES = -DSESMAN_CFG_FILE=\"$(CFGDIR)/sesman.ini\" \
-DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\"
-CFLAGS = -Wall -O2 -I../common $(DEFINES)
+CFLAGS = $(MYCFLAGS) -I../common $(DEFINES)
LDFLAGS = -L /usr/gnu/lib $(DEFINES)
C_OS_FLAGS = $(CFLAGS) -c
CC = gcc
diff -ur xrdp-0.3.1.orig/vnc/Makefile xrdp-0.3.1/vnc/Makefile
--- xrdp-0.3.1.orig/vnc/Makefile 2006-03-03 20:02:06.000000000 -0500
+++ xrdp-0.3.1/vnc/Makefile 2006-08-01 16:44:51.000000000 -0400
@@ -9,7 +9,7 @@
DEFINES =
-CFLAGS = -Wall -O2 -I../common -fPIC $(DEFINES)
+CFLAGS = $(MYCFLAGS) -I../common -fPIC $(DEFINES)
C_OS_FLAGS = $(CFLAGS) -c
LDFLAGS = -shared
LIBS = -ldl
diff -ur xrdp-0.3.1.orig/xrdp/Makefile xrdp-0.3.1/xrdp/Makefile
--- xrdp-0.3.1.orig/xrdp/Makefile 2006-03-03 20:02:08.000000000 -0500
+++ xrdp-0.3.1/xrdp/Makefile 2006-08-01 16:44:51.000000000 -0400
@@ -14,7 +14,7 @@
DEFINES = -DXRDP_CFG_FILE=\"$(CFGDIR)/xrdp.ini\" \
-DXRDP_PID_FILE=\"$(PIDDIR)/xrdp.pid\"
-CFLAGS = -Wall -O2 -I../common -I../libxrdp $(DEFINES)
+CFLAGS = $(MYCFLAGS) -I../common -I../libxrdp $(DEFINES)
#CFLAGS += -DXRDP_DEBUG
C_OS_FLAGS = $(CFLAGS) -c
LDFLAGS = -L/usr/gnu/lib -L../libxrdp -Wl,-rpath,.
diff -ur xrdp-0.3.1.orig/xup/Makefile xrdp-0.3.1/xup/Makefile
--- xrdp-0.3.1.orig/xup/Makefile 2006-03-03 20:02:09.000000000 -0500
+++ xrdp-0.3.1/xup/Makefile 2006-08-01 16:44:51.000000000 -0400
@@ -9,7 +9,7 @@
DEFINES =
-CFLAGS = -Wall -O2 -I../common -fPIC $(DEFINES)
+CFLAGS = $(MYCFLAGS) -I../common -fPIC $(DEFINES)
#CFLAGS += -DXRDP_DEBUG
C_OS_FLAGS = $(CFLAGS) -c
LDFLAGS = -shared

View File

@@ -0,0 +1,50 @@
diff -ur xrdp-0.4.0.orig/sesman/Makefile xrdp-0.4.0/sesman/Makefile
--- xrdp-0.4.0.orig/sesman/Makefile 2008-04-02 15:43:01.000000000 +0200
+++ xrdp-0.4.0/sesman/Makefile 2008-04-02 16:08:34.000000000 +0200
@@ -14,7 +14,8 @@
DEFINES = -DSESMAN_CFG_FILE=\"$(CFGDIR)/sesman.ini\" \
-DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\" \
- -DSESMAN_SESSVC_FILE=\"sessvc\"
+ -DSESMAN_SESSVC_FILE=\"sessvc\" \
+ -DSESMAN_DESTDIR=\"$(DESTDIR)\"
CFLAGS = $(MYCFLAGS) -I../common -I/usr/include/nptl -I./libscp $(DEFINES)
LDFLAGS = -L/usr/gnu/lib -L/usr/lib/nptl -L./libscp -Wl,-rpath,. -lpthread -ldl -lscp
diff -ur xrdp-0.3.1.orig/sesman/sesman.c xrdp-0.3.1/sesman/sesman.c
--- xrdp-0.3.1.orig/sesman/sesman.c 2006-08-01 19:35:48.000000000 -0400
+++ xrdp-0.3.1/sesman/sesman.c 2006-08-01 20:48:15.000000000 -0400
@@ -137,6 +137,8 @@
int pid;
char pid_s[8];
+ chdir(SESMAN_DESTDIR);
+
if (1 == argc)
{
/* no options on command line. normal startup */
diff -ur xrdp-0.3.1.orig/xrdp/Makefile xrdp-0.3.1/xrdp/Makefile
--- xrdp-0.3.1.orig/xrdp/Makefile 2006-08-01 19:35:48.000000000 -0400
+++ xrdp-0.3.1/xrdp/Makefile 2006-08-01 19:56:15.000000000 -0400
@@ -12,7 +12,8 @@
DOCDIR = /usr/doc/xrdp
DEFINES = -DXRDP_CFG_FILE=\"$(CFGDIR)/xrdp.ini\" \
- -DXRDP_PID_FILE=\"$(PIDDIR)/xrdp.pid\"
+ -DXRDP_PID_FILE=\"$(PIDDIR)/xrdp.pid\" \
+ -DXRDP_DESTDIR=\"$(DESTDIR)\"
CFLAGS = $(MYCFLAGS) -I../common -I../libxrdp $(DEFINES)
#CFLAGS += -DXRDP_DEBUG
diff -ur xrdp-0.3.1.orig/xrdp/xrdp.c xrdp-0.3.1/xrdp/xrdp.c
--- xrdp-0.3.1.orig/xrdp/xrdp.c 2006-08-01 19:35:48.000000000 -0400
+++ xrdp-0.3.1/xrdp/xrdp.c 2006-08-01 19:55:45.000000000 -0400
@@ -291,6 +291,8 @@
char text[32];
#endif
+ chdir(XRDP_DESTDIR);
+
/* check compiled endian with actual endian */
test = 1;
host_be = !((int)(*(unsigned char*)(&test)));

View File

@@ -0,0 +1,8 @@
--- xrdp/instfiles/Makefile.am.orig 2009-09-22 18:01:52.000000000 +0400
+++ xrdp/instfiles/Makefile.am 2009-09-22 18:02:14.000000000 +0400
@@ -17,3 +17,5 @@
# if [ -w /etc/init.d ]; then rm -f /etc/init.d/xrdp.sh; fi
# if [ -w /etc/init.d ]; then $(LN_S) $(DESTDIR)$(sysconfdir)/xrdp/xrdp.sh /etc/init.d/xrdp.sh; fi
# $(DESTDIR)$(bindir)/xrdp-keygen xrdp $(DESTDIR)$(sysconfdir)/xrdp/rsakeys.ini
+ mkdir -p $(DESTDIR)$(sysconfdir)/init.d
+ $(LN_S) $(DESTDIR)$(sysconfdir)/xrdp/xrdp.sh $(DESTDIR)$(sysconfdir)/init.d/xrdp.sh

View File

@@ -0,0 +1,11 @@
--- xrdp/instfiles/Makefile.am~ 2009-05-13 01:28:31.000000000 +0930
+++ xrdp/instfiles/Makefile.am 2009-05-13 01:29:57.033945790 +0930
@@ -10,6 +10,5 @@
# must be tab below
install-data-hook:
chmod 755 $(DESTDIR)$(sysconfdir)/xrdp/xrdp.sh
- if [ -w /etc/init.d ]; then rm -f /etc/init.d/xrdp.sh; fi
- if [ -w /etc/init.d ]; then $(LN_S) $(DESTDIR)$(sysconfdir)/xrdp/xrdp.sh /etc/init.d/xrdp.sh; fi
- $(DESTDIR)$(bindir)/xrdp-keygen xrdp $(DESTDIR)$(sysconfdir)/xrdp/rsakeys.ini
+ mkdir -p $(DESTDIR)$(sysconfdir)/init.d
+ $(LN_S) $(DESTDIR)$(sysconfdir)/xrdp/xrdp.sh $(DESTDIR)$(sysconfdir)/init.d/xrdp.sh

View File

@@ -0,0 +1,12 @@
--- xrdp/sesman/tools/Makefile.am.orig 2009-05-13 02:56:04.393945494 +0930
+++ xrdp/sesman/tools/Makefile.am 2009-05-13 02:56:14.697945849 +0930
@@ -10,8 +10,8 @@
xrdp_sesrun_SOURCES = \
sesrun.c \
tcp.c \
- config.c
+ ../config.c
xrdp_sestest_SOURCES = \
sestest.c

View File

@@ -0,0 +1,85 @@
--- xrdp/xrdp/xrdp_login_wnd.c.orig 2009-05-28 19:26:05.000000000 +0930
+++ xrdp/xrdp/xrdp_login_wnd.c 2009-05-28 19:30:37.000000000 +0930
@@ -386,6 +386,8 @@
int fd;
int i;
int j;
+ int k = 0; // real number of the items in the list
+ int h = 0; // is the current item hidden?
char* p;
char* q;
char* r;
@@ -411,26 +413,58 @@
}
else
{
- g_strncpy(name, p, 255);
- mod_data = (struct xrdp_mod_data*)
- g_malloc(sizeof(struct xrdp_mod_data), 1);
- mod_data->names = list_create();
- mod_data->names->auto_free = 1;
- mod_data->values = list_create();
- mod_data->values->auto_free = 1;
- for (j = 0; j < section_names->count; j++)
- {
+ // check to see if this is a hidden item
+ // do this early so we don't need to mess around freeing memory
+ for (j = 0; j < section_names->count; j++) {
q = (char*)list_get_item(section_names, j);
r = (char*)list_get_item(section_values, j);
- if (g_strncmp("name", q, 255) == 0)
+ if (g_strncmp("hidden", q, 255) == 0)
{
- g_strncpy(name, r, 255);
+ if (g_strncmp("yes", r, 255) == 0) {
+ h = 1;
+ break;
+ }
}
- list_add_item(mod_data->names, (long)g_strdup(q));
- list_add_item(mod_data->values, (long)g_strdup(r));
}
- list_add_item(b->string_list, (long)g_strdup(name));
- list_add_item(b->data_list, (long)mod_data);
+
+ if (h == 1) {
+ // yup, hidden, reset state
+ h = 0;
+ } else {
+ // not hidden
+ g_strncpy(name, p, 255);
+ mod_data = (struct xrdp_mod_data*)
+ g_malloc(sizeof(struct xrdp_mod_data), 1);
+ mod_data->names = list_create();
+ mod_data->names->auto_free = 1;
+ mod_data->values = list_create();
+ mod_data->values->auto_free = 1;
+ for (j = 0; j < section_names->count; j++)
+ {
+ q = (char*)list_get_item(section_names, j);
+ r = (char*)list_get_item(section_values, j);
+ if (g_strncmp("name", q, 255) == 0)
+ {
+ g_strncpy(name, r, 255);
+ }
+ list_add_item(mod_data->names, (long)g_strdup(q));
+ list_add_item(mod_data->values, (long)g_strdup(r));
+ }
+
+ list_add_item(b->string_list, (long)g_strdup(name));
+ list_add_item(b->data_list, (long)mod_data);
+
+ if (g_strncmp(self->session->client_info->domain, p, 255) == 0) {
+ // "domain" matches this module's name. change the default selected item to this.
+ // normally this only applies to autologin. now this applies it in non-auto mode
+ //
+ // we can't use (i) here as that is the index of the section in the ini, not the index of
+ // the current item in the combobox.
+ b->item_index = k;
+ }
+
+ k++;
+ }
}
}
g_file_close(fd);

View File

@@ -0,0 +1,35 @@
--- xrdp/xrdp/xrdp_wm.c.orig 2009-05-28 18:41:18.000000000 +0930
+++ xrdp/xrdp/xrdp_wm.c 2009-05-28 18:44:55.000000000 +0930
@@ -412,14 +412,30 @@
if (g_strncmp("password", q, 255) == 0)
{
list_add_item(self->mm->login_names, (long)g_strdup("password"));
- list_add_item(self->mm->login_values,
+ if (g_strncmp("ask", r, 255) != 0) {
+ // the password has been manually set in the config, use that
+ // instead of what the client says.
+ list_add_item(self->mm->login_values, (long)g_strdup(r));
+ } else {
+ // the password has been asked for by the module, use what the
+ // client says.
+ list_add_item(self->mm->login_values,
(long)g_strdup(self->session->client_info->password));
+ }
}
else if (g_strncmp("username", q, 255) == 0)
{
list_add_item(self->mm->login_names, (long)g_strdup("username"));
- list_add_item(self->mm->login_values,
+ if (g_strncmp("ask", r, 255) != 0) {
+ // the username has been manually set in the config, user that
+ // instead of what the client says.
+ list_add_item(self->mm->login_values, (long)g_strdup(r));
+ } else {
+ // the username has been asked for by the module, use what the
+ // client says.
+ list_add_item(self->mm->login_values,
(long)g_strdup(self->session->client_info->username));
+ }
}
else
{

View File

@@ -0,0 +1,5 @@
# /etc/conf.d/xrdp
# logfile locations for xrdp and sesman
XRDP_LOGFILE="/var/log/xrdp/xrdp.log"
SESMAN_LOGFILE="/var/log/xrdp/sesman.log"

View File

@@ -0,0 +1,5 @@
# /etc/conf.d/xrdp
# logfile locations for xrdp and sesman
XRDP_LOGFILE="/var/log/xrdp/xrdp.log"
SESMAN_LOGFILE="/var/log/xrdp/sesman.log"

View File

@@ -0,0 +1,36 @@
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/xrdp/files/xrdp-initd,v 1.1 2006/08/02 00:58:36 chutzpah Exp $
depend() {
use net logger
}
start() {
cd /usr/LIBDIR/xrdp
ebegin "Starting X remote desktop daemon"
start-stop-daemon --start --pidfile /var/run/xrdp.pid --exec /usr/LIBDIR/xrdp/xrdp -- >> ${XRDP_LOGFILE}
ret=${?}
eend ${ret}
[[ ${ret} != 0 ]] && return ${ret}
ebegin "Starting remote desktop session manager"
start-stop-daemon --start --pidfile /var/run/sesman.pid --exec /usr/LIBDIR/xrdp/sesman >> ${SESMAN_LOGFILE}
ret=${?}
eend ${ret}
return ${ret}
}
stop() {
ebegin "Stopping X remote desktop daemon"
start-stop-daemon --stop --pidfile /var/run/xrdp.pid
ret=${?}
eend ${ret}
ebegin "Stopping remote desktop session manager"
start-stop-daemon --stop --pidfile /var/run/sesman.pid
ret=${?}
eend ${ret}
return ${ret}
}

View File

@@ -0,0 +1,36 @@
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/xrdp/files/xrdp-initd,v 1.1 2006/08/02 00:58:36 chutzpah Exp $
depend() {
use net logger
}
start() {
cd /usr/LIBDIR/xrdp
ebegin "Starting X remote desktop daemon"
start-stop-daemon --start --pidfile /var/run/xrdp.pid --exec /usr/sbin/xrdp -- >> ${XRDP_LOGFILE}
ret=${?}
eend ${ret}
[[ ${ret} != 0 ]] && return ${ret}
ebegin "Starting remote desktop session manager"
start-stop-daemon --start --pidfile /var/run/xrdp-sesman.pid --exec /usr/sbin/xrdp-sesman >> ${SESMAN_LOGFILE}
ret=${?}
eend ${ret}
return ${ret}
}
stop() {
ebegin "Stopping X remote desktop daemon"
start-stop-daemon --stop --pidfile /var/run/xrdp.pid
ret=${?}
eend ${ret}
ebegin "Stopping remote desktop session manager"
start-stop-daemon --stop --pidfile /var/run/xrdp-sesman.pid
ret=${?}
eend ${ret}
return ${ret}
}

View File

@@ -0,0 +1,53 @@
[globals]
bitmap_cache=yes
bitmap_compression=yes
port=3389
crypt_level=low
channel_code=1
[xrdp1]
name=sesman-Xvnc
lib=/usr/lib/xrdp/libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
[xrdp2]
name=console
lib=/usr/lib/xrdp/libvnc.so
ip=127.0.0.1
port=5900
username=na
password=ask
[xrdp3]
name=vnc-any
lib=/usr/lib/xrdp/libvnc.so
ip=ask
port=ask5900
username=na
password=ask
[xrdp4]
name=sesman-any
lib=/usr/lib/xrdp/libvnc.so
ip=ask
port=-1
username=ask
password=ask
[xrdp5]
name=rdp-any
lib=/usr/lib/xrdp/librdp.so
ip=ask
port=ask3389
[xrdp6]
name=sesman-X11rdp
lib=/usr/lib/xrdp/libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1