From 6e3b7245aad0a768eecc66d52c4e32a6af8a7280 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 1 Aug 2013 20:28:10 -0700 Subject: xorg driver, work on client connection --- xorg/server/module/rdpClientCon.c | 63 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) (limited to 'xorg/server/module/rdpClientCon.c') diff --git a/xorg/server/module/rdpClientCon.c b/xorg/server/module/rdpClientCon.c index 5a5a4551..44ab97ff 100644 --- a/xorg/server/module/rdpClientCon.c +++ b/xorg/server/module/rdpClientCon.c @@ -47,7 +47,24 @@ Client connection to xrdp static int rdpClientConGotConnection(ScreenPtr pScreen, rdpPtr dev) { + rdpClientCon *clientCon; + LLOGLN(0, ("rdpClientConGotConnection:")); + clientCon = (rdpClientCon *) g_malloc(sizeof(rdpClientCon), 1); + make_stream(clientCon->in_s); + init_stream(clientCon->in_s, 8192); + make_stream(clientCon->out_s); + init_stream(clientCon->out_s, 8192 * 4 + 100); + if (dev->clientConTail == NULL) + { + dev->clientConHead = clientCon; + dev->clientConTail = clientCon; + } + else + { + dev->clientConTail->next = clientCon; + dev->clientConTail = clientCon; + } return 0; } @@ -102,7 +119,7 @@ rdpClientConCheck(ScreenPtr pScreen) FD_SET(LTOUI32(dev->listen_sck), &rfds); max = RDPMAX(dev->listen_sck, max); } - clientCon = dev->clientCon; + clientCon = dev->clientConHead; while (clientCon != NULL) { if (clientCon->sck > 0) @@ -145,7 +162,7 @@ rdpClientConCheck(ScreenPtr pScreen) rdpClientConGotConnection(pScreen, dev); } } - clientCon = dev->clientCon; + clientCon = dev->clientConHead; while (clientCon != NULL) { if (clientCon->sck > 0) @@ -173,3 +190,45 @@ rdpClientConCheck(ScreenPtr pScreen) } return 0; } + +/******************************************************************************/ +int +rdpClientConInit(rdpPtr dev) +{ + char text[256]; + int i; + + if (!g_directory_exist("/tmp/.xrdp")) + { + if (!g_create_dir("/tmp/.xrdp")) + { + if (!g_directory_exist("/tmp/.xrdp")) + { + LLOGLN(0, ("rdpup_init: g_create_dir failed")); + return 0; + } + } + + g_chmod_hex("/tmp/.xrdp", 0x1777); + } + + i = atoi(display); + + if (i < 1) + { + return 0; + } + g_sprintf(dev->uds_data, "/tmp/.xrdp/xrdp_display_%s", display); + if (dev->listen_sck == 0) + { + dev->listen_sck = g_tcp_local_socket_stream(); + if (g_tcp_local_bind(dev->listen_sck, dev->uds_data) != 0) + { + LLOGLN(0, ("rdpClientConInit: g_tcp_local_bind failed")); + return 1; + } + g_tcp_listen(dev->listen_sck); + AddEnabledDevice(dev->listen_sck); + } + return 0; +} -- cgit v1.2.1