Commits

Guan-Zhong Huang committed 6b96466

xrdp: Added

Comments (0)

Files changed (9)

+Xrdp provides a fully functional Linux terminal server, capable of accepting 
+connections from rdesktop and Microsoft's own terminal server/remote desktop 
+clients.  Xrdp uses Xvnc or X11rdp to manage the X session.  This means a RDP
+client can connect to a VNC server on the xrdp server machine in addition to
+the RDP server.  Xrdp can also act as a bridging server, allowing RDP clients
+to connect to other RDP or VNC servers through the xrdp server.
+
+Xvnc can be installed by installing tightvnc (available on SlackBuilds.org).
+X11rdp is part of Xrdp and is installed by default.  You can turn off with
+this option:
+        X11RDP=no
+
+By default, this script will make xrdp without PAM support since PAM is not 
+installed in Slackware by default.  The script supports building with PAM,
+but it is completely untested by us.  If you want to enable PAM, run the
+script as follows:
+	USE_PAM=yes ./xrdp.SlackBuild
+
+After installing xrdp there are some configuration files in /etc/xrdp that 
+can be modified.  sesman.ini has some useful options to take note of such as 
+the ability to allow xrdp use by only a certain group and to specify the log 
+location (the default log location has been changed to /var/log/sesman.log).  
+xrdp.ini should be modified so that you have the options you want at the 
+server login screen. For instance, if you want xrdp's default options to be 
+like those of a Windows RDP server then change xrdp.ini so that the default 
+set of options under [xrdp1] corresponds to sesman-X11rdp.  Similarly, you 
+might want to change the options (eg. port number) for VNC (listed as 
+"console" by default).  The man page for xrdp.ini has more details on the 
+file.
+
+/etc/xrdp/xrdp-xinitrc by default loads KDE during a X11rdp session.  Change 
+this as desired to load a different DE/WM.  A similar script can be executed 
+on a per-user basis by creating an executable script at ~/.xrdp-xinitrc.  A 
+utility program, xrdp-xwmconfig, is included to allow you to use your xinit 
+scripts during X11rdp sessions.  It works just like xwmconfig, so run it as 
+root to set the global default, or run it as a normal user to set only the 
+default for that user.  See the sesman.ini man page for details about 
+defining different names or locations for the X11rdp startup scripts.

xrdp/X11rdp-xorg19.patch

