Merge branch 'devel' of github.com:/neutrinolabs/xrdp into devel

ulab-next
Laxmikant Rashinkar 11 years ago
commit c5c8324d91

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,6 +20,11 @@
* put all the os / arch define in here you want * put all the os / arch define in here you want
*/ */
/* To test for Windows (64 bit or 32 bit) use _WIN32 and _WIN64 in addition
for 64 bit windows. _WIN32 is defined for both.
To test for Linux use __linux__.
To test for BSD use BSD */
#if defined(HAVE_CONFIG_H) #if defined(HAVE_CONFIG_H)
#include "config_ac.h" #include "config_ac.h"
#endif #endif
@ -60,6 +65,13 @@
#include <stdio.h> #include <stdio.h>
#include <locale.h> #include <locale.h>
/* this is so we can use #ifdef BSD later */
/* This is the recommended way of detecting BSD in the
FreeBSD Porter's Handbook. */
#if (defined(__unix__) || defined(unix)) && !defined(USG)
#include <sys/param.h>
#endif
#include "os_calls.h" #include "os_calls.h"
#include "arch.h" #include "arch.h"
#include "log.h" #include "log.h"
@ -596,10 +608,16 @@ g_tcp_local_socket(void)
} }
/*****************************************************************************/ /*****************************************************************************/
/* returns error */
int APP_CC int APP_CC
g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid) g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid)
{ {
#if defined(SO_PEERCRED)
#if defined(_WIN32)
int ucred_length; int ucred_length;
#else
unsigned int ucred_length;
#endif
struct myucred struct myucred
{ {
pid_t pid; pid_t pid;
@ -625,6 +643,9 @@ g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid)
*gid = credentials.gid; *gid = credentials.gid;
} }
return 0; return 0;
#else
return 1;
#endif
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3122,15 +3143,33 @@ g_text2bool(const char *s)
} }
/*****************************************************************************/ /*****************************************************************************/
/* returns pointer or nil on error */
void * APP_CC void * APP_CC
g_shmat(int shmid) g_shmat(int shmid)
{ {
#if defined(_WIN32)
return 0;
#else
return shmat(shmid, 0, 0); return shmat(shmid, 0, 0);
#endif
} }
/*****************************************************************************/ /*****************************************************************************/
/* returns -1 on error 0 on success */
int APP_CC int APP_CC
g_shmdt(const void *shmaddr) g_shmdt(const void *shmaddr)
{ {
#if defined(_WIN32)
return -1;
#else
return shmdt(shmaddr); return shmdt(shmaddr);
#endif
}
/*****************************************************************************/
/* returns -1 on error 0 on success */
int APP_CC
g_gethostname(char *name, int len)
{
return gethostname(name, len);
} }

@ -163,5 +163,6 @@ int APP_CC g_time3(void);
int APP_CC g_text2bool(const char *s); int APP_CC g_text2bool(const char *s);
void * APP_CC g_shmat(int shmid); void * APP_CC g_shmat(int shmid);
int APP_CC g_shmdt(const void *shmaddr); int APP_CC g_shmdt(const void *shmaddr);
int APP_CC g_gethostname(char *name, int len);
#endif #endif

