-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathxrdpconfigurator.py
executable file
·5051 lines (4530 loc) · 253 KB
/
xrdpconfigurator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# XRDPConfigurator
# Copyright (c) 2014 Kevin Cave
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import sys
import socket
import locale
from time import strftime
from ctypes import c_char_p, c_int, Structure, cast, c_void_p, CDLL, POINTER
from PySide import *
from configparser import ConfigParser
from io import StringIO
from user_interface.XRDPConfiguratorMainWindow import Ui_XRDPConfigurator
from user_interface.LoginWindowSimulator import Ui_LoginWindowSimulator
from user_interface.SessionFrame import Ui_sessionConfigForm
from user_interface.PreviewWindow import Ui_PreviewWindow
from user_interface.NewSession import Ui_NewSession
from user_interface.About import Ui_About
from user_interface.AreYouSure import Ui_AreYouSure
from user_interface.InfoWindow import Ui_InfoWindow
from user_interface.LogoCustomization import Ui_LogoCustomization
from user_interface.ImageImport import Ui_ImageImport
from user_interface.dialogSize import Ui_dialogSize
from user_interface.logoPosition import Ui_logoPosition
from user_interface.labelsAndBoxes import Ui_labelsAndBoxes
from user_interface.DialogButtons import Ui_DialogButtonsCustomizationForm
class BoxShades(QtGui.QGraphicsItemGroup):
# Draws shade lines for the dialog boxes in the Login Window Simulator.
# Enables easy moving and resizing.
def __init__(self, parent, boxlength=210, xpos=200, ypos=200):
super(BoxShades, self).__init__(parent)
self.parent = parent
self.boxlength = boxlength
self.xpos = xpos
self.ypos = ypos
pen_width = 1
pen = QtGui.QPen(QtGui.QColor(128, 128, 128))
pen.setWidth(pen_width)
self.topline = QtGui.QGraphicsLineItem(parent=parent)
self.topline.setPen(pen)
self.topline.setParentItem(parent)
pen = QtGui.QPen(QtGui.QColor(0, 0, 0))
pen.setWidth(pen_width)
self.topline2 = QtGui.QGraphicsLineItem(parent=parent)
self.topline2.setPen(pen)
pen = QtGui.QPen(QtGui.QColor(128, 128, 128))
pen.setWidth(pen_width)
self.leftline = QtGui.QGraphicsLineItem(parent=parent)
self.leftline.setPen(pen)
pen = QtGui.QPen(QtGui.QColor(0, 0, 0))
pen.setWidth(pen_width)
self.leftline2 = QtGui.QGraphicsLineItem(parent=parent)
self.leftline2.setPen(pen)
pen = QtGui.QPen(QtGui.QColor(255, 255, 255))
pen.setWidth(pen_width)
self.bottomline = QtGui.QGraphicsLineItem()
self.bottomline.setPen(pen)
self.rightline = QtGui.QGraphicsLineItem(parent=parent)
self.rightline.setPen(pen)
self.position(xpos, ypos, boxlength)
def position(self, xpos, ypos, boxlength): # Place the rectangle at a specified position
self.topline.setLine(xpos, ypos, xpos + boxlength, ypos)
self.topline2.setLine(xpos + 1, ypos + 1, xpos + boxlength - 1, ypos + 1)
self.leftline.setLine(xpos, ypos, xpos, ypos + 17)
self.leftline2.setLine(xpos + 1, ypos + 1, xpos + 1, ypos + 1 + 17)
self.bottomline.setLine(xpos, ypos + 18, xpos + boxlength, ypos + 18)
self.rightline.setLine(xpos + boxlength, ypos, xpos + boxlength, ypos + 18)
def move(self, x_amount, y_amount): # Used when moving the rectangle's around
self.topline.setPos(x_amount, y_amount)
self.topline2.setPos(x_amount + 1, y_amount + 1)
self.leftline.setPos(x_amount, y_amount)
self.leftline2.setPos(x_amount + 1, y_amount + 1)
self.bottomline.setPos(x_amount, y_amount + 18)
self.rightline.setPos(x_amount, y_amount)
class LoginWindowSimulator(QtGui.QDialog, Ui_LoginWindowSimulator):
def __init__(self, parent, f=QtCore.Qt.WindowFlags()):
QtGui.QDialog.__init__(self, parent, f)
self.setupUi(self)
resized = QtCore.Signal(QtGui.QResizeEvent)
def resizeEvent(self, event):
self.resized.emit(event)
class ColourWidget(QtGui.QColorDialog):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QColorDialog.__init__(self, parent, f)
class LabelsAndBoxesWidget(QtGui.QWidget, Ui_labelsAndBoxes):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QWidget.__init__(self, parent, f)
self.setupUi(self)
class DialogButtonsCustomizationWidget(QtGui.QDialog, Ui_DialogButtonsCustomizationForm):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QDialog.__init__(self, parent, f)
self.setupUi(self)
class ImageImport(QtGui.QDialog, Ui_ImageImport):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QDialog.__init__(self, parent, f)
self.setupUi(self)
self.setWindowIcon(QtGui.QPixmap(":/icons/images/icons/XRDPConfiguratorWindowIcon.png"))
class LogoCustomizationWidget(QtGui.QDialog, Ui_LogoCustomization):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QDialog.__init__(self, parent, f)
self.setupUi(self)
self.setWindowIcon(QtGui.QPixmap(":/icons/images/icons/XRDPConfiguratorWindowIcon.png"))
class DialogSizeWidget(QtGui.QWidget, Ui_dialogSize):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QWidget.__init__(self, parent, f)
self.setupUi(self)
class LogoPositionWidget(QtGui.QWidget, Ui_logoPosition):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QWidget.__init__(self, parent, f)
self.setupUi(self)
# This form fills in the Session Tabs...
class sessionConfigForm(QtGui.QWidget, Ui_sessionConfigForm):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QWidget.__init__(self, parent, f)
self.setupUi(self)
class PreviewWindow(QtGui.QDialog, Ui_PreviewWindow):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QDialog.__init__(self, parent, f)
self.setupUi(self)
# New session pop-up window...
class NewSession(QtGui.QDialog, Ui_NewSession):
def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):
QtGui.QDialog.__init__(self, parent, f)
self.setupUi(self)
# The About window...
class AboutWindow(QtGui.QDialog, Ui_About):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.buttonBox.accepted.connect(self.accept)
cprfile = QtCore.QFile(":/html/html/copyright.html")
if not cprfile.open(QtCore.QIODevice.ReadOnly | QtCore.QIODevice.Text):
return
copyright_text = QtCore.QIODevice.readAll(cprfile)
self.textBrowser.setText(str(copyright_text))
# The Are You Sure You Want To Quit window...
class AreYouSure(QtGui.QDialog, Ui_AreYouSure):
def __init__(self, text):
super(AreYouSure, self).__init__()
self.setupUi(self)
self.label.setText(text)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
# A generic Information window...
class InfoWindow(QtGui.QDialog, Ui_InfoWindow):
def __init__(self, text):
super(InfoWindow, self).__init__()
self.setupUi(self)
self.label.setText(text)
self.setWindowIcon(QtGui.QPixmap(":/icons/images/icons/XRDPConfiguratorWindowIcon.png"))
self.buttonBox.accepted.connect(self.accept)
# This class defines the Login Window Dialog item group
class LoginWindowGroup(QtGui.QGraphicsItemGroup):
def __init__(self, restrict_rect, parent=None):
QtGui.QGraphicsItemGroup.__init__(self, parent)
self.setFlag(QtGui.QGraphicsItemGroup.ItemIsMovable, True)
self.setHandlesChildEvents(False)
# Prevent the loginwindow from being moved out of the display area
self.restrict_rect = restrict_rect
def mouseMoveEvent(self, event):
if self.restrict_rect.contains(event.scenePos()):
QtGui.QGraphicsItemGroup.mouseMoveEvent(self, event)
# Used for both Login Dialog labels and Boxes
class LoginWindowGenericGroup(QtGui.QGraphicsItemGroup):
def __init__(self, parent=None):
QtGui.QGraphicsItemGroup.__init__(self, parent)
self.setFlag(QtGui.QGraphicsItemGroup.ItemIsMovable, True)
self.setHandlesChildEvents(False)
# Used for displaying resize arrow and logo pixmaps
# Adds clicked moved and released signals to a QLabel, which normally it doesn't have.
class ClickableQLabel(QtGui.QLabel):
def __init__(self, image, parent=None):
super(ClickableQLabel, self).__init__(parent)
self.setPixmap(image)
self.setGeometry(0, 0, self.pixmap().width(), self.pixmap().height())
clicked = QtCore.Signal(QtGui.QMouseEvent)
moved = QtCore.Signal(QtGui.QMouseEvent)
released = QtCore.Signal(QtGui.QMouseEvent)
def mousePressEvent(self, event):
self.clicked.emit(event)
def mouseMoveEvent(self, event):
self.moved.emit(event)
def mouseReleaseEvent(self, event):
self.released.emit(event)
# This class defines a Login Dialog Window, banner, and shade lines...
class LoginWindow(QtGui.QWidget):
def __init__(self):
super(LoginWindow, self).__init__()
self.loginrect = QtGui.QGraphicsRectItem()
self.topline = QtGui.QGraphicsLineItem(self.loginrect)
self.leftline = QtGui.QGraphicsLineItem(self.loginrect)
self.bottomline = QtGui.QGraphicsLineItem(self.loginrect)
self.rightline = QtGui.QGraphicsLineItem(self.loginrect)
self.loginbanner = QtGui.QGraphicsRectItem(self.loginrect)
self.bannertext = QtGui.QGraphicsTextItem(self.loginrect)
self.arrowPixmap = QtGui.QPixmap(":/dragpoint/images/dragpoints/Arrow_bottomright.png")
self.resizearrow = ClickableQLabel(self.arrowPixmap)
self.dialog_width = 0
self.dialog_height = 0
def createDialog(self, x_pos, y_pos, dialog_width, dialog_height, dialog_colour, pen_width, new_version_flag):
self.resizearrow.setGeometry(0, 0, self.arrowPixmap.width(), self.arrowPixmap.height())
self.dialog_width = 0
self.dialog_height = 0
hostname = socket.gethostname()
pen_width = pen_width
font = QtGui.QFont()
font.setFamily("Sans")
font.setPointSize(10)
font.setStyleStrategy(QtGui.QFont.NoAntialias)
# Add the main grey rectangle...
dialog_pen = QtGui.QPen(dialog_colour)
dialog_brush = QtGui.QBrush(dialog_colour)
self.loginrect.setPen(dialog_pen)
self.loginrect.setBrush(dialog_brush)
self.loginrect.setRect(x_pos, y_pos, dialog_width, dialog_height)
# Add the top and left "shade lines" - these will be controlled by "white=" in INI
pen = QtGui.QPen(QtGui.QColor(255, 255, 255))
pen.setWidth(pen_width)
self.topline.setPen(pen)
self.topline.setLine(x_pos + 1, y_pos + 1, x_pos + dialog_width, y_pos + 1)
self.leftline.setPen(pen)
self.leftline.setLine(x_pos + 1, y_pos + dialog_height - 1, x_pos + 1, y_pos + 1)
# Add the bottom and right "shade lines" - these will be controlled by "dark_grey=" in INI
pen = QtGui.QPen(QtGui.QColor(128, 128, 128))
pen.setWidth(pen_width)
self.bottomline.setPen(pen)
self.bottomline.setLine(x_pos + 1, y_pos + dialog_height, x_pos + dialog_width, y_pos + dialog_height)
self.rightline.setPen(pen)
self.rightline.setLine(x_pos + dialog_width, y_pos + dialog_height, x_pos + dialog_width, y_pos)
# Add the "banner"...
pen = QtGui.QPen(QtGui.QColor(0, 0, 255))
brush = QtGui.QBrush(QtGui.QColor(0, 0, 255))
self.loginbanner.setPen(pen)
self.loginbanner.setBrush(brush)
self.loginbanner.setRect(x_pos + 3, y_pos + 3, dialog_width - 6, 17)
self.bannertext.setFont(font)
self.bannertext.setDefaultTextColor(QtGui.QColor(255, 255, 255))
if new_version_flag:
self.bannertext.setPlainText("Login to " + hostname)
else:
self.bannertext.setPlainText("Login to xrdp")
self.dialog_width = dialog_width
self.dialog_height = dialog_height
self.bannertext.setPos(x_pos, y_pos)
self.positionResizeArrow(x_pos, y_pos)
return self.loginrect
def released(self, event):
pass
def adjustDialogSize(self, x_pos, y_pos, dialog_width, dialog_height):
# print("x_pos : "+str(int(x_pos))+
# ", y_pos : "+str(int(y_pos))+
# ", dialog_width : "+str(int(dialog_width))+
# ", dialog_height : "+str(int(dialog_height)))
self.loginrect.setRect(x_pos, y_pos, dialog_width, dialog_height)
self.topline.setLine(x_pos + 1, y_pos + 1, x_pos + dialog_width, y_pos + 1)
self.bottomline.setLine(x_pos + 1, y_pos + dialog_height, x_pos + dialog_width, y_pos + dialog_height)
self.leftline.setLine(x_pos + 1, y_pos + dialog_height - 1, x_pos + 1, y_pos + 1)
self.rightline.setLine(x_pos + dialog_width, y_pos + dialog_height, x_pos + dialog_width, y_pos)
self.loginbanner.setRect(x_pos + 3, y_pos + 3, dialog_width - 6, 17)
self.dialog_width = dialog_width
self.dialog_height = dialog_height
self.positionResizeArrow(x_pos, y_pos)
def positionResizeArrow(self, x_pos, y_pos):
self.resizearrow.move(x_pos + self.dialog_width - self.arrowPixmap.width(),
y_pos + self.dialog_height - self.arrowPixmap.height())
def resizeVisible(self):
self.resizearrow.setVisible(True)
def resizeInvisible(self):
self.resizearrow.setVisible(False)
# This is the main program logic.
def getColour(value):
webcolour = '#' + value
colour = QtGui.QColor(0, 0, 0)
colour.setNamedColor(webcolour)
return colour
def verifyXrdpIni(fname):
in_file = ConfigParser()
in_file.read(fname)
if (in_file.has_section("globals")) and (in_file.has_section("xrdp1")): # and (file.has_section("channels")):
return True
else:
message_window = InfoWindow(
"<html><head/><body><p>The file you attempted to open did not</p><p>appear to be an xrdp.ini file.</p></body></html>")
message_window.exec_()
return False
def verifySesmanIni(fname):
in_file = ConfigParser()
in_file.read(fname)
if (in_file.has_section("Globals")) and (in_file.has_section("Security")) and (in_file.has_section("Sessions")):
return True
else:
message_window = InfoWindow(
"<html><head/><body><p>The file you attempted to open did not</p><p>appear to be a sesman.ini file.</p></body></html>")
message_window.exec_()
return False
class XRDPConfigurator(QtGui.QMainWindow, Ui_XRDPConfigurator):
def __init__(self):
super(XRDPConfigurator, self).__init__()
self.setupUi(self)
# Connect menu item signals to their relevant functions...
self.actionKeymaps.triggered.connect(self.showkeymapgenpage)
self.actionLogin_Window.triggered.connect(self.showLoginWindowSim)
self.actionOpenSesman_ini.triggered.connect(self.fileOpenSesmanIni)
self.actionOpenXrdp_ini.triggered.connect(self.fileOpenXrdpIni)
self.actionQuit.triggered.connect(self.fileQuit)
self.actionSave.triggered.connect(self.fileSave)
self.actionSave_as.triggered.connect(self.fileSaveAs)
self.actionSesman_ini.triggered.connect(self.showSesmanIniPage)
self.actionXrdp_ini.triggered.connect(self.showXrdpIniPage)
self.actionPreview.triggered.connect(self.xrdpIniPreview)
self.actionAbout.triggered.connect(self.showAbout) # connect help-about to About Window
# Connect GUI signals to their relevant functions...
self.addNewSessionButton.clicked.connect(self.addNewSession)
self.additionalPamErrorTextCheckbox.clicked.connect(self.pamErrorTextHandler)
self.allowMultimonCheckBox.clicked.connect(self.allowMultimonChanged)
self.allowRootLoginCheckBox.clicked.connect(self.allowRootLoginCheckBoxChanged)
self.alwaysCheckGroupCheckBox.clicked.connect(self.alwaysCheckGroupCheckBoxChanged)
self.autoRunComboBox.currentIndexChanged.connect(self.autorunSessionChanged)
self.cryptLevelComboBox.currentIndexChanged.connect(self.cryptLevelChanged)
self.defaultWindowManagerEntryBox.returnPressed.connect(self.defaultWindowManagerEntryBoxChanged)
self.deleteSessionButton.clicked.connect(self.deleteSession)
self.disableNewCursorsCheckBox.clicked.connect(self.disableNewCursorsChanged)
self.disconnectedTimeLimitSpinBox.valueChanged.connect(self.disconnectedTimeLimitSpinBoxChanged)
self.enableChannelsCheckBox.clicked.connect(self.enableChannelsChanged)
self.enableSesmanSyslogCheckBox.clicked.connect(self.sesmanEnableSyslogChanged)
self.enableSyslogCheckBox.clicked.connect(self.enableSyslogChanged)
self.enableUserWindowManager.clicked.connect(self.sesmanEnableUserWindowManagerChanged)
self.forkSessionsCheckBox.clicked.connect(self.forkSessionsChanged)
self.hideLogWindowCheckBox.clicked.connect(self.hideLogWindowChanged)
self.idleTimeLimitSpinBox.valueChanged.connect(self.idleTimeLimitSpinBoxChanged)
self.killDisconnectedCheckBox.clicked.connect(self.killDisconnectedCheckBoxChanged)
self.logFileNameEntryBox.editingFinished.connect(self.logFileNameChanged)
self.logLevelComboBox.currentIndexChanged.connect(self.logLevelChanged)
self.maxBppComboBox.currentIndexChanged.connect(self.maxBppChanged)
self.maxLoginRetrySpinBox.valueChanged.connect(self.maxLoginRetrySpinBoxChanged)
self.maxSessionsSpinBox.valueChanged.connect(self.maxSessionsSpinBoxChanged)
self.pamErrorText.editingFinished.connect(self.pamErrorTextHandler)
self.requireCredentialsCheckbox.clicked.connect(self.requireCredentialsChanged)
self.savekeymapasbutton.clicked.connect(self.saveKeymapFile)
self.selected_keymap_combobox.currentIndexChanged.connect(self.updateKeymapCode)
self.sesmanListeningAddressEntryBox.returnPressed.connect(self.sesmanListeningIPAddressChanged)
self.listeningPortEntryBox.returnPressed.connect(self.sesmanListenPortChanged)
self.sesmanLogFileNameEntryBox.returnPressed.connect(self.sesmanLogFileNameEntryBoxChanged)
self.sesmanLogLevelComboBox.currentIndexChanged.connect(self.sesmanLogLevelComboBoxChanged)
self.sesmanSysLogLevelComboBox.currentIndexChanged.connect(self.sesmanSyslogLevelChanged)
self.sysLogLevelComboBox.currentIndexChanged.connect(self.xrdpSyslogLevelChanged)
self.tcpKeepAliveCheckBox.clicked.connect(self.tcpKeepaliveChanged)
self.tcpNoDelayCheckBox.clicked.connect(self.tcpNodelayChanged)
self.terminalServiceAdminsEntryBox.returnPressed.connect(self.terminalServiceAdminsEntryBoxChanged)
self.terminalServiceUsersEntryBox.returnPressed.connect(self.terminalServiceUsersEntryBoxChanged)
self.useBitMapCacheCheckBox.clicked.connect(self.useBitMapCacheChanged)
self.useBitMapCompCheckBox.clicked.connect(self.useBitMapCompChanged)
self.useBulkCompCheckBox.clicked.connect(self.useBulkCompChanged)
self.useClipRdrCheckBox.clicked.connect(self.useClipRdrChanged)
self.useDrDynVcCheckBox.clicked.connect(self.useDrDynVcChanged)
self.useRAILCheckBox.clicked.connect(self.useRAILChanged)
self.useRdpDrCheckBox.clicked.connect(self.useRdpDrChanged)
self.useRdpSndCheckBox.clicked.connect(self.useRdpSndChanged)
self.useXrdpVrCheckBox.clicked.connect(self.useXrdpVrChanged)
self.userWindowManagerEntryBox.returnPressed.connect(self.userWindowManagerEntryBoxChanged)
self.x11DisplayOffsetSpinBox.valueChanged.connect(self.x11DisplayOffsetSpinBoxChanged)
self.x11rdpParamsLineEdit.returnPressed.connect(self.xserverParamsChanged)
self.xvncParamsLineEdit.returnPressed.connect(self.xserverParamsChanged)
self.listeningPortEntryBox.editingFinished.connect(self.listeningportchanged)
self.listeningAddressEntryBox.editingFinished.connect(self.listeningaddresschanged)
self.about_window = AboutWindow()
self.xrdp_ini_filename = "" # Name of currently opened xrdp.ini file.
self.locale_detected = "" # The detected system locale.
self.keymapname = "" # Name of the keymap.
self.keymappreview = []
self.keymappreview = StringIO()
self.sessions_channel_override_active_list = []
self.overridearray = []
self.xrdpfilename = ""
self.xrdp_ini_file = ConfigParser()
self.xrdp_debug_checkbox = None
self.editingSesman = False
self.editingXrdpIni = False
self.sesman_ini_filename = ""
self.winSim = None
self.x_pos = 0
self.y_pos = 0
self.helpbtn_width = 0
self.helpbtn_height = 0
self.user_text_xpos = 0
self.user_text_ypos = 0
self.pass_text_xpos = 0
self.pass_text_ypos = 0
self.mod_box_xpos = 0
self.mod_box_ypos = 0
self.user_box_xpos = 0
self.user_box_ypos = 0
self.pass_box_xpos = 0
self.pass_box_ypos = 0
self.helpbtn_xpos = 0
self.helpbtn_ypos = 0
self.tab_bar = self.sessionsTab.findChild(QtGui.QTabBar, "qt_tabwidget_tabbar")
self.tab_bar.tabMoved[int, int].connect(self.reordersessiontabs)
self.boxlength = 0
self.dialog_width = 0
self.dialog_height = 0
self.mod_text_xpos = 0
self.mod_text_ypos = 0
self.okbtn_xpos = 0
self.okbtn_ypos = 0
self.okbtn_width = 0
self.okbtn_height = 0
self.cancelbtn_xpos = 0
self.cancelbtn_ypos = 0
self.cancelbtn_width = 0
self.cancelbtn_height = 0
self.logo_xpos = 0
self.logo_ypos = 0
self.simscene = None
self.simbackgroundscene = None
self.simwindowscene = None
self.simtitleBgndscene = None
self.simtextscene = None
self.simboxesscene = None
self.simbotRightscene = None
self.simdarkBluescene = None
self.dark_blue = QtGui.QColor(0, 0, 127)
Version = "1.0"
hilight_background_running = 0
highlight_text_running = 0
something_sesman_changed = 0
something_xrdp_changed = 0
xrdp_ini_file_opened = 0
sesman_ini_file_opened = 0
new_version_flag = 0
hostname = socket.gethostname()
logo_filename = ""
# This array is for use with channel overrides handler.
# It comprises of the Globals channel name, the Sessions channel name, and the
# corresponding Qt Widget name for the channel override tickboxes which are in
# each of the Sessions tabs...
SESSIONOVERRIDESLIST = [['rdpdr', 'channel.rdpdr', 'useRdpDrCheckBox'],
['rdpsnd', 'channel.rdpsnd', 'useRdpSndCheckBox'],
['drdynvc', 'channel.drdynvc', 'useDrDynVcCheckBox'],
['cliprdr', 'channel.cliprdr', 'useClipRdrCheckBox'],
['rail', 'channel.rail', 'useRAILCheckBox'],
['xrdpvr', 'channel.xrdpvr', 'useXrdpVrCheckBox']]
# Used for parsing channels...
CHANNEL_LIST = ["useRdpDrCheckBox", "useRdpSndCheckBox", "useDrDynVcCheckBox", "useClipRdrCheckBox",
"useRAILCheckBox", "useXrdpVrCheckBox"]
# initialise keymaps...
keymap = [[]]
KEYMAP_LIST = """0436 af Afrikaans
041C sq Albanian
0001 ar Arabic
0401 ar-sa Arabic (Saudi Arabia)
0801 ar-iq Arabic (Iraq)
0C01 ar-eg Arabic (Egypt)
1001 ar-ly Arabic (Libya)
1401 ar-dz Arabic (Algeria)
1801 ar-ma Arabic (Morocco)
1C01 ar-tn Arabic (Tunisia)
2001 ar-om Arabic (Oman)
2401 ar-ye Arabic (Yemen)
2801 ar-sy Arabic (Syria)
2C01 ar-jo Arabic (Jordan)
3001 ar-lb Arabic (Lebanon)
3401 ar-kw Arabic (Kuwait)
3801 ar-ae Arabic (U.A.E.)
3C01 ar-bh Arabic (Bahrain)
4001 ar-qa Arabic (Qatar)
042D eu Basque
0402 bg Bulgarian
0423 be Belarusian
0403 ca Catalan
0004 zh Chinese
0404 zh-tw Chinese (Taiwan)
0804 zh-cn Chinese (China)
0C04 zh-hk Chinese (Hong Kong SAR)
1004 zh-sg Chinese (Singapore)
041A hr Croatian
0405 cs Czech
0406 da Danish
0413 nl Dutch (Netherlands)
0813 nl-be Dutch (Belgium)
0009 en English
0409 en-us English (United States)
0809 en-gb English (United Kingdom)
0C09 en-au English (Australia)
1009 en-ca English (Canada)
1409 en-nz English (New Zealand)
1809 en-ie English (Ireland)
1C09 en-za English (South Africa)
2009 en-jm English (Jamaica)
2809 en-bz English (Belize)
2C09 en-tt English (Trinidad)
0425 et Estonian
0438 fo Faeroese
0429 fa Farsi
040B fi Finnish
040C fr French (France)
080C fr-be French (Belgium)
0C0C fr-ca French (Canada)
100C fr-ch French (Switzerland)
140C fr-lu French (Luxembourg)
043C gd Gaelic
0407 de German (Germany)
0807 de-ch German (Switzerland)
0C07 de-at German (Austria)
1007 de-lu German (Luxembourg)
1407 de-li German (Liechtenstein)
0408 el Greek
040D he Hebrew
0439 hi Hindi
040E hu Hungarian
040F is Icelandic
0421 in Indonesian
0410 it Italian (Italy)
0810 it-ch Italian (Switzerland)
0411 ja Japanese
0412 ko Korean
0426 lv Latvian
0427 lt Lithuanian
042F mk FYRO Macedonian
043E ms Malay (Malaysia)
043A mt Maltese
0414 no Norwegian (Bokmal)
0814 no Norwegian (Nynorsk)
0415 pl Polish
0416 pt-br Portuguese (Brazil)
0816 pt Portuguese (Portugal)
0417 rm Rhaeto-Romanic
0418 ro Romanian
0818 ro-mo Romanian (Moldova)
0419 ru Russian
0819 ru-mo Russian (Moldova)
0C1A sr Serbian (Cyrillic)
081A sr Serbian (Latin)
041B sk Slovak
0424 sl Slovenian
042E sb Sorbian
040A es Spanish (Traditional Sort)
080A es-mx Spanish (Mexico)
0C0A es Spanish (International Sort)
100A es-gt Spanish (Guatemala)
140A es-cr Spanish (Costa Rica)
180A es-pa Spanish (Panama)
1C0A es-do Spanish (Dominican Republic)
200A es-ve Spanish (Venezuela)
240A es-co Spanish (Colombia)
280A es-pe Spanish (Peru)
2C0A es-ar Spanish (Argentina)
300A es-ec Spanish (Ecuador)
340A es-cl Spanish (Chile)
380A es-uy Spanish (Uruguay)
3C0A es-py Spanish (Paraguay)
400A es-bo Spanish (Bolivia)
440A es-sv Spanish (El Salvador)
480A es-hn Spanish (Honduras)
4C0A es-ni Spanish (Nicaragua)
500A es-pr Spanish (Puerto Rico)
0430 sx Sutu
041D sv Swedish
081D sv-fi Swedish (Finland)
041E th Thai
0431 ts Tsonga
0432 tn Tswana
041F tr Turkish
0422 uk Ukrainian
0420 ur Urdu
042A vi Vietnamese
0434 xh Xhosa
043D ji Yiddish
0435 zu Zulu
"""
changed_background_colour = "8feda4"
line_edit_changed_stylesheet = "QLineEdit{background: #" + changed_background_colour + "; font: bold 'Ariel'; }"
spinbox_changed_stylesheet = "QSpinBox{background: #" + changed_background_colour + "; font: bold 'Ariel'; }"
checkbox_changed_stylesheet = "QCheckBox{background: #" + changed_background_colour + "; font: bold 'Ariel'; }"
combobox_changed_stylesheet = "QComboBox{background: #" + changed_background_colour + "; font: bold 'Ariel'; }"
colourbutton_stylesheet = "QPushButton{background: #" + changed_background_colour + "; font: bold 'Ariel'; }"
# noinspection PyTypeChecker
def initkeymaplocales(self):
#test='zh-sg'
#l = list(test)
l = list(str(locale.getlocale()[0]).lower())
try:
ind = l.index('_')
l[ind] = '-'
except ValueError:
pass
loc = "".join(l)
if len(self.keymap) == 1:
self.keymap[0] = [' ', 'Select a country...']
i = 1
for lines in self.KEYMAP_LIST.split('\n'):
code = lines[:4]
unf = lines[5:].split(' ')
frm = str('{0: <7}'.format(unf[0]))
for j in range(1, len(unf)):
frm = frm + ' ' + unf[j]
self.keymap.append([])
self.keymap[i].extend([code, frm])
if loc == unf[0]:
self.locale_detected = i
i += 1
for i in range(len(self.keymap)):
if self.keymap[i]:
self.selected_keymap_combobox.addItem(self.keymap[i][1])
self.selected_keymap_combobox.removeItem(i)
#return self.locale_detected
def showkeymapgenpage(self):
self.initkeymaplocales()
self.selected_keymap_combobox.setCurrentIndex(self.locale_detected)
self.actionPreview.setEnabled(False)
self.setWindowTitle("XRDPConfigurator : Keymap Generator")
self.stackedWidget.setVisible(True)
self.stackedWidget.setCurrentIndex(3)
self.filenameFrame.setVisible(False)
self.generatekeymap()
# noinspection PyUnusedLocal
def updateKeymapCode(self, arg):
index = self.selected_keymap_combobox.currentIndex()
if index != 0:
mapcode = self.keymap[index][0]
if index == self.locale_detected:
self.locale_autodetected_label.setVisible(True)
else:
self.locale_autodetected_label.setVisible(False)
self.keymapname = "km-" + str(mapcode.lower()) + ".ini"
self.keymapNameLabel.setText(self.keymapname)
self.step3group.setEnabled(True)
else:
self.keymapNameLabel.setText('')
self.step3group.setEnabled(False)
self.keymapcodelabel.setText(self.keymap[index][0])
def generatekeymap(self):
# This function generates a keymap, based on keycodes as seen by the X server you are running this application
# under.
# It uses Python's ctypes foreign function library to allow calling functions in shared libraries
# I could do just about everything within Python, except for calling some Xlib functions, for some reason.
# Because of this, a small helper library written in C, called libxrdpconfigurator was created, which needs to be
# compiled and installed somewhere the system can supply it to this program - /usr/lib for example.
# Perhaps some time in the future, a way can be found to call the necessary Xlib functions within this function,
# and the C helper library could be dispensed with.
if 'self.keymappreview' in globals():
del self.keymappreview
self.keymapbrowser.clear()
class Display(Structure):
pass
sects = ["noshift", "shift", "altgr", "capslock", "shiftcapslock", "shiftaltgr"]
sectcount = len(sects)
states = [c_int(0), c_int(1), c_int(0x80), c_int(2), c_int(3), c_int(0x81)]
lib = CDLL("libxrdpconfigurator.so")
GetLookupString = lib.getlookupstring
GetLookupString.restype = c_void_p
lib.freeme.argtypes = []
lib.freeme.restype = c_void_p
xlib = CDLL('libX11.so.6')
xlib.XOpenDisplay.argtypes = [c_char_p]
xlib.XOpenDisplay.restype = POINTER(Display)
xdisplay = xlib.XOpenDisplay(None)
if not xdisplay:
print("ERROR: could not open DISPLAY.")
return
index = 0
while index < sectcount:
secname = sects[index]
name = str("[" + secname + "]\n")
self.keymappreview.write(name)
keycode = 8
while keycode <= 137:
state = states[index]
ptr = GetLookupString(xdisplay, c_int(keycode), state)
output = cast(ptr, c_char_p).value.decode('utf-8')
self.keymappreview.write(output)
if keycode <= 137:
self.keymappreview.write("\n")
keycode += 1
index += 1
if index <= sectcount - 1:
self.keymappreview.write("\n")
xlib.XCloseDisplay(xdisplay)
self.keymapbrowser.appendPlainText(self.keymappreview.getvalue())
def saveKeymapFile(self):
fname = QtGui.QFileDialog.getSaveFileName(self, "Save keymap file as...", self.keymapname, "Ini files (*.ini)")
if fname[0] != "":
with open(fname[0], 'w') as keymapfile:
keymapfile.writelines(self.keymappreview.getvalue())
keymapfile.close()
def xrdpIniPreview(self):
preview_window = PreviewWindow()
preview_window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
if self.editingXrdpIni:
config = self.ConfigFileGenerator("xrdp.ini")
self.xrdp_ini_file.write(config, space_around_delimiters=False)
else:
config = self.ConfigFileGenerator("sesman.ini")
self.sesman_ini_file.write(config, space_around_delimiters=False)
preview_window.previewBrowser.appendPlainText(config.getvalue())
preview_window.previewBrowser.moveCursor(QtGui.QTextCursor.Start)
preview_window.exec_()
config.close()
def showAbout(self):
self.about_window.exec()
# GLOBALS --- Click/change event handlers...
def listeningaddresschanged(self):
if self.listeningAddressEntryBox.isModified():
if not self.xrdp_ini_file.has_option('globals', 'address'):
self.xrdp_ini_file.set('globals', 'address', '0.0.0.0')
self.xrdp_ini_file.set('globals', 'address', self.listeningAddressEntryBox.text())
self.xrdp_changed()
self.listeningAddressEntryBox.setStyleSheet(self.line_edit_changed_stylesheet)
def listeningportchanged(self):
if self.listeningPortEntryBox.isModified():
if not self.xrdp_ini_file.has_option('globals', 'port'):
self.xrdp_ini_file.set('globals', 'port', '3389')
self.xrdp_ini_file.set('globals', 'port', self.listeningPortEntryBox.text())
self.xrdp_changed()
self.listeningPortEntryBox.setStyleSheet(self.line_edit_changed_stylesheet)
# noinspection PyUnusedLocal
def maxBppChanged(self, arg):
if not self.xrdp_ini_file.has_option('globals', 'max_bpp'):
self.xrdp_ini_file.set('globals', 'max_bpp', '24')
self.xrdp_ini_file.set('globals', 'max_bpp', self.maxBppComboBox.currentText())
self.xrdp_changed()
self.maxBppComboBox.setStyleSheet(self.combobox_changed_stylesheet)
# noinspection PyUnusedLocal
def cryptLevelChanged(self, arg):
if not self.xrdp_ini_file.has_option('globals', 'crypt_level'):
self.xrdp_ini_file.set('globals', 'crypt_level', 'low')
self.xrdp_ini_file.set('globals', 'crypt_level', self.cryptLevelComboBox.currentText())
self.xrdp_changed()
self.cryptLevelComboBox.setStyleSheet(self.combobox_changed_stylesheet)
def autorunSessionChanged(self, index):
if index == 0:
self.xrdp_ini_file.remove_option('globals', 'autorun')
if index > 0:
if not self.xrdp_ini_file.has_option('globals', 'autorun'):
self.xrdp_ini_file.set('globals', 'autorun', '')
self.xrdp_ini_file.set('globals', 'autorun', self.autoRunComboBox.currentText())
self.xrdp_changed()
self.autoRunComboBox.setStyleSheet(self.combobox_changed_stylesheet)
def useBitMapCacheChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'bitmap_cache'):
self.xrdp_ini_file.set('globals', 'bitmap_cache', 'no')
if self.useBitMapCacheCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'bitmap_cache', "no")
else:
self.xrdp_ini_file.set('globals', 'bitmap_cache', "yes")
self.xrdp_changed()
self.useBitMapCacheCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def useBitMapCompChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'bitmap_compression'):
self.xrdp_ini_file.set('globals', 'bitmap_compression', 'no')
if self.useBitMapCompCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'bitmap_compression', "no")
else:
self.xrdp_ini_file.set('globals', 'bitmap_compression', "yes")
self.xrdp_changed()
self.useBitMapCompCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def useBulkCompChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'bulk_compression'):
self.xrdp_ini_file.set('globals', 'bulk_compression', 'no')
if self.useBulkCompCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'bulk_compression', "no")
else:
self.xrdp_ini_file.set('globals', 'bulk_compression', "yes")
self.xrdp_changed()
self.useBulkCompCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def enableChannelsChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'channel_code'):
self.xrdp_ini_file.set('globals', 'channel_code', 'no')
if self.enableChannelsCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'channel_code', "0")
else:
self.xrdp_ini_file.set('globals', 'channel_code', "1")
self.xrdp_changed()
self.enableChannelsCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def forkSessionsChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'fork'):
self.xrdp_ini_file.set('globals', 'fork', 'no')
if self.forkSessionsCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'fork', "no")
else:
self.xrdp_ini_file.set('globals', 'fork', "yes")
self.xrdp_changed()
self.forkSessionsCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def hideLogWindowChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'hidelogwindow'):
self.xrdp_ini_file.set('globals', 'hidelogwindow', 'no')
if self.hideLogWindowCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'hidelogwindow', "no")
else:
self.xrdp_ini_file.set('globals', 'hidelogwindow', "yes")
self.xrdp_changed()
self.hideLogWindowCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def tcpNodelayChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'tcp_nodelay'):
self.xrdp_ini_file.set('globals', 'tcp_nodelay', 'no')
if self.tcpNoDelayCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'tcp_nodelay', "no")
else:
self.xrdp_ini_file.set('globals', 'tcp_nodelay', "yes")
self.xrdp_changed()
self.tcpNoDelayCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def tcpKeepaliveChanged(self):
if not self.xrdp_ini_file.has_option('globals', 'tcp_keepalive'):
self.xrdp_ini_file.set('globals', 'tcp_keepalive', 'no')
if self.tcpKeepAliveCheckBox.checkState() == 0:
self.xrdp_ini_file.set('globals', 'tcp_keepalive', "no")
else:
self.xrdp_ini_file.set('globals', 'tcp_keepalive', "yes")
self.xrdp_changed()
self.tcpKeepAliveCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def requireCredentialsChanged(self):
if self.requireCredentialsCheckbox.checkState() == 2:
if not self.xrdp_ini_file.has_option('globals', 'require_credentials'):
self.xrdp_ini_file.set('globals', 'require_credentials', 'yes')
else:
if self.xrdp_ini_file.has_option('globals', 'require_credentials'):
self.xrdp_ini_file.remove_option('globals', 'require_credentials')
self.xrdp_changed()
self.requireCredentialsCheckbox.setStyleSheet(self.checkbox_changed_stylesheet)
def allowMultimonChanged(self):
if self.allowMultimonCheckBox.checkState() == 2:
if not self.xrdp_ini_file.has_option('globals', 'allow_multimon'):
self.xrdp_ini_file.set('globals', 'allow_multimon', 'true')
else:
if self.xrdp_ini_file.has_option('globals', 'allow_multimon'):
self.xrdp_ini_file.remove_option('globals', 'allow_multimon')
self.xrdp_changed()
self.allowMultimonCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
def pamErrorTextHandler(self):
if self.additionalPamErrorTextCheckbox.checkState() == 2:
self.pamErrorText.setEnabled(True)
if self.pamErrorText.isModified():
self.xrdp_ini_file.set('globals', 'pamerrortxt', self.pamErrorText.text())
self.pamErrorText.setStyleSheet(self.line_edit_changed_stylesheet)
self.xrdp_changed()
self.pamErrorText.setModified(0)
if self.additionalPamErrorTextCheckbox.checkState() == 0:
self.pamErrorText.setEnabled(False)
if self.xrdp_ini_file.has_option('globals', 'pamerrortxt'):
self.xrdp_ini_file.remove_option('globals', 'pamerrortxt')
self.xrdp_changed()
self.additionalPamErrorTextCheckbox.setStyleSheet(self.checkbox_changed_stylesheet)
def disableNewCursorsChanged(self):
if self.disableNewCursorsCheckBox.checkState() == 2:
self.xrdp_ini_file.set('globals', 'new_cursors', 'no')
else:
self.xrdp_ini_file.set('globals', 'new_cursors', 'yes')
self.xrdp_changed()
self.disableNewCursorsCheckBox.setStyleSheet(self.checkbox_changed_stylesheet)
# Set or unset the xrdp1 session for debugging XRDP if the debug checkbox is enabled by the user...
def debugClicked(self):
self.debugHandler(0, "xrdp1")
def debugHandler(self, index, secname):
# This function decides what to do when the Debug option on [xrdp1] is clicked (or not).
# It has to handle the re-ordering of tabs - hence the re-ordering of the xrdp.ini file,
# and 'hand the torch over' to whatever new tab/xrdpX section will become the [xrdp1] session.
# @param index: the number/id/index of the tab in question
# @param secname: the section name