+diff --git a/configure.ac b/configure.ac
+index c8dee90..f34a9ad 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -644,6 +644,7 @@ dnl kdrive options
+ AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
+ AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
+ AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
++AC_ARG_ENABLE(rdp,            AC_HELP_STRING([--enable-rdp], [Build X11rdp server (default: yes)]), [RDP=$enableval], [RDP=yes])
+ 
+ 
+ dnl chown/chmod to be setuid root as part of build
+@@ -2124,6 +2125,14 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
+ 
+ AC_SUBST([DIX_CFLAGS])
+ 
++AM_CONDITIONAL(RDP, [test "x$RDP" = xyes])
++if test "$RDP" = yes; then
++    RDP_CFLAGS="$XSERVER_CFLAGS"
++    RDP_LIBS="$FB_LIB $MI_LIB $RANDR_LIB $RENDER_LIB $XKB_LIB $XI_LIB $XEXT_LIB $DIX_LIB $MAIN_LIB $OS_LIB $FIXES_LIB $XSERVER_SYS_LIBS"
++    AC_SUBST([RDP_CFLAGS])
++    AC_SUBST([RDP_LIBS])
++fi
++
+ AC_SUBST([libdir])
+ AC_SUBST([exec_prefix])
+ AC_SUBST([prefix])
+@@ -2228,6 +2237,7 @@ hw/kdrive/fake/Makefile
+ hw/kdrive/fbdev/Makefile
+ hw/kdrive/linux/Makefile
+ hw/kdrive/src/Makefile
++hw/rdp/Makefile
+ test/Makefile
+ test/xi2/Makefile
+ xserver.ent
+diff --git a/hw/Makefile.am b/hw/Makefile.am
+index 6c2cc6b..2359f98 100644
+--- a/hw/Makefile.am
++++ b/hw/Makefile.am
+@@ -26,6 +26,10 @@ if XQUARTZ
+ XQUARTZ_SUBDIRS = xquartz
+ endif
+ 
++if RDP
++RDP_SUBDIRS = rdp
++endif
++
+ SUBDIRS =			\
+ 	$(XORG_SUBDIRS)		\
+ 	$(XWIN_SUBDIRS)		\
+@@ -33,9 +37,10 @@ SUBDIRS =			\
+ 	$(XNEST_SUBDIRS)	\
+ 	$(DMX_SUBDIRS)		\
+ 	$(KDRIVE_SUBDIRS)	\
+-	$(XQUARTZ_SUBDIRS)
++	$(XQUARTZ_SUBDIRS)	\
++	$(RDP_SUBDIRS)
+ 
+-DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive
++DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive rdp
+ 
+ relink:
+ 	$(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done
+diff --git a/hw/rdp/Makefile.am b/hw/rdp/Makefile.am
+new file mode 100644
+index 0000000..6443de6
+--- /dev/null
++++ b/hw/rdp/Makefile.am
+@@ -0,0 +1,38 @@
++AM_CFLAGS = $(RDP_CFLAGS)
++
++bin_PROGRAMS = X11rdp
++
++X11rdp_SOURCES = \
++	rdpmain.c \
++	rdpdraw.c \
++	rdpinput.c \
++	rdpmisc.c \
++	rdpup.c \
++	rdprandr.c \
++	rdpCopyArea.c \
++	rdpPolyFillRect.c \
++	rdpPutImage.c \
++	rdpPolyRectangle.c \
++	rdpPolylines.c \
++	rdpPolySegment.c \
++	rdpFillSpans.c \
++	rdpSetSpans.c \
++	rdpCopyPlane.c \
++	rdpPolyPoint.c \
++	rdpPolyArc.c \
++	rdpFillPolygon.c \
++	rdpPolyFillArc.c \
++	rdpPolyText8.c \
++	rdpPolyText16.c \
++	rdpImageText8.c \
++	rdpImageText16.c \
++	rdpImageGlyphBlt.c \
++	rdpPolyGlyphBlt.c \
++	rdpPushPixels.c \
++	$(top_srcdir)/mi/miinitext.c \
++	$(top_srcdir)/fb/fbcmap_mi.c
++
++X11rdp_LDADD = $(RDP_LIBS)
++
++relink:
++	$(AM_V_at)rm -f X11rdp$(EXEEXT) && $(MAKE) X11rdp$(EXEEXT)
+diff --git a/hw/rdp/rdp.h b/hw/rdp/rdp.h
+index 920fe25..b2de2ac 100644
+--- a/hw/rdp/rdp.h
++++ b/hw/rdp/rdp.h
+@@ -36,10 +36,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ #include <netinet/tcp.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+-#include "X.h"
++#include <X11/X.h>
+ #define NEED_EVENTS
+-#include "Xproto.h"
+-#include "Xos.h"
++#include <X11/Xproto.h>
++#include <X11/Xos.h>
+ #include "scrnintstr.h"
+ #include "servermd.h"
+ #define PSZ 8
+@@ -53,14 +53,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ #include "mipointer.h"
+ #include "dixstruct.h"
+ #include "propertyst.h"
+-#include "Xatom.h"
++#include <X11/Xatom.h>
+ #include "dix.h"
+ #include "X11/keysym.h"
+ #include "dixfontstr.h"
+-#include "fontstruct.h"
++#include <X11/fonts/fontstruct.h>
+ #include "cursorstr.h"
+ #include "picturestr.h"
+-#include "XKBstr.h"
++#include <X11/extensions/XKBstr.h>
+ #include "inputstr.h"
+ #include "randrstr.h"
+ #include "mi.h"
+@@ -76,19 +76,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ 
+ //#include "colormapst.h"
+ 
+-/* test to see if this is xorg source or xfree86 */
+-#ifdef XORGSERVER
+-#  define RDP_IS_XORG
+-#else
+-#  include <xf86Version.h>
+-#  if (XF86_VERSION_MAJOR == 4 && XF86_VERSION_MINOR > 3)
+-#    define RDP_IS_XFREE86
+-#  elif (XF86_VERSION_MAJOR > 4)
+-#    define RDP_IS_XFREE86
+-#  else
+-#    define RDP_IS_XORG
+-#  endif
+-#endif
++#define RDP_IS_XORG
+ 
+ #define X11RDPVER "0.7.0"
+ 

xrdp/bug_fix.patch

+diff --git a/configure.ac b/configure.ac
+index 6dd4052..d431513 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -69,6 +69,11 @@ then
+   fi
+ fi
+ 
++if test "x$enable_nopam" = "xyes"
++then
++  AC_DEFINE([USE_NOPAM],1,[Disable PAM])
++fi
++
+ AS_IF( [test "x$enable_freerdp1" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
+ 
+ # checking for libjpeg
+diff --git a/sesman/verify_user.c b/sesman/verify_user.c
+index 5bd89c7..81ddc0a 100644
+--- a/sesman/verify_user.c
++++ b/sesman/verify_user.c
+@@ -76,7 +76,7 @@ auth_userpass(char *user, char *pass, int *errorcode)
+ 
+         if (1 == auth_account_disabled(stp))
+         {
+-            log_message(&(g_cfg->log), LOG_LEVEL_INFO, "account %s is disabled", user);
++            log_message(LOG_LEVEL_INFO, "account %s is disabled", user);
+             return 0;
+         }
+ 
+diff --git a/xrdp/Makefile.am b/xrdp/Makefile.am
+index b755bbe..25ab3ee 100644
+--- a/xrdp/Makefile.am
++++ b/xrdp/Makefile.am
+@@ -14,6 +14,7 @@ AM_CFLAGS = \
+   $(EXTRA_DEFINES)
+ 
+ INCLUDES = \
++  -I$(top_builddir) \
+   -I$(top_srcdir)/common \
+   -I$(top_srcdir)/libxrdp
+ 
+diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
+index 1f5acaa..008f191 100644
+--- a/xrdp/xrdp_mm.c
++++ b/xrdp/xrdp_mm.c
+@@ -17,12 +17,15 @@
+  *
+  * module manager
+  */
++#include <config_ac.h>
+ #define ACCESS
+ #include "xrdp.h"
+ #include "log.h"
+ #ifdef ACCESS
++#ifndef USE_NOPAM
+ #include "security/_pam_types.h"
+ #endif
++#endif
+ 
+ /*****************************************************************************/
+ struct xrdp_mm *APP_CC
+@@ -1071,6 +1074,7 @@ xrdp_mm_sesman_data_in(struct trans *trans)
+ }
+ 
+ #ifdef ACCESS
++#ifndef USE_NOPAM
+ /*********************************************************************/
+ /* return 0 on success */
+ int access_control(char *username, char *password, char *srv)
+@@ -1183,6 +1187,7 @@ int access_control(char *username, char *password, char *srv)
+     return rec;
+ }
+ #endif
++#endif
+ 
+ /*****************************************************************************/
+ /* This routine clears all states to make sure that our next login will be
+@@ -1206,6 +1211,7 @@ void cleanup_states(struct xrdp_mm *self)
+     }
+ }
+ #ifdef ACCESS
++#ifndef USE_NOPAM
+ const char *getPAMError(const int pamError)
+ {      
+     switch(pamError){
+@@ -1333,6 +1339,7 @@ const char *getPAMAdditionalErrorInfo(const int pamError,struct xrdp_mm *self)
+     
+ }
+ #endif
++#endif
+ /*****************************************************************************/
+ int APP_CC
+ xrdp_mm_connect(struct xrdp_mm *self)
+@@ -1351,10 +1358,12 @@ xrdp_mm_connect(struct xrdp_mm *self)
+     char port[8];
+     char chansrvport[256];
+ #ifdef ACCESS
++#ifndef USE_NOPAM
+     int use_pam_auth = 0;
+     char pam_auth_sessionIP[256];
+     char pam_auth_password[256];
+     char pam_auth_username[256];
++#endif
+     char username[256];
+     char password[256];
+     username[0] = 0;
+@@ -1390,6 +1399,7 @@ xrdp_mm_connect(struct xrdp_mm *self)
+         }
+ 
+ #ifdef ACCESS
++#ifndef USE_NOPAM
+         else if (g_strcasecmp(name, "pamusername") == 0)
+         {
+             use_pam_auth = 1;
+@@ -1403,6 +1413,7 @@ xrdp_mm_connect(struct xrdp_mm *self)
+         {
+             g_strncpy(pam_auth_password, value, 255);
+         }
++#endif
+         else if (g_strcasecmp(name, "password") == 0)
+         {
+             g_strncpy(password, value, 255);
+@@ -1421,7 +1432,7 @@ xrdp_mm_connect(struct xrdp_mm *self)
+     }
+ 
+ #ifdef ACCESS
+-
++#ifndef USE_NOPAM
+     if (use_pam_auth)
+     {
+         int reply;
+@@ -1464,7 +1475,7 @@ xrdp_mm_connect(struct xrdp_mm *self)
+             return rv;
+         }
+     }
+-
++#endif
+ #endif
+ 
+     if (self->sesman_controlled)
+config() {
+  NEW="$1"
+  OLD="$(dirname $NEW)/$(basename $NEW .new)"
+  # If there's no config file by that name, mv it over:
+  if [ ! -r $OLD ]; then
+    mv $NEW $OLD
+  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+    # toss the redundant copy
+    rm $NEW
+  fi
+  # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+  NEW="$1"
+  OLD="$(dirname $NEW)/$(basename $NEW .new)"
+  if [ -e $OLD ]; then
+    cp -a $OLD ${NEW}.incoming
+    cat $NEW > ${NEW}.incoming
+    mv ${NEW}.incoming $NEW
+  fi
+  config $NEW
+}
+
+preserve_perms etc/rc.d/rc.xrdp.new
+config etc/xrdp/xrdp-xinitrc.new
+config etc/xrdp/rsakeys.ini.new
+config etc/xrdp/sesman.ini.new
+config etc/xrdp/xrdp.ini.new
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.  Line
+# up the first '|' above the ':' following the base package name, and the '|' on
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct.  It's also customary to
+# leave one space after the ':'.
+
+    |-----handy-ruler---------------------------------------------------------|
+xrdp: xrdp (Remote Desktop Server for Linux)
+xrdp: 
+xrdp: Xrdp provides a fully functional Linux terminal server, capable of 
+xrdp: accepting connections from rdesktop and Microsoft's own terminal server
+xrdp: and/or remote desktop clients.
+xrdp: 
+xrdp: Xrdp uses Xvnc or X11rdp (installed separately) to manage the X session.
+xrdp: 
+xrdp: Homepage: http://xrdp.sourceforge.net/
+xrdp: 
+xrdp: 