@ -1,6 +1,7 @@
CFLAGS = -O2 -Wall -I../../common
LDFLAGS = -Wl CFLAGS = -O2 -Wall
OBJS = main.o ../../common/os_calls.o LDFLAGS =
OBJS = main.o
LIBS = -ldl LIBS = -ldl
all: tcp_proxy all: tcp_proxy

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,20 @@
* limitations under the License. * limitations under the License.
*/ */
#include <os_calls.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <locale.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int g_loc_io_count = 0; // bytes read from local port int g_loc_io_count = 0; // bytes read from local port
int g_rem_io_count = 0; // bytes read from remote port int g_rem_io_count = 0; // bytes read from remote port
@ -24,6 +37,394 @@ int g_rem_io_count = 0; // bytes read from remote port
static int g_terminated = 0; static int g_terminated = 0;
static char g_buf[1024 * 32]; static char g_buf[1024 * 32];
#define DEFAULT_CC
#define APP_CC
typedef unsigned short tui16;
/*****************************************************************************/
static void APP_CC
g_memset(void *ptr, int val, int size)
{
memset(ptr, val, size);
}
/*****************************************************************************/
static void DEFAULT_CC
g_printf(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vfprintf(stdout, format, ap);
va_end(ap);
}
/*****************************************************************************/
static void DEFAULT_CC
g_writeln(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vfprintf(stdout, format, ap);
va_end(ap);
g_printf("\n");
}
/*****************************************************************************/
static void APP_CC
g_hexdump(char *p, int len)
{
unsigned char *line;
int i;
int thisline;
int offset;
line = (unsigned char *)p;
offset = 0;
while (offset < len)
{
g_printf("%04x ", offset);
thisline = len - offset;
if (thisline > 16)
{
thisline = 16;
}
for (i = 0; i < thisline; i++)
{
g_printf("%02x ", line[i]);
}
for (; i < 16; i++)
{
g_printf(" ");
}
for (i = 0; i < thisline; i++)
{
g_printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
}
g_writeln("");
offset += thisline;
line += thisline;
}
}
/*****************************************************************************/
static int APP_CC
g_tcp_socket(void)
{
int rv;
int option_value;
unsigned int option_len;
rv = (int)socket(AF_INET, SOCK_STREAM, 0);
if (rv < 0)
{
return -1;
}
option_len = sizeof(option_value);
if (getsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char *)&option_value,
&option_len) == 0)
{
if (option_value == 0)
{
option_value = 1;
option_len = sizeof(option_value);
setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char *)&option_value,
option_len);
}
}
option_len = sizeof(option_value);
if (getsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char *)&option_value,
&option_len) == 0)
{
if (option_value < (1024 * 32))
{
option_value = 1024 * 32;
option_len = sizeof(option_value);
setsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char *)&option_value,
option_len);
}
}
return rv;
}
/*****************************************************************************/
static int APP_CC
g_tcp_set_non_blocking(int sck)
{
unsigned long i;
i = fcntl(sck, F_GETFL);
i = i | O_NONBLOCK;
fcntl(sck, F_SETFL, i);
return 0;
}
/*****************************************************************************/
static int APP_CC
g_tcp_bind(int sck, const char* port)
{
struct sockaddr_in s;
memset(&s, 0, sizeof(struct sockaddr_in));
s.sin_family = AF_INET;
s.sin_port = htons((tui16)atoi(port));
s.sin_addr.s_addr = INADDR_ANY;
return bind(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_in));
}
/*****************************************************************************/
static int APP_CC
g_tcp_listen(int sck)
{
return listen(sck, 2);
}
/*****************************************************************************/
static int APP_CC
g_tcp_select(int sck1, int sck2)
{
fd_set rfds;
struct timeval time;
int max = 0;
int rv = 0;
g_memset(&rfds, 0, sizeof(fd_set));
g_memset(&time, 0, sizeof(struct timeval));
time.tv_sec = 0;
time.tv_usec = 0;
FD_ZERO(&rfds);
if (sck1 > 0)
{
FD_SET(((unsigned int)sck1), &rfds);
}
if (sck2 > 0)
{
FD_SET(((unsigned int)sck2), &rfds);
}
max = sck1;
if (sck2 > max)
{
max = sck2;
}
rv = select(max + 1, &rfds, 0, 0, &time);
if (rv > 0)
{
rv = 0;
if (FD_ISSET(((unsigned int)sck1), &rfds))
{
rv = rv | 1;
}
if (FD_ISSET(((unsigned int)sck2), &rfds))
{
rv = rv | 2;
}
}
else
{
rv = 0;
}
return rv;
}
/*****************************************************************************/
static int APP_CC
g_tcp_recv(int sck, void *ptr, int len, int flags)
{
return recv(sck, ptr, len, flags);
}
/*****************************************************************************/
static void APP_CC
g_tcp_close(int sck)
{
if (sck == 0)
{
return;
}
close(sck);
}
/*****************************************************************************/
static int APP_CC
g_tcp_send(int sck, const void *ptr, int len, int flags)
{
return send(sck, ptr, len, flags);
}
/*****************************************************************************/
void APP_CC
g_sleep(int msecs)
{
usleep(msecs * 1000);
}
/*****************************************************************************/
static int APP_CC
g_tcp_last_error_would_block(int sck)
{
return (errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno == EINPROGRESS);
}
/*****************************************************************************/
static int APP_CC
g_tcp_accept(int sck)
{
int ret ;
struct sockaddr_in s;
unsigned int i;
i = sizeof(struct sockaddr_in);
memset(&s, 0, i);
ret = accept(sck, (struct sockaddr *)&s, &i);
return ret ;
}
/*****************************************************************************/
static int APP_CC
g_tcp_connect(int sck, const char* address, const char* port)
{
struct sockaddr_in s;
struct hostent* h;
g_memset(&s, 0, sizeof(struct sockaddr_in));
s.sin_family = AF_INET;
s.sin_port = htons((tui16)atoi(port));
s.sin_addr.s_addr = inet_addr(address);
if (s.sin_addr.s_addr == INADDR_NONE)
{
h = gethostbyname(address);
if (h != 0)
{
if (h->h_name != 0)
{
if (h->h_addr_list != 0)
{
if ((*(h->h_addr_list)) != 0)
{
s.sin_addr.s_addr = *((int*)(*(h->h_addr_list)));
}
}
}
}
}
return connect(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_in));
}
/*****************************************************************************/
static int APP_CC
g_tcp_socket_ok(int sck)
{
int opt;
unsigned int opt_len;
opt_len = sizeof(opt);
if (getsockopt(sck, SOL_SOCKET, SO_ERROR, (char *)(&opt), &opt_len) == 0)
{
if (opt == 0)
{
return 1;
}
}
return 0;
}
/*****************************************************************************/
static void APP_CC
g_init(const char *app_name)
{
setlocale(LC_CTYPE, "");
}
/*****************************************************************************/
static void APP_CC
g_deinit(void)
{
}
/*****************************************************************************/
static int APP_CC
g_tcp_can_send(int sck, int millis)
{
fd_set wfds;
struct timeval time;
int rv;
time.tv_sec = millis / 1000;
time.tv_usec = (millis * 1000) % 1000000;
FD_ZERO(&wfds);
if (sck > 0)
{
FD_SET(((unsigned int)sck), &wfds);
rv = select(sck + 1, 0, &wfds, 0, &time);
if (rv > 0)
{
return g_tcp_socket_ok(sck);
}
}
return 0;
}
/*****************************************************************************/
static void APP_CC
g_signal_user_interrupt(void (*func)(int))
{
signal(SIGINT, func);
}
/*****************************************************************************/
static void APP_CC
g_signal_kill(void (*func)(int))
{
signal(SIGKILL, func);
}
/*****************************************************************************/
static void APP_CC
g_signal_terminate(void (*func)(int))
{
signal(SIGTERM, func);
}
/*****************************************************************************/
static void APP_CC
g_signal_usr1(void (*func)(int))
{
signal(SIGUSR1, func);
}
/*****************************************************************************/
static int APP_CC
g_strcasecmp(const char *c1, const char *c2)
{
return strcasecmp(c1, c2);
}
/*****************************************************************************/ /*****************************************************************************/
static int static int
main_loop(char *local_port, char *remote_ip, char *remote_port, int hexdump) main_loop(char *local_port, char *remote_ip, char *remote_port, int hexdump)