xrdp/slackware.patch

+diff --git a/instfiles/xrdp.sh b/instfiles/xrdp.sh
+index 3e72743..c2c7b64 100755
+--- a/instfiles/xrdp.sh
++++ b/instfiles/xrdp.sh
+@@ -17,7 +17,7 @@
+ # Description: starts xrdp
+ ### END INIT INFO
+ 
+-SBINDIR=/usr/local/sbin
++SBINDIR=/usr/sbin
+ LOG=/dev/null
+ CFGDIR=/etc/xrdp
+ 
+@@ -31,9 +31,9 @@ then
+   echo "xrdp-sesman is not executable"
+   exit 0
+ fi
+-if ! test -x $CFGDIR/startwm.sh
++if ! test -x $CFGDIR/xrdp-xinitrc
+ then
+-  echo "startwm.sh is not executable"
++  echo "xrdp-xinitrc is not executable"
+   exit 0
+ fi
+ 
+@@ -146,7 +146,7 @@ case "$1" in
+     xrdp_start
+     ;;
+   *)
+-    echo "Usage: xrdp.sh {start|stop|restart|force-reload}"
++    echo "Usage: $0 {start|stop|restart|force-reload}"
+     exit 1
+ esac
+ 
+diff --git a/sesman/sesman.ini b/sesman/sesman.ini
+index 571e063..120d45f 100644
+--- a/sesman/sesman.ini
++++ b/sesman/sesman.ini
+@@ -2,11 +2,11 @@
+ ListenAddress=127.0.0.1
+ ListenPort=3350
+ EnableUserWindowManager=1
+-UserWindowManager=startwm.sh
+-DefaultWindowManager=startwm.sh
++UserWindowManager=.xrdp-xinitrc
++DefaultWindowManager=xrdp-xinitrc
+ 
+ [Security]
+-AllowRootLogin=1
++AllowRootLogin=0
+ MaxLoginRetry=4
+ TerminalServerUsers=tsusers
+ TerminalServerAdmins=tsadmins
+@@ -23,7 +23,7 @@ DisconnectedTimeLimit=0
+ 
+ [Logging]
+ LogFile=xrdp-sesman.log
+-LogLevel=DEBUG
++LogLevel=INFO
+ EnableSyslog=1
+ SyslogLevel=DEBUG
+ 