@ -32,6 +32,27 @@ Sets up the functions
#define DEBUG_OUT(arg) ErrorF arg #define DEBUG_OUT(arg) ErrorF arg
#endif #endif
#ifndef XRDP_DISABLE_LINUX_ABSTRACT
#ifdef __linux__
#define XRDP_DISABLE_LINUX_ABSTRACT 1
#else
#define XRDP_DISABLE_LINUX_ABSTRACT 0
#endif
#endif
#if XRDP_DISABLE_LINUX_ABSTRACT
/* because including <X11/Xtrans/Xtransint.h> in problematic
* we dup a small struct
* we need to set flags to zero to turn off abstract sockets */
struct _MyXtransport
{
char *TransName;
int flags;
};
/* in xtrans-1.2.6/Xtranssock.c */
extern struct _MyXtransport _XSERVTransSocketLocalFuncs;
#endif
rdpScreenInfoRec g_rdpScreen; /* the one screen */ rdpScreenInfoRec g_rdpScreen; /* the one screen */
ScreenPtr g_pScreen = 0; ScreenPtr g_pScreen = 0;
@ -233,6 +254,16 @@ rdpDestroyColormap(ColormapPtr pColormap)
} }
#endif #endif
/******************************************************************************/
void
rdpSetUDSRights(void)
{
char unixSocketName[128];
sprintf(unixSocketName, "/tmp/.X11-unix/X%s", display);
chmod(unixSocketName, 0700);
}
/******************************************************************************/ /******************************************************************************/
/* returns boolean, true if everything is ok */ /* returns boolean, true if everything is ok */
static Bool static Bool
@ -549,6 +580,8 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
//rdpXvInit(pScreen); //rdpXvInit(pScreen);
rdpSetUDSRights();
ErrorF("rdpScreenInit: ret %d\n", ret); ErrorF("rdpScreenInit: ret %d\n", ret);
return ret; return ret;
@ -620,6 +653,11 @@ ddxProcessArgument(int argc, char **argv, int i)
void void
OsVendorInit(void) OsVendorInit(void)
{ {
#if XRDP_DISABLE_LINUX_ABSTRACT
/* turn off the Linux abstract unix doamin sockets TRANS_ABSTRACT */
/* TRANS_NOLISTEN = 1 << 3 */
_XSERVTransSocketLocalFuncs.flags = 0;
#endif
} }
/******************************************************************************/ /******************************************************************************/