xrdp/xrdp-xwmconfig

+#!/bin/sh
+# Copyright 1999, 2002  Patrick Volkerding, Moorhead, Minnesota USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
+#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Modified by Phillip Warner <pc_warner@yahoo.com>
+# for editing xrdp-xinitrc for use with xrdp
+
+# $DWM is the file under /usr/lib/xrdp that points to /etc/xrdp/xrdp-xinitrc.
+# /etc/xrdp/xrdp-xinitrc will be modified by this script if run by root.
+# $UWM is the file under $HOME that will be modified by this script.
+# The values for DefaultWindowManager and UserWindowManager, respectively, 
+# in sesman.ini should match these.
+DWM=xrdp-xinitrc
+UWM=.xrdp-xinitrc
+
+# First, let's bail if our being here doesn't make sense:
+if [ ! -d /etc/X11/xinit ]; then
+  exit
+fi
+if [ "`cd /etc/X11/xinit ; echo *.*`" = '*.*' ]; then
+  exit
+fi
+if [ ! -d /etc/xrdp ]; then
+  exit
+fi
+if [ $(grep -w DefaultWindowManager /etc/xrdp/sesman.ini | cut -f2 -d"=") != $DWM ]
+then
+  echo "DefaultWindowManager in sesman.ini MUST be $DWM to use this tool.  Aborting..."
+  exit
+fi
+if [ $(grep -w UserWindowManager /etc/xrdp/sesman.ini | cut -f2 -d"=") != $UWM ]
+then
+  echo "UserWindowManager in sesman.ini MUST be $UWM to use this tool.  Aborting..."
+  exit
+fi
+
+if [ "$USER" = "root" ]; then
+  TMP=/var/log/setup/tmp
+else
+  TMP=$HOME/.xrdp-xwmconfig
+fi
+
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP
+fi
+
+# Do we already have an existing default?
+unset PRESELECT
+if [ -L /etc/xrdp/xrdp-xinitrc ]; then
+  CURRENT="$(basename $(/bin/ls -l /etc/xrdp/xrdp-xinitrc | cut -f 2 -d '>'))"
+  PRESELECT=" --default-item $CURRENT "
+fi
+
+# Figure out who we are and set up some background information:
+if [ "$USER" = "root" ]; then
+  BACKTITLE="--backtitle \"Setting system-wide default xrdp window manager at /etc/xrdp/xrdp-xinitrc\""
+else
+  BACKTITLE="--backtitle \"Setting user default xrdp window manager in $HOME/$UWM\""
+fi
+
+# This stops --backtitle from cluttering the initial install:
+if [ ! -r /proc/kcore ]; then
+  BACKTITLE=""
+fi
+
+# Remove any previous script:
+rm -f $TMP/tmpscript.sh
+
+# Add the top of the script:
+cat << EOF > $TMP/tmpscript.sh
+dialog $BACKTITLE --title "SELECT DEFAULT WINDOW MANAGER FOR XRDP" $PRESELECT --menu \\
+"Please select the default window manager to use with XRDP. \\
+This will define the style of graphical user interface the \\
+client computer uses in remote X11rdp sessions." 0 0 0 \\
+EOF
+
+# Add KDE as the first and default entry:
+if [ -r /etc/X11/xinit/xinitrc.kde ]; then
+  echo "\"xinitrc.kde\" \"KDE: K Desktop Environment\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Then, we add GNOME:
+if [ -r /etc/X11/xinit/xinitrc.gnome ]; then
+  echo "\"xinitrc.gnome\" \"GNU Network Object Model Environment\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add XFce:
+if [ -r /etc/X11/xinit/xinitrc.xfce ]; then
+  echo "\"xinitrc.xfce\" \"The Cholesterol Free Desktop Environment\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add Enlightenment:
+if [ -r /etc/X11/xinit/xinitrc.e ]; then
+  echo "\"xinitrc.e\" \"Enlightenment\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add Fluxbox:
+if [ -r /etc/X11/xinit/xinitrc.fluxbox ]; then
+  echo "\"xinitrc.fluxbox\" \"The fluxbox window manager\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add Blackbox:
+if [ -r /etc/X11/xinit/xinitrc.blackbox ]; then
+  echo "\"xinitrc.blackbox\" \"The blackbox window manager\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add WindowMaker:
+if [ -r /etc/X11/xinit/xinitrc.wmaker ]; then
+  echo "\"xinitrc.wmaker\" \"WindowMaker\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add FVWM2:
+if [ -r /etc/X11/xinit/xinitrc.fvwm2 ]; then
+  echo "\"xinitrc.fvwm2\" \"F(?) Virtual Window Manager (version 2.xx)\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add FVWM95:
+if [ -r /etc/X11/xinit/xinitrc.fvwm95 ]; then
+  echo "\"xinitrc.fvwm95\" \"FVWM2 with a Windows look and feel\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add icewm:
+if [ -r /etc/X11/xinit/xinitrc.icewm ]; then
+  echo "\"xinitrc.icewm\" \"ICE Window Manager\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add sawfish:
+if [ -r /etc/X11/xinit/xinitrc.sawfish ]; then
+  echo "\"xinitrc.sawfish\" \"Sawfish without GNOME\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add twm:
+if [ -r /etc/X11/xinit/xinitrc.twm ]; then
+  echo "\"xinitrc.twm\" \"Tab Window Manager (very basic)\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Add mwm:
+if [ -r /etc/X11/xinit/xinitrc.mwm ]; then
+  echo "\"xinitrc.mwm\" \"Motif WM\" \\" >> $TMP/tmpscript.sh
+fi
+
+# Now, add support for the other window managers:
+( cd /etc/X11/xinit
+  for file in xinitrc.* ; do
+    if [ ! "$file" = "xinitrc.kde" -a ! "$file" = "xinitrc.gnome" \
+      -a ! "$file" = "xinitrc.e" -a ! "$file" = "xinitrc.wmaker" \
+      -a ! "$file" = "xinitrc.fvwm2" -a ! "$file" = "xinitrc.fvwm95" \
+      -a ! "$file" = "xinitrc.icewm" -a ! "$file" = "xinitrc.twm" \
+      -a ! "$file" = "xinitrc.mwm" -a ! "$file" = "xinitrc.xfce" \
+      -a ! "$file" = "xinitrc.blackbox" -a ! "$file" = "xinitrc.fluxbox" \
+      -a ! "$file" = "xinitrc.sawfish" ]; then
+      echo "\"$file\" \"$file\" \\" >> $TMP/tmpscript.sh
+    fi
+  done
+)
+
+# Then, the tail end:
+cat << EOF >> $TMP/tmpscript.sh
+2> $TMP/output
+if [ ! \$? = 0 ]; then
+  rm -f $TMP/output
+  echo "Canceled."
+  exit
+fi
+EOF
+
+sh $TMP/tmpscript.sh
+
+if [ ! -r $TMP/output ]; then
+  rm -f $TMP/tmpscript.sh
+  exit
+fi
+
+OUTPUT=`cat $TMP/output`
+
+# If xrdp-xwmconfig is run by root, it changes the system-wide default for users
+# that do not have a $HOME/$UWM:
+if [ "$USER" = "root" ]; then
+  if [ -r /etc/X11/xinit/$OUTPUT ]; then
+    ( cd /etc/xrdp/ ; rm -f xrdp-xinitrc ; ln -sf /etc/X11/xinit/$OUTPUT xrdp-xinitrc )
+  fi
+fi
+
+# Also set up a new $HOME/$UWM:
+if [ -r /etc/X11/xinit/$OUTPUT -a ! "$HOME" = "/" ]; then
+  if [ -r $HOME/$UWM ]; then
+    rm -f $HOME/${UWM}-backup
+    mv $HOME/$UWM $HOME/${UWM}-backup
+    chmod -x $HOME/${UWM}-backup
+  fi
+  cat /etc/X11/xinit/$OUTPUT > $HOME/$UWM
+  # Unlike .xinitrc, $UWM *MUST* be executable
+  chmod u+x $HOME/$UWM
+fi
+
+rm -f $TMP/tmpscript.sh $TMP/output
+