@ -143,9 +143,19 @@ rdpClientConAddDirtyScreenBox(rdpPtr dev, rdpClientCon *clientCon,
int int
rdpClientConAddDirtyScreen(rdpPtr dev, rdpClientCon *clientCon, rdpClientConAddDirtyScreen(rdpPtr dev, rdpClientCon *clientCon,
int x, int y, int cx, int cy); int x, int y, int cx, int cy);
void
rdpClientConGetScreenImageRect(rdpPtr dev, rdpClientCon *clientCon,
struct image_data *id);
int int
rdpClientConAddAllReg(rdpPtr dev, RegionPtr reg, DrawablePtr pDrawable); rdpClientConAddAllReg(rdpPtr dev, RegionPtr reg, DrawablePtr pDrawable);
int int
rdpClientConAddAllBox(rdpPtr dev, BoxPtr box, DrawablePtr pDrawable); rdpClientConAddAllBox(rdpPtr dev, BoxPtr box, DrawablePtr pDrawable);
int
rdpClientConSetCursor(rdpPtr dev, rdpClientCon *clientCon,
short x, short y, char *cur_data, char *cur_mask);
int
rdpClientConSetCursorEx(rdpPtr dev, rdpClientCon *clientCon,
short x, short y, char *cur_data,
char *cur_mask, int bpp);
#endif #endif

@ -36,9 +36,50 @@ cursor
#include <fb.h> #include <fb.h>
#include <micmap.h> #include <micmap.h>
#include <mi.h> #include <mi.h>
#include <cursor.h>
#include <cursorstr.h>
#include "rdp.h" #include "rdp.h"
#include "rdpMain.h" #include "rdpMain.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
/* Copied from Xvnc/lib/font/util/utilbitmap.c */
static unsigned char g_reverse_byte[0x100] =
{
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
/******************************************************************************/ /******************************************************************************/
#define LOG_LEVEL 1 #define LOG_LEVEL 1
@ -61,12 +102,226 @@ rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
return TRUE; return TRUE;
} }
/******************************************************************************/
static int
get_pixel_safe(char *data, int x, int y, int width, int height, int bpp)
{
int start;
int shift;
int c;
unsigned int *src32;
if (x < 0)
{
return 0;
}
if (y < 0)
{
return 0;
}
if (x >= width)
{
return 0;
}
if (y >= height)
{
return 0;
}
if (bpp == 1)
{
width = (width + 7) / 8;
start = (y * width) + x / 8;
shift = x % 8;
c = (unsigned char)(data[start]);
#if (X_BYTE_ORDER == X_LITTLE_ENDIAN)
return (g_reverse_byte[c] & (0x80 >> shift)) != 0;
#else
return (c & (0x80 >> shift)) != 0;
#endif
}
else if (bpp == 32)
{
src32 = (unsigned int*)data;
return src32[y * width + x];
}
return 0;
}
/******************************************************************************/
static void
set_pixel_safe(char *data, int x, int y, int width, int height, int bpp,
int pixel)
{
int start;
int shift;
unsigned int *dst32;
if (x < 0)
{
return;
}
if (y < 0)
{
return;
}
if (x >= width)
{
return;
}
if (y >= height)
{
return;
}
if (bpp == 1)
{
width = (width + 7) / 8;
start = (y * width) + x / 8;
shift = x % 8;
if (pixel & 1)
{
data[start] = data[start] | (0x80 >> shift);
}
else
{
data[start] = data[start] & ~(0x80 >> shift);
}
}
else if (bpp == 24)
{
*(data + (3 * (y * width + x)) + 0) = pixel >> 0;
*(data + (3 * (y * width + x)) + 1) = pixel >> 8;
*(data + (3 * (y * width + x)) + 2) = pixel >> 16;
}
else if (bpp == 32)
{
dst32 = (unsigned int*)data;
dst32[y * width + x] = pixel;
}
}
/******************************************************************************/
void
rdpSpriteSetCursorCon(rdpClientCon *clientCon,
DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y)
{
char cur_data[32 * (32 * 4)];
char cur_mask[32 * (32 / 8)];
char *mask;
char *data;
int i;
int j;
int w;
int h;
int p;
int xhot;
int yhot;
int paddedRowBytes;
int fgcolor;
int bgcolor;
int bpp;
LLOGLN(10, ("rdpSpriteSetCursorCon:"));
w = pCurs->bits->width;
h = pCurs->bits->height;
if ((pCurs->bits->argb != 0) &&
(clientCon->client_info.pointer_flags & 1))
{
bpp = 32;
paddedRowBytes = PixmapBytePad(w, 32);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
data = (char *)(pCurs->bits->argb);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
{
for (i = 0; i < 32; i++)
{
p = get_pixel_safe(data, i, j, paddedRowBytes / 4, h, 32);
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 32, p);
}
}
}
else
{
bpp = 0;
paddedRowBytes = PixmapBytePad(w, 1);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
data = (char *)(pCurs->bits->source);
mask = (char *)(pCurs->bits->mask);
fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) |
(((pCurs->foreGreen >> 8) & 0xff) << 8) |
((pCurs->foreBlue >> 8) & 0xff);
bgcolor = (((pCurs->backRed >> 8) & 0xff) << 16) |
(((pCurs->backGreen >> 8) & 0xff) << 8) |
((pCurs->backBlue >> 8) & 0xff);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
{
for (i = 0; i < 32; i++)
{
p = get_pixel_safe(mask, i, j, paddedRowBytes * 8, h, 1);
set_pixel_safe(cur_mask, i, 31 - j, 32, 32, 1, !p);
if (p != 0)
{
p = get_pixel_safe(data, i, j, paddedRowBytes * 8, h, 1);
p = p ? fgcolor : bgcolor;
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 24, p);
}
}
}
}
rdpClientConBeginUpdate(clientCon->dev, clientCon);
rdpClientConSetCursorEx(clientCon->dev, clientCon, xhot, yhot,
cur_data, cur_mask, bpp);
rdpClientConEndUpdate(clientCon->dev, clientCon);
}
/******************************************************************************/ /******************************************************************************/
void void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs, rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y) int x, int y)
{ {
rdpPtr dev;
rdpClientCon *clientCon;
LLOGLN(10, ("rdpSpriteSetCursor:")); LLOGLN(10, ("rdpSpriteSetCursor:"));
if (pCurs == 0)
{
return;
}
if (pCurs->bits == 0)
{
return;
}
dev = rdpGetDevFromScreen(pScr);
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpSpriteSetCursorCon(clientCon, pDev, pScr, pCurs, x, y);
clientCon = clientCon->next;
}
} }
/******************************************************************************/ /******************************************************************************/

@ -244,3 +244,22 @@ rdpRegionUnionRect(RegionPtr pReg, BoxPtr prect)
rdpRegionUnion(pReg, pReg, &reg); rdpRegionUnion(pReg, pReg, &reg);
rdpRegionUninit(&reg); rdpRegionUninit(&reg);
} }
/*****************************************************************************/
int
rdpRegionPixelCount(RegionPtr pReg)
{
int index;
int count;
int rv;
BoxRec box;
rv = 0;
count = REGION_NUM_RECTS(pReg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(pReg)[index];
rv += (box.x2 - box.x1) * (box.y2 - box.y1);
}
return rv;
}

@ -58,5 +58,7 @@ Bool
rdpRegionBreak(RegionPtr pReg); rdpRegionBreak(RegionPtr pReg);
void void
rdpRegionUnionRect(RegionPtr pReg, BoxPtr prect); rdpRegionUnionRect(RegionPtr pReg, BoxPtr prect);
int
rdpRegionPixelCount(RegionPtr pReg);
#endif #endif

@ -108,6 +108,8 @@ xrdp_wm_send_bitmap(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
int x, int y, int cx, int cy); int x, int y, int cx, int cy);
int APP_CC int APP_CC
xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx); xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx);
unsigned int APP_CC
xrdp_wm_htoi (const char *ptr);
int APP_CC int APP_CC
xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd); xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd);
int APP_CC int APP_CC
@ -349,6 +351,8 @@ get_keymaps(int keylayout, struct xrdp_keymap* keymap);
/* xrdp_login_wnd.c */ /* xrdp_login_wnd.c */
int APP_CC int APP_CC
xrdp_login_wnd_create(struct xrdp_wm* self); xrdp_login_wnd_create(struct xrdp_wm* self);
int APP_CC
load_xrdp_config(struct xrdp_config *config);
/* xrdp_bitmap_compress.c */ /* xrdp_bitmap_compress.c */
int APP_CC int APP_CC