xrdp/xrdp.SlackBuild

+#!/bin/sh
+
+# Slackware build script for xrdp
+
+# Written by Phillip Warner <pc_warner@yahoo.com>
+# Borrow parts of tigervnc.SlackBuild from Eric Hameleers, Eindhoven. NL
+# Copyright 2013 Guan-Zhong Huang, Taiwan <imprazaguy@gmail.com>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
+#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+PRGNAM=xrdp
+VERSION=${VERSION:-0.7.0_20130215git}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+COMMIT_ID=898b8efdf2b70b424a01554276553f30cba6cc83
+
+XORG=${XORG:-1.9.5}
+PATCHVER="$(echo $XORG | cut -f1,2 -d. | tr -d '.')"
+
+#
+# SlackBuild options
+#
+USE_PAM=${USE_PAM:-no}
+X11RDP=${X11RDP:-yes}
+
+if [ -z "$ARCH" ]; then
+  case "$( uname -m )" in
+    i?86) ARCH=i486 ;;
+    arm*) ARCH=arm ;;
+       *) ARCH=$( uname -m ) ;;
+  esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+  LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+  LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+  SLKCFLAGS="-O2 -fPIC"
+  LIBDIRSUFFIX="64"
+else
+  SLKCFLAGS="-O2"
+  LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$COMMIT_ID
+# Because wget may ignore Content-Disposition header, the downloaded filename
+# may be different. Check that and choose the right filename.
+if [ -r "$CWD/$PRGNAM-$COMMIT_ID.tar.gz" ]; then
+  tar xvf $CWD/$PRGNAM-$COMMIT_ID.tar.gz
+elif [ -r "$CWD/$COMMIT_ID.tar.gz" ]; then
+  tar xvf $CWD/$COMMIT_ID.tar.gz
+fi
+cd $PRGNAM-$COMMIT_ID
+if [ "$X11RDP" = "yes" ]; then
+  tar xvf $CWD/xorg-server-$XORG.tar.bz2 -C xorg
+  mv xorg/X11R7.6/rdp xorg/xorg-server-$XORG/hw/
+fi
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+if [ "$USE_PAM" = "no" ]; then
+  PAM_OPTION=--enable-nopam
+fi
+
+# Set LogFile at /var/log/sesman.log
+# Change LogLevel to INFO instead of DEBUG
+# Disable Root logins by default
+# Set user-specific RDP session script to ~/.xrdp-xinitrc
+patch -p1 < $CWD/slackware.patch
+patch -p1 < $CWD/bug_fix.patch
+
+./bootstrap
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+  --prefix=/usr \
+  --libdir=/usr/lib${LIBDIRSUFFIX} \
+  --sysconfdir=/etc \
+  --localstatedir=/var \
+  --mandir=/usr/man \
+  --docdir=/usr/doc/$PRGNAM-$VERSION \
+  --enable-shared \
+  --disable-static \
+  $PAM_OPTION \
+  --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+
+# OS Stamp into the X11rdp binaries:
+OSNAME="Slackware 14.0"
+OSVENDOR="Slackware Linux Project"
+
+DEF_FONTPATH="/usr/share/fonts/local,/usr/share/fonts/TTF,/usr/share/fonts/OTF,/usr/share/fonts/Type1,/usr/share/fonts/misc,/usr/share/fonts/CID,/usr/share/fonts/75dpi/:unscaled,/usr/share/fonts/100dpi/:unscaled,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/cyrillic"
+
+make_X11rdp()
+{
+  cd $TMP/$PRGNAM-$COMMIT_ID/xorg/xorg-server-$XORG
+
+  patch -p1 < $CWD/X11rdp-xorg$PATCHVER.patch
+
+  autoreconf -fvi
+
+  CPPFLAGS="-I$TMP/$PRGNAM-$COMMIT_ID/common" \
+  CFLAGS="$SLKCFLAGS" \
+  CXXFLAGS="$SLKCFLAGS" \
+  ./configure \
+    --prefix=/usr \
+    --libdir=/usr/lib${LIBDIRSUFFIX} \
+    --sysconfdir=/etc \
+    --localstatedir=/var \
+    --mandir=/usr/man \
+    --disable-selective-werror \
+    --disable-static \
+    --disable-config-dbus --disable-config-hal --disable-config-udev \
+    --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \
+    --disable-xwin --disable-xephyr --disable-kdrive --disable-xinerama \
+    --enable-rdp \
+    --enable-install-libxf86config \
+    --enable-xcsecurity \
+    --enable-glx-tls \
+    --with-pic \
+    --with-int10=x86emu \
+    --with-default-font-path="${DEF_FONTPATH}" \
+    --with-xkb-path=/etc/X11/xkb \
+    --with-xkb-output=/var/lib/xkb \
+    --with-os-name="$OSNAME" \
+    --with-os-vendor="$OSVENDOR" \
+    --build=$ARCH-slackware-linux
+
+  make
+  make -C hw/rdp install DESTDIR=$PKG
+}
+
+[ "$X11RDP" = "yes" ] && make_X11rdp
+
+cd $TMP/$PRGNAM-$COMMIT_ID
+
+#if [ "$USE_PAM" = "no" ]; then
+#  rmdir $PKG/etc/pam.d
+#fi
+
+# Let's make the xrdp.sh script the init script
+mkdir -p $PKG/etc/rc.d
+mv $PKG/etc/xrdp/xrdp.sh $PKG/etc/rc.d/rc.xrdp.new
+
+# Move startwm.sh to a more sane location with a name that makes more sense
+mv $PKG/etc/xrdp/startwm.sh $PKG/etc/xrdp/xrdp-xinitrc.new
+
+# Unfortunately, sesman.ini seems to ignore absolute paths for 
+# startwm.sh, so we need to leave a link where it expects to find 
+# the file under the program directory.
+#( cd $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
+#  ln -s /etc/$PRGNAM/xrdp-xinitrc startwm.sh
+#)
+
+# Let's not clobber existing configs
+for file in rsakeys.ini sesman.ini xrdp.ini; do
+  mv $PKG/etc/xrdp/$file $PKG/etc/xrdp/$file.new
+done
+
+# Install the xrdp-xwmconfig utility
+install -D -m 0755 $CWD/xrdp-xwmconfig \
+  $PKG/usr/bin/xrdp-xwmconfig
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a COPYING design.txt install.txt readme.txt $PKG/usr/doc/$PRGNAM-$VERSION
+# Keep a backup copy of startwm.sh in the docs
+cat sesman/startwm.sh > $PKG/usr/doc/$PRGNAM-$VERSION/startwm.sh-example
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+PRGNAM="xrdp"
+VERSION="0.7.0_20130215git"
+HOMEPAGE="http://www.xrdp.org/"
+DOWNLOAD="https://github.com/FreeRDP/xrdp/archive/898b8efdf2b70b424a01554276553f30cba6cc83.tar.gz"
+MD5SUM="bfb16319896f2655c328beefe9dbcf50"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Guan-Zhong Huang"
+EMAIL="imprazaguy@gmail.com"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.