@ -559,7 +559,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
self->login_window->notify = xrdp_wm_login_notify; self->login_window->notify = xrdp_wm_login_notify;
gethostname(buf1, 256); g_gethostname(buf1, 256);
g_sprintf(buf, "Login to %s", buf1); g_sprintf(buf, "Login to %s", buf1);
set_string(&self->login_window->caption1, buf); set_string(&self->login_window->caption1, buf);
@ -642,7 +642,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
* *
* @return 0 on success, -1 on failure * @return 0 on success, -1 on failure
*****************************************************************************/ *****************************************************************************/
int APP_CC
load_xrdp_config(struct xrdp_config *config) load_xrdp_config(struct xrdp_config *config)
{ {
struct xrdp_cfg_globals *globals; struct xrdp_cfg_globals *globals;

@ -238,7 +238,7 @@ xrdp_mm_send_login(struct xrdp_mm *self)
/*****************************************************************************/ /*****************************************************************************/
/* returns error */ /* returns error */
/* this goes through the login_names looking for one called 'aname' /* this goes through the login_names looking for one called 'aname'
then it copies the corisponding login_values item into 'dest' then it copies the corresponding login_values item into 'dest'
'dest' must be at least 'dest_len' + 1 bytes in size */ 'dest' must be at least 'dest_len' + 1 bytes in size */
static int APP_CC static int APP_CC
xrdp_mm_get_value(struct xrdp_mm *self, char *aname, char *dest, int dest_len) xrdp_mm_get_value(struct xrdp_mm *self, char *aname, char *dest, int dest_len)
@ -1511,7 +1511,7 @@ getPAMError(const int pamError, char *text, int text_bytes)
case PAM_USER_UNKNOWN: case PAM_USER_UNKNOWN:
return "User not known to the underlying authentication module"; return "User not known to the underlying authentication module";
case PAM_MAXTRIES: case PAM_MAXTRIES:
return "Have exhasted maximum number of retries for service."; return "Have exhausted maximum number of retries for service.";
case PAM_NEW_AUTHTOK_REQD: case PAM_NEW_AUTHTOK_REQD:
return "Authentication token is no longer valid; new one required."; return "Authentication token is no longer valid; new one required.";
case PAM_ACCT_EXPIRED: case PAM_ACCT_EXPIRED:

@ -323,7 +323,8 @@ xrdp_wm_set_pointer(struct xrdp_wm *self, int cache_idx)
/*****************************************************************************/ /*****************************************************************************/
/* convert hex string to int */ /* convert hex string to int */
unsigned int xrdp_wm_htoi (const char *ptr) unsigned int APP_CC
xrdp_wm_htoi (const char *ptr)
{ {
unsigned int value = 0; unsigned int value = 0;
char ch = *ptr; char ch = *ptr;
@ -575,7 +576,7 @@ xrdp_wm_init(struct xrdp_wm *self)
{ {
if (autorun_name[0] == 0) if (autorun_name[0] == 0)
{ {
/* if no doamin is passed, and no autorun in xrdp.ini, /* if no domain is passed, and no autorun in xrdp.ini,
use the first item in the xrdp.ini use the first item in the xrdp.ini
file thats not named file thats not named
'globals' or 'Logging' or 'channels' */ 'globals' or 'Logging' or 'channels' */
@ -1042,7 +1043,7 @@ xrdp_wm_mouse_move(struct xrdp_wm *self, int x, int y)
b = xrdp_wm_at_pos(self->screen, x, y, 0); b = xrdp_wm_at_pos(self->screen, x, y, 0);
if (b == 0) /* if b is null, the movment must be over the screen */ if (b == 0) /* if b is null, the movement must be over the screen */
{ {
if (self->screen->pointer != self->current_pointer) if (self->screen->pointer != self->current_pointer)
{ {
@ -1050,7 +1051,7 @@ xrdp_wm_mouse_move(struct xrdp_wm *self, int x, int y)
self->current_pointer = self->screen->pointer; self->current_pointer = self->screen->pointer;
} }
if (self->mm->mod != 0) /* if screen is mod controled */ if (self->mm->mod != 0) /* if screen is mod controlled */
{ {
if (self->mm->mod->mod_event != 0) if (self->mm->mod->mod_event != 0)
{ {
@ -1189,7 +1190,7 @@ xrdp_wm_mouse_click(struct xrdp_wm *self, int x, int y, int but, int down)
if (control == 0) if (control == 0)
{ {
if (self->mm->mod != 0) /* if screen is mod controled */ if (self->mm->mod != 0) /* if screen is mod controlled */
{ {
if (self->mm->mod->mod_event != 0) if (self->mm->mod->mod_event != 0)
{ {
@ -1738,7 +1739,7 @@ xrdp_wm_login_mode_changed(struct xrdp_wm *self)
} }
/*****************************************************************************/ /*****************************************************************************/
/* this is the log windows nofity function */ /* this is the log windows notify function */
static int DEFAULT_CC static int DEFAULT_CC
xrdp_wm_log_wnd_notify(struct xrdp_bitmap *wnd, xrdp_wm_log_wnd_notify(struct xrdp_bitmap *wnd,
struct xrdp_bitmap *sender, struct xrdp_bitmap *sender,

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save