Author: thardeck
Date: Mon Oct 10 15:37:46 2011
New Revision: 66364
URL: http://svn.opensuse.org/viewcvs/yast?rev=66364&view=rev
Log:
- fixed translation (bnc#722447)
- removed workaround for (bnc#718089)
- added IUCV Terminal module
- added IUCV Terminal Server module
Added:
trunk/s390/src/clients/iucvterminal-server.desktop
trunk/s390/src/clients/iucvterminal-server.ycp
trunk/s390/src/clients/iucvterminal.desktop
trunk/s390/src/clients/iucvterminal.ycp
trunk/s390/src/iucvterminal/
trunk/s390/src/iucvterminal-server/
trunk/s390/src/iucvterminal-server/Makefile.am
trunk/s390/src/iucvterminal-server/helps.ycp
trunk/s390/src/iucvterminal-server/ui.ycp
trunk/s390/src/iucvterminal/Makefile.am
trunk/s390/src/iucvterminal/ui.ycp
trunk/s390/src/modules/IUCVTerminal.ycp
trunk/s390/src/modules/IUCVTerminalServer.ycp
Modified:
trunk/s390/VERSION
trunk/s390/package/yast2-s390.changes
trunk/s390/src/clients/Makefile.am
trunk/s390/src/dump/ui.ycp
trunk/s390/src/modules/Dump.ycp
trunk/s390/src/modules/Makefile.am
trunk/s390/src/onpanic/ui.ycp
Modified: trunk/s390/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/VERSION?rev=66364&r1=66363&r2=66364&view=diff
==============================================================================
--- trunk/s390/VERSION (original)
+++ trunk/s390/VERSION Mon Oct 10 15:37:46 2011
@@ -1 +1 @@
-2.21.4
+2.21.5
Modified: trunk/s390/package/yast2-s390.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/package/yast2-s390.changes?rev=66364&r1=66363&r2=66364&view=diff
==============================================================================
--- trunk/s390/package/yast2-s390.changes (original)
+++ trunk/s390/package/yast2-s390.changes Mon Oct 10 15:37:46 2011
@@ -1,4 +1,16 @@
-------------------------------------------------------------------
+Thu Oct 10 10:55:11 UTC 2011 - thardeck@suse.com
+
+- fixed translation (bnc#722447)
+- removed workaround for (bnc#718089)
+
+-------------------------------------------------------------------
+Wed Sep 07 16:15:24 UTC 2011 - thardeck@suse.com
+
+- added IUCV Terminal module
+- added IUCV Terminal Server module
+
+-------------------------------------------------------------------
Tue Aug 29 11:57:31 UTC 2011 - thardeck@suse.com
- updated onpanic dialog to allow 8 vmcmd commands and a total of 128 chars
Modified: trunk/s390/src/clients/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/Makefile.am?rev=66364&r1=66363&r2=66364&view=diff
==============================================================================
--- trunk/s390/src/clients/Makefile.am (original)
+++ trunk/s390/src/clients/Makefile.am Mon Oct 10 15:37:46 2011
@@ -11,6 +11,8 @@
xpram.ycp \
dump.ycp \
onpanic.ycp \
+ iucvterminal.ycp \
+ iucvterminal-server.ycp \
inst_dasd.ycp \
inst_zfcp.ycp \
dasd_proposal.ycp \
@@ -21,7 +23,9 @@
dasd.desktop \
xpram.desktop \
dump.desktop \
- onpanic.desktop
+ onpanic.desktop \
+ iucvterminal.desktop \
+ iucvterminal-server.desktop
EXTRA_DIST = $(client_DATA) $(desktop_DATA)
Added: trunk/s390/src/clients/iucvterminal-server.desktop
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/iucvterminal-server.desktop?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/clients/iucvterminal-server.desktop (added)
+++ trunk/s390/src/clients/iucvterminal-server.desktop Mon Oct 10 15:37:46 2011
@@ -0,0 +1,23 @@
+[Desktop Entry]
+Type=Application
+Categories=Settings;System;Qt;X-SuSE-YaST;X-SuSE-YaST-Hardware;
+
+X-KDE-ModuleType=Library
+X-KDE-HasReadOnlyMode=true
+X-KDE-Library=yast2
+X-SuSE-YaST-Call=iucvterminal-server
+
+X-SuSE-YaST-Group=Network
+X-SuSE-YaST-Argument=
+X-SuSE-YaST-RootOnly=true
+X-SuSE-YaST-AutoInst=
+X-SuSE-YaST-Geometry=
+X-SuSE-YaST-SortKey=
+X-SuSE-YaST-AutoInstResource=
+
+Icon=yast-iucvterminal-server
+Exec=/sbin/yast2 iucvterminal-server
+
+Name=IUCV Terminal Server
+GenericName=Configure the IUCV Terminal Server
+StartupNotify=true
Added: trunk/s390/src/clients/iucvterminal-server.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/iucvterminal-server.ycp?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/clients/iucvterminal-server.ycp (added)
+++ trunk/s390/src/clients/iucvterminal-server.ycp Mon Oct 10 15:37:46 2011
@@ -0,0 +1,49 @@
+/**
+ * File: clients/iucvterminal-server.ycp
+ * Package: Configuration IUCV Terminal Server
+ * Summary: Main file
+ * Authors: Tim Hardeck
+ *
+ */
+
+{
+
+textdomain "s390";
+
+/* The main () */
+y2milestone ("----------------------------------------");
+y2milestone ("IUCV Terminal Server module started");
+
+import "CommandLine";
+include "s390/iucvterminal-server/ui.ycp";
+
+map cmdline_description = $[
+ "id" : "iucvterminal-server",
+ // Command line help text for the Xcontroller module
+ "help" : _("Configuration of IUCV Terminal Server"),
+ "guihandler" : IUCVTerminalServerSequence,
+ "actions" : $[
+ // FIXME TODO: fill the functionality description here
+ ],
+ "options" : $[
+ // FIXME TODO: fill the option descriptions here
+ ],
+ "mapping" : $[
+ // FIXME TODO: fill the mappings of actions and options here
+ ]
+];
+
+
+/* main ui function */
+any ret = CommandLine::Run(cmdline_description);
+
+y2debug("ret=%1", ret);
+
+/* Finish */
+y2milestone("IUCV Terminal Server module finished");
+y2milestone("----------------------------------------");
+
+return ret;
+
+/* EOF */
+}
Added: trunk/s390/src/clients/iucvterminal.desktop
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/iucvterminal.desktop?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/clients/iucvterminal.desktop (added)
+++ trunk/s390/src/clients/iucvterminal.desktop Mon Oct 10 15:37:46 2011
@@ -0,0 +1,23 @@
+[Desktop Entry]
+Type=Application
+Categories=Settings;System;Qt;X-SuSE-YaST;X-SuSE-YaST-Hardware;
+
+X-KDE-ModuleType=Library
+X-KDE-HasReadOnlyMode=true
+X-KDE-Library=yast2
+X-SuSE-YaST-Call=iucvterminal
+
+X-SuSE-YaST-Group=Network
+X-SuSE-YaST-Argument=
+X-SuSE-YaST-RootOnly=true
+X-SuSE-YaST-AutoInst=
+X-SuSE-YaST-Geometry=
+X-SuSE-YaST-SortKey=
+X-SuSE-YaST-AutoInstResource=
+
+Icon=yast-iucvterminal
+Exec=/sbin/yast2 iucvterminal
+
+Name=IUCV Terminals
+GenericName=Configure IUCV Terminals
+StartupNotify=true
Added: trunk/s390/src/clients/iucvterminal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/clients/iucvterminal.ycp?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/clients/iucvterminal.ycp (added)
+++ trunk/s390/src/clients/iucvterminal.ycp Mon Oct 10 15:37:46 2011
@@ -0,0 +1,49 @@
+/**
+ * File: clients/iucvterminal.ycp
+ * Package: Configuration IUCV Terminal Settings
+ * Summary: Main file
+ * Authors: Tim Hardeck
+ *
+ */
+
+{
+
+textdomain "s390";
+
+/* The main () */
+y2milestone ("----------------------------------------");
+y2milestone ("IUCV Terminal module started");
+
+import "CommandLine";
+include "s390/iucvterminal/ui.ycp";
+
+map cmdline_description = $[
+ "id" : "iucvterminal",
+ // Command line help text for the Xcontroller module
+ "help" : _("Configuration of IUCV Terminal Settings"),
+ "guihandler" : IUCVTerminalSequence,
+ "actions" : $[
+ // FIXME TODO: fill the functionality description here
+ ],
+ "options" : $[
+ // FIXME TODO: fill the option descriptions here
+ ],
+ "mapping" : $[
+ // FIXME TODO: fill the mappings of actions and options here
+ ]
+];
+
+
+/* main ui function */
+any ret = CommandLine::Run(cmdline_description);
+
+y2debug("ret=%1", ret);
+
+/* Finish */
+y2milestone("IUCV Terminal module finished");
+y2milestone("----------------------------------------");
+
+return ret;
+
+/* EOF */
+}
Modified: trunk/s390/src/dump/ui.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/dump/ui.ycp?rev=66364&r1=66363&r2=66364&view=diff
==============================================================================
--- trunk/s390/src/dump/ui.ycp (original)
+++ trunk/s390/src/dump/ui.ycp Mon Oct 10 15:37:46 2011
@@ -123,8 +123,10 @@
}
else
{
+ // count devices for proper grammatical number output
+ integer num_devices = size(splitstring(device," "));
// warn only in case of force
- if (!force || Popup::YesNo (sformat (_("The disk[s] %1 will be formatted as a dump device. All data on this device[s] will be lost! Continue?"), device)))
+ if (!force || Popup::YesNo (sformat (_("The disk %1 will be formatted as a dump device. All data on this device will be lost! Continue?", "The disks %1 will be formatted as a dump device. All data on these devices will be lost! Continue?", num_devices), device)))
{
boolean success = Dump::FormatDisk (device, force);
// don't quit in case of failures, error messages are reported by FormatDisk()
Added: trunk/s390/src/iucvterminal-server/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/iucvterminal-server/Makefile.am?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/iucvterminal-server/Makefile.am (added)
+++ trunk/s390/src/iucvterminal-server/Makefile.am Mon Oct 10 15:37:46 2011
@@ -0,0 +1,11 @@
+# Makefile.am for iucvterminal-server/src
+
+yncludedir = @yncludedir@/s390/iucvterminal-server
+
+ynclude_DATA = \
+ ui.ycp \
+ helps.ycp
+
+EXTRA_DIST = $(ynclude_DATA)
+
+include $(top_srcdir)/Makefile.am.common
Added: trunk/s390/src/iucvterminal-server/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/iucvterminal-server/helps.ycp?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/iucvterminal-server/helps.ycp (added)
+++ trunk/s390/src/iucvterminal-server/helps.ycp Mon Oct 10 15:37:46 2011
@@ -0,0 +1,70 @@
+/**
+ * File: include/s390/iucvterminal-server/helps.ycp
+ * Package: Configuration IUCV Terminal Server
+ * Summary: Help texts of all the dialogs
+ * Authors: Tim Hardeck
+ *
+ */
+
+{
+
+textdomain "s390";
+
+/**
+ * All helps are here
+ */
+ // zmvids ts_group ts_user ts ic
+map HELP = $[
+
+ /* z/VM IDs */
+ "zvmids" : _("<p><b><big>z/VM IDs</big></b></p>")
++ _("<p>To configure the IUCV Terminal Server the z/VM IDs which are to be used have to be specified.
+<br>They are separated by breaks from each other.</p>"),
+
+
+ /* TS-Shell */
+ "ts" : _("<p><b><big>TS-Shell</big></b></p>")
++ _("<p>TS-Shell allows the <b>Authorization</b> to be specified for every TS-Shell user and group. The rights of a group are inherited by their members.</p>")
+
++ _("<p>Each allowed z/VM IDs are either selected manually under <b>Selection</b>, defined by a <b>Regex</b> or loaded from a <b>File</b> which consist all allowed z/VM IDs separated by breaks.</p>")
+
++ _("<p>By clicking on the button <b>New User</b> addtional TS-Shell users could be created and also deleted by using <b>Delete User</b>.</p>")
+
++ _("<p>To add or remove groups from the TS-Shell authorization table or to change the membership of them <b>Manage Groups</b> has to be called.</p>")
+
++ _("<p>With <b>Audited IDs</b> the z/VM IDs could be specified from which transcripts should be gathered."),
+
+
+ /* TS-Shell User creation dialog */
+ "ts-user" : _("<p><b><big>New TS-Shell User</big></b></p>")
++ _("<p>To create new TS-Shell user the <b>Username</b>, <b>Home Directory</b> and <b>Password</b> has to be provided.
+ <br>It is also possible to specify <b>Additional Groups</b> by selecting them on the right.</p>")
+
++ _("<p>To ensure that the user changes his password after the first Login <b>Force Password Change</b> has to be activated.</p>")
+
++ _("<p>The home directory could be the same for every TS-SHell user since it is not used for saving purposes.</p>"),
+
+
+ /* TS-Shell Managing Groups Dialog */
+ "ts-group" : _("<p><b><big>Mange Groups for TS-Authorization</big></b></p>")
++ _("<p>It is possible to define TS-Shell authorizations per group so every TS-Shell member of this groups inherits these rights.</p>")
+
++ _("<p>Already existing groups could be added to or removed from the TS-Shell authorization by selecting them in the table and clicking on <b>Select or Deselect</b>. The current status is shown in the column <b>TS-Auth</b>.</p>")
+
++ _("<p>TS-Shell members of the selected group could be changed in the <b>TS-Members</b> selection on the side.</p>")
+
++ _("<p>New groups could be created by entering the name in the <b>New Group</b> input field and confirming with <b>Create</b>.
+ <br>To delete previously created groups the <b>YaST users</b> dialog has to be used.</p>")
+
++ _("<p>Changes in this dialog could be undone by using the <b>Back</b> button.<p>"),
+
+
+ /* IUCVConn on Login */
+ "ic" : _("<p><b><big>IUCVConn on Login</big></b></p>")
++ _("<p>IUCVConn on Login needs one user for every z/VM ID. To create these users a <b>password</b> and <b>home directory</b> has to be provided.
+ <br>It is possible to sync the users manually by clicking on <b>Sync</b> or just confirming the changes with <b>Ok</b> while <b>IUCVConn on Login</b> is enabled. </p>"),
+
+
+];
+/* EOF */
+}
Added: trunk/s390/src/iucvterminal-server/ui.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/iucvterminal-server/ui.ycp?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/iucvterminal-server/ui.ycp (added)
+++ trunk/s390/src/iucvterminal-server/ui.ycp Mon Oct 10 15:37:46 2011
@@ -0,0 +1,1339 @@
+/**
+ * File: include/s390/iucvterminal-server/ui.ycp
+ * Package: Configuration IUCV Terminal Server
+ * Summary: Dialogs definitions
+ * Authors: Tim Hardeck
+ *
+ */
+
+{
+
+textdomain "s390";
+
+import "IUCVTerminalServer";
+import "Label";
+import "Popup";
+import "Wizard";
+import "Integer";
+import "String";
+import "Users";
+
+include "s390/iucvterminal-server/helps.ycp";
+
+/**
+ * Hspacing value between most dialog fields
+ */
+define const float HSPACING = 0.5;
+
+/**
+ * Vspacing value between most dialog fields
+ */
+define const float VSPACING = 0.3;
+
+/**
+ * Text to select all
+ */
+define const string TEXT_ALL = IUCVTerminalServer::TEXT_ALL;
+
+/**
+ * Text approval
+ */
+define const string TEXT_YES = _("Yes");
+
+/**
+ * Text disapproval
+ */
+define const string TEXT_NO = _("No");
+
+/**
+ * Text for category user
+ */
+define const string TEXT_USER = _("user");
+
+/**
+ * Text for category group
+ */
+define const string TEXT_GROUP = _("group");
+
+/**
+ * list of all z/VM IDs
+ */
+define list<string> zvm_id_list = [];
+
+/**
+ * z/VM ID widget entries (List with TEXT_ALL element)
+ */
+define list<string> zvm_id_entries = [];
+
+/**
+ * Current active tab in the main dialog
+ */
+define symbol current_main_tab = `t_zvmids;
+
+/**
+ * Current active dialog
+ */
+define symbol current_dialog = `main_window;
+
+/**
+ * Is TS-Shell activated?
+ */
+define boolean ts_enabled = false;
+
+/**
+ * TS-Shell password
+ */
+define string ts_password = "";
+
+/**
+ * TS-Shell home directory
+ */
+define string ts_home = "";
+
+/**
+ * Currently selected TS-Shell user/group entry
+ */
+define string ts_selected_member = "";
+
+/**
+ * File/Regex map per TS-Shell user/groups
+ * the key of the first map is the user/group name
+ * the key of the second map is the selected radio button symbol
+ */
+define map > ts_member_conf = $[ ];
+
+/**
+ * List of audited z/VM IDs during TS-Shell sessions
+ * item(id, zvmid, activated)
+ */
+define list<string> ts_audited_ids = [];
+
+/**
+ * Temporary storage for TS-Shell group items to be able to undo changes
+ */
+define list<term> ts_groups_items = [];
+
+/**
+ * Is IUCVConn activated?
+ */
+define boolean ic_enabled = false;
+
+/**
+ * IUCVConn home directory
+ */
+define string ic_home = "";
+
+/**
+ * IUCVConn password
+ */
+define string ic_password = "";
+
+/* Declaration */
+void HandleEvent( symbol widget );
+
+/**
+ * Get a list of local groups without the default users group
+ * @return map of groups
+ */
+map GetGroupsWithoutUsers() {
+ map groups = IUCVTerminalServer::GetGroups(true);
+ groups = remove(groups, "users");
+ return groups;
+}
+
+/**
+ * Generates the IUCVConn users table list
+ * @return list<term> of items
+ */
+define list<term> GenerateIcUsersTable() {
+ list<string> ic_users = IUCVTerminalServer::GetIcUsersList();
+ list<term> ic_items = [];
+ foreach (string username, ic_users, {
+ map user = Users::GetUserByName(username, "local");
+ ic_items = add( ic_items, `item(`id(user["uid"]:nil), user["uid"]:"", user["uidNumber"]:"", user["homeDirectory"]:"", user["loginShell"]:""));
+ });
+ return ic_items;
+}
+
+/**
+ * Generates the TS-Shell Authorization table (for users and groups)
+ * @return list<term> of items
+ */
+define list<term> GenerateTsMembersTable() {
+ list <term> ts_users_groups = [];
+ foreach (string name, map conf, ts_member_conf, {
+ if (regexpmatch(name, "^@"))
+ { //group
+ // remove the leading @
+ string groupname = substring(name, 1);
+ map group = Users::GetGroupByName(groupname, "local");
+
+ list <string> userlist = maplist ( string k, string v, group["userlist"]:$[], { return k; });
+ // filter non ts users
+ userlist = filter (string username, userlist, { return (haskey(ts_member_conf, username)); });
+ string group_members = mergestring(userlist, ",");
+
+ ts_users_groups = add( ts_users_groups, `item(`id(name), TEXT_GROUP, groupname, group["gidNumber"]:"", group_members));
+ }
+ else
+ { //user
+ map user = Users::GetUserByName(name, "local");
+ list <string> grouplist = maplist ( string k, string v, user["grouplist"]:$[], { return k; });
+ string groups = mergestring(grouplist, ",");
+ ts_users_groups = add( ts_users_groups, `item(`id(user["uid"]:nil), TEXT_USER, user["uid"]:nil, user["uidNumber"]:nil, groups, user["homeDirectory"]:nil ));
+ }
+ });
+
+ return ts_users_groups;
+}
+
+term ZvmIdsDialogContent() {
+ term content = `HBox(`HSpacing(HSPACING),`VBox(
+ `VSpacing(VSPACING),
+ `MultiLineEdit( `id( `zvmids ), `opt(`notify), _("z/&VM IDs"), mergestring(zvm_id_list, "\n") ),
+ `VSpacing(VSPACING)
+ ),`HSpacing(HSPACING));
+ return content;
+}
+
+term TsShellDialogContent() {
+ term content = `HBox(
+ `HSpacing(HSPACING),
+ `VBox(
+ `VSpacing(VSPACING),
+ `Left(
+ `CheckBox (`id (`ts_enabled), `opt(`notify), _("&Enable TS-Shell"), ts_enabled)
+ ),
+ `VSpacing(VSPACING),
+ `HBox(
+ `HWeight(13,
+ `Frame(`id(`f_ts_configuration), _("Authorization"),
+ `VBox(
+ `VSpacing(VSPACING),
+ `HBox(
+ `HSpacing(HSPACING),
+ `HWeight(11, `VBox(
+ `Table(`id (`ts_users_groups), `opt(`notify, `immediate), `header(
+ // table header
+ _("Type"),
+ // table header
+ _("Name"),
+ // table header
+ _("UID/GID"),
+ // table header
+ _("Groups/Members")
+ ), GenerateTsMembersTable() ),
+ `HBox(
+ `PushButton(`id(`ts_open_user_dialog), _("&New User") ),
+ `HSpacing(HSPACING),
+ `PushButton(`id(`ts_delete_user), _("&Delete User") ),
+ `HSpacing(HSPACING),
+ `PushButton(`id(`ts_open_group_dialog), _("&Manage Groups") ),
+ `HStretch()
+ )
+ )),
+
+ `HSpacing(HSPACING),
+
+ `HWeight(5, `Frame(`id(`f_ts_member_conf),_("Allowed z/VM IDs"),
+ `HBox(
+ `HSpacing(HSPACING),
+ `RadioButtonGroup(`id(`ts_auth_type),
+ `VBox(
+ `Heading(`id(`ts_label), `opt(`hstretch), ts_selected_member),
+ `Left(`RadioButton(`id(`rb_ts_list), `opt(`notify), _("&Selection"),
+ ts_member_conf[ts_selected_member, `type]:nil == `rb_ts_list)),
+ // force min size to make it easier readable in terminals
+ `MinWidth(14, `MultiSelectionBox( `id(`ts_auth_ids), `opt(`notify, `vstretch), "" , zvm_id_entries)),
+ `Left(`RadioButton(`id(`rb_ts_regex), `opt(`notify), _("&Regex"),
+ ts_member_conf[ts_selected_member, `type]:nil == `rb_ts_regex)),
+ `InputField(`id(`ts_auth_regex), `opt(`notify, `hstretch),"",""),
+ `Left(`RadioButton(`id(`rb_ts_file), `opt(`notify), _("&File"),
+ ts_member_conf[ts_selected_member, `type]:nil == `rb_ts_file)),
+ `HBox(
+ `InputField(`id(`ts_auth_file), `opt(`notify, `hstretch),"",""),
+ `PushButton(`id(`ts_auth_file_browse), _("Bro&wse") )),
+ `VSpacing(VSPACING)
+ )),
+ `HSpacing(HSPACING)
+ )
+ )),
+ `HSpacing(HSPACING)
+ ),
+ `VSpacing(VSPACING)
+ )
+ )),
+
+ `HSpacing(HSPACING),
+
+ `HWeight(3,
+ `VBox(
+ `VSpacing(VSPACING),
+ // force min size to make it easier readable in terminals
+ `MinWidth(14, `MultiSelectionBox(`id(`ts_audited_ids), `opt(`notify), _("&Auditied IDs"), zvm_id_entries)),
+ `VSpacing(VSPACING)
+ )
+ )
+ )),
+ `HSpacing(HSPACING)
+ );
+ return content;
+}
+
+term IucvConnDialogContent() {
+ term content =
+ `HBox(
+ `HSpacing(HSPACING),
+ `VBox(
+ `VSpacing(VSPACING),
+ `CheckBoxFrame (`id (`ic_enabled), `opt(`notify), _("&Enable IUCVConn on Login"), ic_enabled,
+ `VBox(
+ `VSpacing(VSPACING),
+ `HBox(
+ `HSpacing(HSPACING),
+ `HWeight(5, `Table(`id (`ic_users), `opt(`vstretch), `header(
+ // table header
+ _("Login"),
+ // table header
+ _("UID"),
+ // table header
+ _("Home"),
+ // table header
+ _("Shell")
+ ), GenerateIcUsersTable() )),
+ `HWeight(2, `Frame(_("Settings for new Users"),`VBox(
+ `Top(`Password (`id (`ic_pw1), `opt(`notify, `hstretch), _("&Password"), ic_password)),
+ `VSpacing(VSPACING),
+ `Top(`Password (`id (`ic_pw2), `opt(`notify, `hstretch), _("Co&nfirm Password"), ic_password)),
+ `VSpacing(VSPACING * 2),
+ `Top( `VBox( `InputField(`id(`ic_home), `opt(`hstretch), _("&Home Directory"), ic_home),
+ `PushButton(`id(`ic_browse_home), _("B&rowse") ))),
+ `VStretch(),
+ `PushButton(`id(`ic_sync), _("&Sync") )
+ ))),
+ `HSpacing(HSPACING)
+ ),
+ `VSpacing(VSPACING)
+ )
+ ),
+ `VSpacing(VSPACING)
+ ),
+ `HSpacing(HSPACING)
+ );
+
+ return content;
+}
+
+term TsUserDialogContent() {
+ // initialize list with additional groups
+ list<string> groups = maplist ( string name, map v, GetGroupsWithoutUsers(), { return name; });
+
+ term content = `HBox (
+ `HWeight (1, `VBox(
+ `VSpacing(1),
+ `Top (`InputField (`id (`ts_username), `opt (`hstretch),_("&Username"), "")),
+ `VSpacing(1),
+ `Top (`HBox(
+ `InputField(`id(`ts_home), `opt (`hstretch), _("&Home Directory"), ts_home),
+ `HSpacing(HSPACING),
+ `PushButton(`id(`ts_browse_home), _("B&rowse") )
+ )),
+
+ `VSpacing(1),
+ `Top (
+ `Password(`id(`ts_pw1), `opt (`notify, `hstretch), _("&Password"), "")
+ ),
+ `Top (
+ `Password(`id(`ts_pw2), `opt (`notify, `hstretch), _("Co&nfirm Password"), "")
+ ),
+ `Top (
+ `CheckBox (`id (`ts_force_pw_change), _("&Force Password Change"), false)
+ )
+
+ )),
+ `HSpacing(2),
+ `HWeight (1, `VBox(
+ `VSpacing(1),
+ `MultiSelectionBox (`id(`ts_additional_groups), _("&Additonal Groups"), groups)
+ ,
+ `VSpacing(1)
+ )));
+ return content;
+}
+
+term TsGroupDialogContent() {
+ term content = `VBox(`VSpacing(VSPACING),
+ `HBox(
+ `HSpacing(HSPACING),
+ `HWeight(4, `VBox(
+ `Table (`id(`ts_table_add_groups), `opt(`notify, `immediate), `header(
+ // table header
+ _("Name"),
+ // table header
+ _("TS-Auth"),
+ // table header
+ _("GID"),
+ // table header
+ _("TS-Members")), []),
+ `HBox(
+ `PushButton(`id(`ts_groups_select), _("&Select or Deselect") ),
+ `HStretch(),
+ `PushButton(`id(`ts_groups_create), _("C&reate") ),
+ `HSpacing(HSPACING),
+ `InputField(`id(`ts_groups_name), _("&New Group"), "")
+ )
+ )),
+ `HSpacing(HSPACING),
+ `HWeight(1, `MultiSelectionBox (`id(`ts_groups_members), `opt(`notify), _("TS-&Members"),
+ IUCVTerminalServer::GetTsUsersList())),
+ `HSpacing(HSPACING) ));
+ return content;
+}
+
+term MainDialogContent()
+{
+ // draw active tab
+ term widgets = nil;
+ if ( current_main_tab == `t_zvmids )
+ widgets = ZvmIdsDialogContent();
+ else if ( current_main_tab == `t_tsshell )
+ widgets = TsShellDialogContent();
+ else
+ widgets = IucvConnDialogContent();
+
+ term contents = `VBox(
+ `DumbTab(`id(`tab),
+ [`item(`id(`t_zvmids), _("&z/VM IDs")),
+ `item(`id(`t_tsshell), _("&TS-Shell")) ,
+ `item(`id(`t_iucvconn), _("&IUCVConn")) ],
+ `ReplacePoint(`id(`tab_content), widgets)
+ )
+ );
+ return contents;
+}
+
+
+/**
+ * Initializes the main dialogs (zvmid, ts-shell and iucvconn)
+ * @param the symbol of the activated tab
+ * @return void
+ */
+void InitMainDialog(symbol tab) {
+ // remember current tab
+ current_main_tab = tab;
+ if (tab == `t_zvmids)
+ {
+ UI::ChangeWidget(`id(`zvmids), `Value, mergestring(zvm_id_list, "\n"));
+ }
+ else if (tab == `t_tsshell)
+ {
+ // disable frames if TS-Shell is disabled
+ HandleEvent(`ts_enabled);
+
+ if (ts_selected_member != "")
+ {
+ UI::ChangeWidget(`id(`ts_users_groups), `CurrentItem, ts_selected_member);
+ }
+
+ // filter not anymore existing entries after the z/VM ids have been updated
+ ts_audited_ids = filter (string name, ts_audited_ids, { return (contains(zvm_id_entries, name)); });
+ UI::ChangeWidget(`id(`ts_audited_ids), `SelectedItems, ts_audited_ids );
+ // mark all if selected and new entries were inserted
+ HandleEvent(`ts_audited_ids);
+
+ HandleEvent((symbol) ts_member_conf[ts_selected_member, `type]:nil);
+ HandleEvent(`ts_users_groups);
+
+ // ts_auth_ids has to be behind ts_users_groups otherwise the selection is gone after a tab change
+ HandleEvent(`ts_auth_ids);
+ }
+}
+
+/**
+ * Initializes the TS-Shell group dialog for managing groups
+ * @return void
+ */
+define void InitTsGroupDialog() {
+ list<term> items = [];
+
+ map group_map = GetGroupsWithoutUsers();
+
+ foreach (string name, map group, group_map, {
+ // show if the group is already used for TS-Authentication
+ string ts_auth_status = TEXT_YES;
+ // groups ids start with @
+ if (!haskey(ts_member_conf, "@" + name))
+ {
+ ts_auth_status = TEXT_NO;
+ }
+
+ list <string> userlist = maplist ( string k, string v, group["userlist"]:$[], { return k; });
+ // filter non ts users
+ userlist = filter (string username, userlist, { return (haskey(ts_member_conf, username)); });
+
+ // convert group members to a string separated by comma for the table
+ string group_members = mergestring(userlist, ",");
+ items = add(items, `item(`id(name), name, ts_auth_status, group["gidNumber"]:nil, group_members));
+ });
+
+ // save items for modification check
+ ts_groups_items = items;
+
+ UI::ChangeWidget(`id(`ts_table_add_groups), `Items, items );
+ HandleEvent(`ts_table_add_groups);
+}
+
+
+/**
+ * Checks the input for the new user and creates it if valid
+ * @return true if successful
+ */
+boolean CommitTsUserDialogSettings () {
+ string username = tolower((string) UI::QueryWidget (`id (`ts_username), `Value));
+ string password = (string) UI::QueryWidget (`id (`ts_pw1), `Value);
+ string home = (string) UI::QueryWidget (`id (`ts_home), `Value);
+ map users = IUCVTerminalServer::GetUsers(false);
+
+ // check and commit password
+
+ boolean ret = true;
+
+ if (ts_password == "")
+ {
+ UI::SetFocus(`ts_pw1);
+ Popup::Notify(_("The passwords doesn't match or are invalid."));
+ ret = false;
+ }
+ // check if the user specifcation is valid and if the name does already exist
+ else if (!IUCVTerminalServer::CheckUserGroupName(username) || haskey(users, username))
+ {
+ UI::SetFocus(`ts_username);
+ Popup::Notify(_("The username is not valid!"));
+ ret = false;
+ }
+ else if (!regexpmatch(home, "^\/"))
+ {
+ UI::SetFocus(`ts_home);
+ Popup::Notify(_("A home directory has to be specified!"));
+ ret = false;
+ }
+ else
+ {
+ ts_home = home;
+
+ list<string> grouplist = (list<string>) UI::QueryWidget (`id (`ts_additional_groups), `SelectedItems);
+ string groups = mergestring(grouplist, ",");
+ map groupmap = listmap (string g, grouplist, { return $[g:"1"]; });
+
+ boolean force_pw_change = (boolean) UI::QueryWidget(`id (`ts_force_pw_change), `Value);
+
+ string new_uid = IUCVTerminalServer::AddTsUser(username, password, home, groupmap, force_pw_change);
+ if (new_uid != "")
+ {
+ ts_member_conf = add(ts_member_conf, username,
+ $[ `type : (symbol)`rb_ts_list,
+ `rb_ts_list : (list <string>) [ ],
+ `rb_ts_regex: (string) "",
+ `rb_ts_file : (string) ""
+ ]);
+ }
+ else
+ {
+ Popup::Notify(_("Adding the user has failed."));
+ ret = false;
+ }
+ }
+ return ret;
+}
+
+/**
+ * Extracts the groups and settings from the TsGroupTable items and updates the
+ * users and groups settings accordingly
+ * @return void
+ */
+void CommitTsGroupDialogSettings () {
+ list<term> items = (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items);
+ map groups = IUCVTerminalServer::GetGroups(true);
+
+ foreach (term line, items, {
+ boolean is_ts_auth_group = (line[2]:"" == TEXT_YES);
+ string groupname = line[1]:"";
+ list<string> userlist = splitstring(line[4]:"", ",");
+ map usermap = listmap (string k, userlist, { return $[k:"1"]; });
+
+ // if group doesn't exist create it otherwise edit its userlist
+ if (!haskey(groups, groupname))
+ {
+ map group = $["cn" : groupname,
+ "userlist" : usermap ];
+
+ string error = Users::AddGroup(group);
+ if (error == "")
+ {
+ Users::CommitGroup();
+ }
+ else
+ {
+ y2milestone("Adding the group %1 failed because of: %2", groupname, error);
+ }
+ }
+ else
+ {
+ if (groups[groupname, "userlist"]:$[] != usermap)
+ {
+ Users::SelectGroupByName(groupname);
+ map group = Users::GetCurrentGroup ();
+
+ // filter all TS-Entries from current user list to remove deselected ones
+ map non_ts_users_list = filter (string username, string number, group["userlist"]:$[], { return (!haskey(ts_member_conf, username)); });
+ group["userlist"] = union(non_ts_users_list, usermap);
+
+ string error = Users::EditGroup(group);
+ if (error == "")
+ {
+ Users::CommitGroup();
+ }
+ else
+ {
+ y2milestone("Editing the group %1 failed because of: %2", groupname, error);
+ }
+ }
+ }
+
+ // groups start with an @
+ string identification = "@" + groupname;
+ // check if the group should be added and was not already used for TS auth
+ if (!haskey(ts_member_conf, identification))
+ {
+ if (is_ts_auth_group)
+ {
+ string group_members = mergestring(userlist, ",");
+ map group = Users::GetGroupByName(groupname, "");
+ string gid = group["gidNumber"]:"";
+
+ // add ts_member_conf
+ ts_member_conf = add(ts_member_conf, identification,
+ $[ `type : (symbol)`rb_ts_list,
+ `rb_ts_list : (list <string>) [ ],
+ `rb_ts_regex: (string) "",
+ `rb_ts_file : (string) ""
+ ]);
+ }
+ }
+ else
+ {
+ // delete group entry if disabled
+ if (!is_ts_auth_group)
+ {
+ integer i = 0;
+ ts_member_conf = remove(ts_member_conf, identification);
+ }
+ }
+ });
+}
+
+
+void DrawMainDialog() {
+ Wizard::SetContentsButtons(_("Configure IUCV Terminal Server Settings"), MainDialogContent(),
+ HELP["zvmids"]:"", Label::BackButton (), Label::OKButton ());
+ Wizard::HideBackButton();
+ Wizard::SetAbortButton(`abort, Label::CancelButton());
+
+ // change tab selection to active tab
+ UI::ChangeWidget (`id (`tab), `CurrentItem, current_main_tab);
+
+ // update screen
+ HandleEvent(current_main_tab);
+}
+
+void DrawTsUserDialog() {
+ Wizard::SetContentsButtons(_("New TS-Shell User"), TsUserDialogContent(),
+ HELP["ts-user"]:"", Label::BackButton (), Label::CreateButton ());
+ Wizard::SetAbortButton(`abort, Label::CancelButton());
+}
+
+void DrawTsGroupDialog() {
+ Wizard::SetContentsButtons(_("Manage Groups for TS-Authorization"), TsGroupDialogContent(),
+ HELP["ts-group"]:"", Label::BackButton (), Label::OKButton ());
+ Wizard::SetAbortButton(`abort, Label::CancelButton());
+
+ // initialize dialog
+ InitTsGroupDialog();
+}
+
+
+/**
+ * Updates the TS-Shell Group table widget with new items and tries to keep the current selection
+ * @param list<term> of table items
+ * @return void
+ */
+void UpdateTsGroupTable (list<term> items) {
+ // save current table position
+ string ts_group_table_position = (string) UI::QueryWidget(`id(`ts_table_add_groups), `CurrentItem);
+
+ UI::ChangeWidget(`id(`ts_table_add_groups), `Items, items );
+
+ // change to the old position if possible
+ if (ts_group_table_position != nil)
+ {
+ UI::ChangeWidget(`id(`ts_table_add_groups), `CurrentItem, ts_group_table_position);
+ }
+
+ // update the member selection
+ HandleEvent(`ts_table_add_groups);
+}
+
+/**
+ * Extracts the TS-Members of the selected groups from the TS-Shell Group Table entries
+ * @return void list<string> of group members
+ */
+list<string> GetTsGroupTableUserList() {
+ // get table items and position
+ list<term> items = (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items);
+ string current_group = (string) UI::QueryWidget(`id(`ts_table_add_groups), `CurrentItem);
+
+ // extract current item
+ term item = find (term entry, items, ``(entry[0]:nil == `id(current_group)));
+
+ // create a list with users
+ string users = item[4]:"";
+ list<string> users_list = splitstring(users, ",");
+
+ return users_list;
+}
+
+/**
+ * Changes the userlist of the TS-Shell Group entry at the current position
+ * @param list<string> of members
+ * @return void
+ */
+void SetTSGroupTableUserList(list<string> new_list) {
+ // get table items and position
+ list<term> items = (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items);
+ string current_group = (string) UI::QueryWidget(`id(`ts_table_add_groups), `CurrentItem);
+
+ integer i = 0;
+ foreach (term entry, items, {
+ if (entry[1]:"" == current_group)
+ {
+ entry[4] = mergestring(new_list, ",");
+ items[i] = entry;
+ break;
+ }
+ i = i + 1;
+ });
+
+ UpdateTsGroupTable(items);
+}
+
+
+string CheckPassword(symbol field1, symbol field2) {
+ string pw1 = (string) UI::QueryWidget (`id (field1), `Value);
+ if (pw1 != "" && pw1 == (string) UI::QueryWidget (`id (field2), `Value))
+ {
+ return pw1;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+/**
+ * Checks if the user specified z/VM ID list is valid and otherwise shows
+ * a popup what's incorrect
+ * @return boolean true if the list is valid
+ */
+define boolean IsValidZvmIdList() {
+ boolean ret = true;
+ string text = (string) UI::QueryWidget (`id (`zvmids), `Value);
+ list<string> zvmid_list = splitstring(text, "\n");
+
+ // determine last entry
+ integer lines = size(zvmid_list);
+ integer line = 0;
+ foreach (string zvmid, zvmid_list,{
+ line = line + 1;
+ if (regexpmatch(zvmid, "[^a-zA-Z0-9]"))
+ {
+ Popup::Notify(sformat(_("Wrong z/VM ID \"%1\" in line %2, only letters and numbers are allowed."), zvmid, line));
+ ret = false;
+ break;
+ }
+ else if (regexpmatch(zvmid, "^[0-9]"))
+ {
+ Popup::Notify(sformat(_("Wrong z/VM ID \"%1\" in line %2, numbers at the beginning are not allowed."), zvmid, line));
+ ret = false;
+ break;
+ }
+ else if (regexpmatch(zvmid, "[a-z0-9]{9,}"))
+ {
+ Popup::Notify(sformat(_("Wrong z/VM ID \"%1\" in line %2, more than eight characters are not allowed."), zvmid, line));
+ ret = false;
+ break;
+ }
+ // only the last entry is allowed to be empty
+ else if (zvmid == "" && line != lines)
+ {
+ Popup::Notify(sformat(_("Wrong z/VM ID \"%1\" in line %2, at least one letter is required."), zvmid, line));
+ ret = false;
+ break;
+ }
+ });
+ return ret;
+}
+
+/**
+ * Checks if IUCVConn users have to be synced and if the required information is provided
+ * @return boolean true if the list is already synced or was synced
+ */
+boolean SyncIucvConnUsers() {
+ boolean ret = false;
+
+ // check if the ic users list is different since the start
+ if (zvm_id_list != IUCVTerminalServer::GetIcUsersList())
+ {
+ // check password
+ if (ic_password == "")
+ {
+ Popup::Notify(_("A correctly entered password to sync IUCVConn users is required."));
+ }
+ // check home directory
+ else if (!regexpmatch(ic_home, "^\/"))
+ {
+ Popup::Notify(_("The specified IUCVConn home directory is invalid."));
+ }
+ else
+ {
+ IUCVTerminalServer::ic_home = ic_home;
+ IUCVTerminalServer::SyncIucvConnUsers(zvm_id_list, ic_password);
+ UI::ChangeWidget(`id(`ic_users), `Items, GenerateIcUsersTable());
+ ret = true;
+ }
+ }
+ else
+ {
+ ret = true;
+ }
+ return ret;
+}
+
+/**
+ * Updates the MultiSelectionBoxes of z/VM IDs according to user interaction to de/select all at once
+ * @param list<string> of previous defined ids and the MultiSelectionBox symbol to get the new id selection
+ * @return list<string> of items to select
+ */
+list<string> UpdateIdSelections(list<string> previous_ids, symbol widget) {
+ list<string> ids = (list<string>) UI::QueryWidget( `id(widget), `SelectedItems);
+
+ // make sure that only available ids are compared
+ previous_ids = filter (string name, previous_ids, { return (contains(zvm_id_entries, name)); });
+
+ if (previous_ids != ids)
+ {
+ // check if TEXT_ALL was previously selected
+ boolean was_all_selected = (previous_ids[0]:"" == TEXT_ALL);
+ if (was_all_selected)
+ {
+ if (ids[0]:"" == TEXT_ALL)
+ {
+ // remove TEXT_ALL entry if something else is deactivated
+ ids = remove(ids, 0);
+ }
+ else
+ {
+ // if TEXT_ALL was explicitly deactivated disable all
+ ids = [];
+ }
+ }
+
+ // activate all if selected
+ if (ids[0]:nil == TEXT_ALL)
+ {
+ ids = zvm_id_entries;
+ }
+ UI::ChangeWidget(`id(widget), `SelectedItems, ids );
+ }
+ else
+ {
+ // activate all if selected and no user change was committed
+ if (ids[0]:"" == TEXT_ALL)
+ {
+ ids = zvm_id_entries;
+ UI::ChangeWidget(`id(widget), `SelectedItems, ids );
+ }
+ }
+ return ids;
+}
+
+
+/**
+ * Handle user interaction
+ * @param symbol of activated widget
+ * @return void
+ */
+void HandleEvent( symbol widget )
+{
+ if (widget == `ic_enabled)
+ {
+ ic_enabled = (boolean)UI::QueryWidget (`id (`ic_enabled), `Value);
+ }
+
+ if (widget == `ts_enabled)
+ {
+ ts_enabled = (boolean)UI::QueryWidget (`id (`ts_enabled), `Value);
+ UI::ChangeWidget(`id(`f_ts_configuration), `Enabled, ts_enabled);
+ UI::ChangeWidget(`id(`ts_audited_ids), `Enabled, ts_enabled);
+ }
+
+ if (widget == `rb_ts_list || widget == `rb_ts_regex || widget == `rb_ts_file)
+ {
+ if (haskey(ts_member_conf, ts_selected_member))
+ {
+ ts_member_conf[ts_selected_member, `type] = widget;
+ }
+ UI::ChangeWidget(`id(`ts_auth_ids), `Enabled, widget == `rb_ts_list);
+ UI::ChangeWidget(`id(`ts_auth_regex), `Enabled, widget == `rb_ts_regex);
+ UI::ChangeWidget(`id(`ts_auth_file), `Enabled, widget == `rb_ts_file);
+ UI::ChangeWidget(`id(`ts_auth_file_browse), `Enabled, widget == `rb_ts_file);
+ }
+
+ if (widget == `ts_auth_ids)
+ {
+ ts_member_conf[ts_selected_member, `rb_ts_list] = UpdateIdSelections(ts_member_conf[ts_selected_member, `rb_ts_list]:[], `ts_auth_ids);
+ }
+
+ if (widget == `ts_audited_ids)
+ {
+ ts_audited_ids = UpdateIdSelections(ts_audited_ids, `ts_audited_ids);
+ }
+
+ if (widget == `ts_auth_regex)
+ {
+ ts_member_conf[ts_selected_member, `rb_ts_regex] = (string) UI::QueryWidget (`id (`ts_auth_regex), `Value);
+ }
+
+
+ if (widget == `ts_users_groups)
+ {
+ boolean ts_isnt_empty = (size(GenerateTsMembersTable()) > 0);
+ if (ts_isnt_empty)
+ {
+ ts_selected_member = (string) UI::QueryWidget (`id (`ts_users_groups), `CurrentItem);
+ }
+ else
+ {
+ ts_selected_member = "";
+ }
+
+ // show the current selected user
+ UI::ChangeWidget(`id(`ts_label), `Value, ts_selected_member);
+
+ // update selected z/VM IDs
+ UI::ChangeWidget( `id(`ts_auth_ids), `SelectedItems, ts_member_conf[ts_selected_member, `rb_ts_list]:[]);
+
+ // select the correct radio box (default is `rb_ts_list)
+ UI::ChangeWidget(`id(`ts_auth_type), `CurrentButton, ts_member_conf[ts_selected_member, `type]:`rb_ts_list);
+ // deactivate the other radio box settings
+ HandleEvent((symbol) ts_member_conf[ts_selected_member, `type]:`rb_ts_list);
+
+ // update the regex and file fields
+ UI::ChangeWidget(`id(`ts_auth_regex), `Value, ts_member_conf[ts_selected_member, `rb_ts_regex]:"");
+ UI::ChangeWidget(`id(`ts_auth_file), `Value, ts_member_conf[ts_selected_member, `rb_ts_file]:"");
+
+ // disable the delete users button in case of groups and if the table is empty
+ UI::ChangeWidget(`id(`ts_delete_user), `Enabled, (ts_isnt_empty && regexpmatch(ts_selected_member, "^[^@]")));
+
+ //disable the user configuration dialog in case of an empty table
+ UI::ChangeWidget(`id(`f_ts_member_conf), `Enabled, ts_isnt_empty);
+ }
+
+ if (widget == `ts_delete_user)
+ {
+ // remove user from system
+ IUCVTerminalServer::DeleteUser(ts_selected_member);
+
+ // remove user TS-Shell settings
+ ts_member_conf = remove(ts_member_conf, ts_selected_member);
+
+ // update table
+ UI::ChangeWidget(`id(`ts_users_groups), `Items, GenerateTsMembersTable());
+ HandleEvent(`ts_users_groups);
+ }
+
+ // select file
+ if (widget == `ts_auth_file_browse)
+ {
+ // set default directory
+ string file = ts_member_conf[ts_selected_member, `rb_ts_file]:"/";
+ file = UI::AskForExistingFile ( file, "", "Select a file with z/VM IDs");
+ if (file != nil)
+ {
+ ts_member_conf[ts_selected_member, `rb_ts_file] = file;
+ UI::ChangeWidget(`id(`ts_auth_file), `Value, file);
+ }
+ }
+
+
+ // reset repeated password on change
+ if (widget == `ic_pw1)
+ {
+ UI::ChangeWidget(`id(`ic_pw2), `Value, "");
+ }
+
+ // check password and update if valid
+ if (widget == `ic_pw2)
+ {
+ ic_password = CheckPassword(`ic_pw1, `ic_pw2);
+ }
+
+ // select home directory
+ if (widget == `ic_browse_home)
+ {
+ // set default directory
+ string dir = (ic_home != "") ? ic_home : "/";
+ dir = UI::AskForExistingDirectory (dir, "");
+ if (dir != nil)
+ {
+ ic_home = dir;
+ UI::ChangeWidget(`id(`ic_home), `Value, dir);
+ }
+ }
+
+ if (widget == `ic_sync)
+ {
+ SyncIucvConnUsers();
+ }
+
+ // select home directory
+ if (widget == `ts_browse_home)
+ {
+ // set default directory
+ string dir = (ts_home != "") ? ts_home : "/";
+ dir = UI::AskForExistingDirectory (dir, "");
+ if (dir != nil)
+ {
+ ts_home = dir;
+ UI::ChangeWidget(`id(`ts_home), `Value, dir);
+ }
+ }
+
+ if (widget == `ts_open_group_dialog)
+ {
+ current_dialog = widget;
+ DrawTsGroupDialog();
+ }
+
+ if (widget == `ts_open_user_dialog)
+ {
+ current_dialog = widget;
+ DrawTsUserDialog();
+ }
+
+ if ( widget == `zvmids ) {
+ if ( IsValidZvmIdList() )
+ {
+ // convert to lower case before saving
+ string zvm_ids_text = tolower((string) UI::QueryWidget (`id (`zvmids), `Value));
+ // remove possible break at the end
+ if (regexpmatch(zvm_ids_text, "\n$"))
+ {
+ zvm_ids_text = substring(zvm_ids_text, 0, size(zvm_ids_text) - 1);
+ }
+
+ list<string> id_list = splitstring(zvm_ids_text, "\n");
+ // remove possible duplicates
+ zvm_id_list = (list<string>) union(id_list, id_list);
+ // sort list
+ zvm_id_list = sort(zvm_id_list);
+
+ // update the zvm_id_entries
+ zvm_id_entries = (list<string>) merge([TEXT_ALL], zvm_id_list);
+ }
+ else
+ {
+ // reset list to prevent saving the previous settings
+ zvm_id_list = [ ];
+ zvm_id_entries = [TEXT_ALL];
+ }
+
+ // disabled tab selection without valid z/VM IDs
+ UI::ChangeWidget(`id(`tab), `Enabled, (size(zvm_id_list) > 0));
+ }
+
+ // reset repeated password on change
+ if (widget == `ts_pw1)
+ {
+ UI::ChangeWidget(`id(`ts_pw2), `Value, "");
+ }
+
+ // check password and update if valid
+ if (widget == `ts_pw2)
+ {
+ ts_password = CheckPassword(`ts_pw1, `ts_pw2);
+ }
+
+ // updated group members
+ if (widget == `ts_table_add_groups)
+ {
+ boolean groups_exist = ([] != (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items));
+ UI::ChangeWidget(`id(`ts_groups_members), `Enabled, groups_exist);
+ UI::ChangeWidget(`id(`ts_groups_select), `Enabled, groups_exist);
+ if (groups_exist)
+ {
+ UI::ChangeWidget(`id(`ts_groups_members), `SelectedItems, GetTsGroupTableUserList());
+ }
+ }
+
+ if (widget == `ts_groups_create)
+ {
+ list<term> table_data = (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items);
+ string groupname = (string) UI::QueryWidget (`id (`ts_groups_name), `Value);
+
+ // gather all groups to check for name overlapses
+ map groups = IUCVTerminalServer::GetGroups(false);
+
+ // check if the group was already added this session
+ boolean is_not_in_list = (nil == find (term line, table_data, ``(line[0]:nil == `id(groupname))));
+ // make sure that that group doesn't already exist and check the specification
+ if (is_not_in_list && !haskey(groups, groupname)
+ && IUCVTerminalServer::CheckUserGroupName(groupname))
+ {
+ list<term> items = (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items);
+
+ term item = `item(`id(groupname), groupname, TEXT_YES, "new", "");
+ items = add(items, item);
+
+ UpdateTsGroupTable(items);
+ // update ts member selection
+ HandleEvent(`ts_table_add_groups);
+ }
+ else
+ {
+ UI::SetFocus(`ts_groups_name);
+ Popup::Notify(_("The group name is not valid!"));
+ }
+ }
+
+ if (widget == `ts_groups_select)
+ {
+ list<term> items = (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items);
+ string groupname = (string) UI::QueryWidget(`id(`ts_table_add_groups), `CurrentItem);
+
+ integer i = 0;
+ foreach(term item, items, {
+ if (item[1]:"" == groupname)
+ {
+ boolean in_list = (item[2]:"" == TEXT_YES);
+ item[2] = in_list
+ ? TEXT_NO
+ : TEXT_YES;
+ items[i] = item;
+ break;
+ }
+ i = i + 1;
+ });
+
+ UpdateTsGroupTable(items);
+ }
+
+ if (widget == `ts_groups_members)
+ {
+ list<string> user_list = (list<string>) UI::QueryWidget(`id(`ts_groups_members), `SelectedItems);
+ SetTSGroupTableUserList(user_list);
+ }
+
+
+ /* tab handling */
+ if ( widget == `t_zvmids )
+ {
+ //SaveSettings( $[ "ID" : widget ] );
+ UI::ReplaceWidget(`id(`tab_content), ZvmIdsDialogContent() );
+ InitMainDialog(widget);
+ Wizard::SetHelpText( HELP["zvmids"]:"" );
+
+ }
+ else if ( widget == `t_tsshell || widget == `t_iucvconn )
+ {
+ // deactivate other tabs without valid z/VM ids
+ if ( size(zvm_id_list) > 0)
+ {
+ if ( widget == `t_tsshell )
+ {
+ UI::ReplaceWidget(`id(`tab_content), TsShellDialogContent() );
+ InitMainDialog(widget);
+ Wizard::SetHelpText( HELP["ts"]:"" );
+ }
+ else if ( widget == `t_iucvconn )
+ {
+ UI::ReplaceWidget(`id(`tab_content), IucvConnDialogContent() );
+ InitMainDialog(widget);
+ Wizard::SetHelpText( HELP["ic"]:"" );
+ }
+ }
+ else
+ {
+ // change tab selection back
+ UI::ChangeWidget (`id (`tab), `CurrentItem, `t_zvmids);
+ Popup::Notify (_("It is not possible to configure the Terminal Server without valid z/VM IDs."));
+ }
+ }
+}
+
+/**
+ * Run the dialog
+ * @return symbol last pressed button
+ */
+symbol IUCVTerminalServerDialog () {
+ zvm_id_list = IUCVTerminalServer::zvm_id_list;
+ ts_home = IUCVTerminalServer::ts_home;
+ ts_enabled = IUCVTerminalServer::ts_enabled;
+ ts_member_conf= IUCVTerminalServer::ts_member_conf;
+ ts_audited_ids = IUCVTerminalServer::ts_audited_ids;
+ ic_enabled = IUCVTerminalServer::ic_enabled;
+ ic_home = IUCVTerminalServer::ic_home;
+
+ // initialize z/VM IDs
+ zvm_id_entries = (list<string>) merge( [TEXT_ALL], zvm_id_list);
+
+ // initialize screen
+ DrawMainDialog();
+
+ // disable Dumbtab if no proper z/VM IDs are defined
+ UI::ChangeWidget(`id(`tab), `Enabled, (size(zvm_id_list) > 0));
+
+ symbol ret = nil;
+ do
+ {
+ ret = (symbol) UI::UserInput();
+ // if ts user/group dialog is active
+ if (contains ([`ts_open_user_dialog, `ts_open_group_dialog], current_dialog))
+ {
+ if (contains ([`next, `ok, `finish], ret))
+ {
+ ret = `again;
+ boolean success = true;
+ // check TS-Shell user dialog settings and commit them if valid
+ if (current_dialog == `ts_open_user_dialog)
+ {
+ success = CommitTsUserDialogSettings();
+ }
+ // commit TS-Shell group dialog settings
+ else if (current_dialog == `ts_open_group_dialog)
+ {
+ CommitTsGroupDialogSettings();
+ }
+
+ // if successful return to main dialog
+ if (success) {
+ current_dialog = `main_window;
+ DrawMainDialog();
+ }
+ }
+
+ if (contains ([`abort, `cancel, `back], ret))
+ {
+ // ask for confirmation if the ts group dialog has changed
+ list<term> current_items = (list<term>) UI::QueryWidget(`id(`ts_table_add_groups), `Items);
+ if (current_dialog == `ts_open_group_dialog
+ && ts_groups_items != current_items && !Popup::ReallyAbort(true))
+ {
+ ret = `again;
+ continue;
+ }
+
+ current_dialog = `main_window;
+ ret = `again;
+ DrawMainDialog();
+ }
+ }
+
+ // run action for current event
+ HandleEvent(ret);
+
+ // check for changes on final user actions
+ if (contains ([`back, `abort, `cancel, `next, `ok, `finish], ret))
+ {
+ // check if something was modified
+ IUCVTerminalServer::modified =
+ (IUCVTerminalServer::zvm_id_list != zvm_id_list
+ || IUCVTerminalServer::ts_enabled != ts_enabled
+ || IUCVTerminalServer::ts_home != ts_home
+ || IUCVTerminalServer::ts_audited_ids != ts_audited_ids
+ || IUCVTerminalServer::ts_member_conf != ts_member_conf
+ || IUCVTerminalServer::ic_enabled != ic_enabled
+ || IUCVTerminalServer::ic_home != ic_home
+ || Users::Modified ()
+ );
+
+ // if settings were changed don't exit without asking
+ if (contains ([`abort, `cancel], ret) && IUCVTerminalServer::modified
+ && !Popup::ReallyAbort (true))
+ {
+ ret = `again;
+ }
+
+ if (contains ([`next, `ok, `finish], ret))
+ {
+ // check for z/VM ID entries
+ if (size(zvm_id_list) == 0)
+ {
+ Popup::Notify (_("It is not possible to configure the Terminal Server without valid z/VM IDs."));
+ ret = `again;
+ continue;
+ }
+ // don't quit without syncronisation if iucvconn is enabled
+ else if (ic_enabled && !SyncIucvConnUsers()) {
+ ret = `again;
+ continue;
+ }
+ }
+ }
+ } while (!contains ([`back, `abort, `cancel, `next, `ok, `finish], ret));
+
+
+ // commit changes
+ if (IUCVTerminalServer::modified && (ret == `next || ret == `ok || ret == `finish))
+ {
+ // check if the TS-Shell status has changed
+ IUCVTerminalServer::ts_has_status_changed = (IUCVTerminalServer::ts_enabled != ts_enabled);
+
+ IUCVTerminalServer::zvm_id_list = zvm_id_list;
+ IUCVTerminalServer::ts_enabled = ts_enabled;
+ IUCVTerminalServer::ts_home = ts_home;
+ IUCVTerminalServer::ts_audited_ids = ts_audited_ids;
+ IUCVTerminalServer::ts_member_conf = ts_member_conf;
+ IUCVTerminalServer::ic_enabled = ic_enabled;
+ IUCVTerminalServer::ic_home = ic_home;
+
+ //remove remaining IUCVConn users if disabled
+ if (!ic_enabled && IUCVTerminalServer::GetIcUsersList() != [])
+ {
+ IUCVTerminalServer::SyncIucvConnUsers([ ], "");
+ }
+ }
+ return (symbol) ret;
+}
+
+/**
+ * The whole sequence
+ * @return sequence result
+ */
+symbol IUCVTerminalServerSequence() {
+ symbol ret = nil;
+ Wizard::CreateDialog();
+ Wizard::SetDesktopIcon("iucvterminal-server");
+ IUCVTerminalServer::Read ();
+ ret = IUCVTerminalServerDialog ();
+ // only write during
+ if (ret == `next || ret == `finish || ret == `ok)
+ {
+ IUCVTerminalServer::Write ();
+ }
+ UI::CloseDialog();
+
+ return ret;
+}
+
+/* EOF */
+}
Added: trunk/s390/src/iucvterminal/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/iucvterminal/Makefile.am?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/iucvterminal/Makefile.am (added)
+++ trunk/s390/src/iucvterminal/Makefile.am Mon Oct 10 15:37:46 2011
@@ -0,0 +1,10 @@
+# Makefile.am for iucvterminal/src
+
+yncludedir = @yncludedir@/s390/iucvterminal
+
+ynclude_DATA = \
+ ui.ycp
+
+EXTRA_DIST = $(ynclude_DATA)
+
+include $(top_srcdir)/Makefile.am.common
Added: trunk/s390/src/iucvterminal/ui.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/iucvterminal/ui.ycp?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/iucvterminal/ui.ycp (added)
+++ trunk/s390/src/iucvterminal/ui.ycp Mon Oct 10 15:37:46 2011
@@ -0,0 +1,459 @@
+/**
+ * File: include/s390/iucvterminal/ui.ycp
+ * Package: Configuration IUCV Terminal Settings
+ * Summary: Dialogs definitions
+ * Authors: Tim Hardeck
+ *
+ */
+
+{
+
+textdomain "s390";
+
+import "IUCVTerminal";
+import "Label";
+import "Popup";
+import "Wizard";
+import "Integer";
+
+/**
+ * Hspacing value between most dialog fields
+ */
+define const float hspacing = 2;
+
+/**
+ * Vspacing value between most dialog fields
+ */
+define const float vspacing = 0.5;
+
+/**
+ * Text field for changing settings of all HVC instances
+ */
+define const string TEXT_INSTANCES_ALL = IUCVTerminal::TEXT_INSTANCES_ALL;
+
+/**
+ * Text field for not changing the HVC emulation
+ */
+define const string TEXT_EMU_NO_CHANGE = IUCVTerminal::TEXT_EMU_NO_CHANGE;
+
+/**
+ * Default HVC emulation
+ */
+define const string DEFAULT_HVC_EMULATION = IUCVTerminal::DEFAULT_HVC_EMULATION;
+
+/**
+ * Map of HVC terminals and their according emulations
+ */
+define map hvc_emulations = $[ ];
+
+/**
+ * Update the HVC emulation for the "<all> instance" according to the selected
+ * emulations.
+ * So if all emulations are the same <all> shows this particular emulation
+ * otherwise the selection is shown to prevent overwriting.
+ * @return void
+ */
+define void UpdateHVCEmulation() {
+ string previous_emulation = hvc_emulations["hvc0"]:DEFAULT_HVC_EMULATION;
+ boolean same_emulation = true;
+ string terminal = "";
+ // for the number of instances
+ foreach (integer i, Integer::RangeFrom(0, (integer)UI::QueryWidget (`id (`hvc_instances), `Value)),{
+ terminal = "hvc" + tostring(i);
+ if (hvc_emulations[terminal]:DEFAULT_HVC_EMULATION != previous_emulation)
+ {
+ same_emulation = false;
+ }
+ previous_emulation = hvc_emulations[terminal]:DEFAULT_HVC_EMULATION;
+ });
+
+ if (same_emulation)
+ {
+ hvc_emulations[TEXT_INSTANCES_ALL] = previous_emulation;
+ }
+ else
+ {
+ hvc_emulations[TEXT_INSTANCES_ALL] = TEXT_EMU_NO_CHANGE;
+ }
+
+ // update emulation field if all is selected
+ if ((string)UI::QueryWidget (`id (`hvc_instance), `Value) == TEXT_INSTANCES_ALL)
+ {
+ UI::ChangeWidget (`id(`hvc_emulation), `Value, hvc_emulations[TEXT_INSTANCES_ALL]:TEXT_EMU_NO_CHANGE);
+ }
+}
+
+/**
+ * Check the "Allowed Terminal Server list" field for validity.
+ * @return true for valid inputs
+ */
+define boolean IsValidTerminalSrvList() {
+ boolean ret = false;
+
+ string restrict_hvc_to_srvs = (string)UI::QueryWidget (`id (`restrict_hvc_to_srvs), `Value);
+ if (regexpmatch(restrict_hvc_to_srvs, "[^a-z0-9,]"))
+ {
+ Popup::Notify(_("Wrong input, only lower case letters, numbers and for separation commas are allowed."));
+ }
+ else if (regexpmatch(restrict_hvc_to_srvs, "^,|,,"))
+ {
+ Popup::Notify(_("Comma is only a separator."));
+ }
+ else if (regexpmatch(restrict_hvc_to_srvs, "[a-z0-9]{9,}"))
+ {
+ Popup::Notify(_("z/VM IDs doesn't allow more than eight characters."));
+ }
+ else
+ {
+ ret = true;
+ }
+ return ret;
+}
+
+/**
+ * Check the "IUCV Name" field for validity.
+ * @return true for valid inputs
+ */
+define boolean IsValidIucvId() {
+ /* in case of more than 99 iucv instances only 5 characters would be allowed
+ * because the name is limited to eight chars*/
+ integer max_length = (IUCVTerminal::MAX_IUCV_TTYS < 100) ? 6 : 5;
+
+ boolean ret = false;
+ string iucv_name = (string)UI::QueryWidget (`id (`iucv_name), `Value);
+
+ if (regexpmatch(iucv_name, "[^a-z0-9]"))
+ {
+ Popup::Notify(_("Wrong IUCV ID, only lower case letters are allowed."));
+ }
+ else if (regexpmatch(iucv_name, ".{" + tostring(max_length + 1) + ",}"))
+ {
+ Popup::Notify(sformat(_("IUVC IDs can't be bigger than %1 chars long."), max_length));
+ }
+ else
+ {
+ ret = true;
+ }
+ return ret;
+}
+
+/**
+ * Check if the HVC emulations differ from the ones loaded at start.
+ * @return true if it has changed
+ */
+define boolean HasEmulationChanged() {
+ boolean has_changed = false;
+ string key = "";
+ // for hvc instances
+ foreach (integer i, Integer::RangeFrom(0, (integer)UI::QueryWidget (`id (`hvc_instances), `Value)),{
+ key = "hvc" + tostring(i);
+ if (hvc_emulations[key]:"" != IUCVTerminal::hvc_emulations[i]:"")
+ {
+ has_changed = true;
+ break;
+ }
+ });
+ return has_changed;
+}
+
+/**
+ * Update the screen according to user input.
+ * @return void
+ */
+define void UpdateScreen(symbol ret) {
+ if (ret == `hvc)
+ {
+ // enable if restrict access is enabled too
+ UI::ChangeWidget(`id(`restrict_hvc_to_srvs), `Enabled, (boolean)UI::QueryWidget (`id (`is_hvc_restricted), `Value));
+ }
+
+ if (ret == `is_hvc_restricted)
+ {
+ UI::ChangeWidget(`id(`restrict_hvc_to_srvs), `Enabled, (boolean)UI::QueryWidget (`id (`is_hvc_restricted), `Value));
+ }
+
+ if (ret == `hvc_instances)
+ {
+ // only show the selected number of instances plus the entry <all>
+ integer number = (integer)UI::QueryWidget (`id (`hvc_instances), `Value) + 1;
+ list<string> hvc_instances = sublist(IUCVTerminal::POSSIBLE_HVC_INSTANCES, 0, number);
+ UI::ChangeWidget (`id(`hvc_instance), `Items, hvc_instances);
+
+ // make sure not to overwrite the emulation after adding new ones
+ UpdateHVCEmulation();
+ }
+
+ if (ret == `hvc_instance)
+ {
+ string instance = (string)UI::QueryWidget (`id (`hvc_instance), `Value);
+ UI::ChangeWidget (`id(`hvc_emulation), `Value, hvc_emulations[instance]:TEXT_EMU_NO_CHANGE);
+ }
+
+ if (ret == `hvc_emulation)
+ {
+ string instance = (string)UI::QueryWidget (`id (`hvc_instance), `Value);
+ string emulation = (string)UI::QueryWidget (`id (`hvc_emulation), `Value);
+
+ if (emulation != TEXT_EMU_NO_CHANGE)
+ {
+ if (instance == TEXT_INSTANCES_ALL)
+ {
+ foreach (string key, IUCVTerminal::POSSIBLE_HVC_INSTANCES,{
+ hvc_emulations[key] = emulation;
+ });
+ }
+ else
+ {
+ hvc_emulations[TEXT_INSTANCES_ALL] = TEXT_EMU_NO_CHANGE;
+ hvc_emulations[instance] = (string)UI::QueryWidget (`id (`hvc_emulation), `Value);
+ }
+ }
+ UpdateHVCEmulation();
+ }
+}
+
+/**
+ * Run the dialog
+ * @return symbol EditDumpDialog that was edited
+ */
+symbol TerminalDialog () {
+ string caption = "Configure IUCV Terminal Settings";
+ string help = _("<p><h2>Configure Local Terminal System Settings</h2></p>")
++ _("<p><b>IUVCtty</b></p>")
++ _("<p>Several <b>IUCVtty instances</b> can run to provide multiple terminal devices. The instances are distinguished by a Terminal ID which is a combination of the the <b>Terminal ID Prefix</b> and the number of the instance.<br>")
++ _("So if for example 10 instances are defined with the prefix "<i>lxterm</i>" the Terminal IDs from <i>lxterm1</i> to <i>lxterm10</i> would be available.</p>")
++ "<p> </p>"
++ _("<p><b>HVC</b></p>")
++ _("<p>The z/VM IUCV HVC device driver is a kernel module and uses device nodes to enable up to 8 HVC terminal devices to communicate with getty and login programs.</p>")
++ _("<p>With <b>restrict access</b> it is possible to allow only the connection from certain <b>Terminal Servers</b>.</p>")
++ _("<p>You can define the emulation for all instances at once or for every one of them on its own.</p>")
++ _("<p>By activating <b>receive kernel messages on hvc0</b> kernel messages are routed to the hvc0 device instead of ttyS0.<br>")
++_("If you want the kernel messages to still be shown on ttyS0 you have to manually add <b>console=ttyS0</b> to the current boot selection kernel parameter in the <b>YaST bootloader module</b>.</p>")
++ _("<h3>Warning: HVC Terminals stay logged on without a manual logout through the shortcut: ctrl _ d</h3>");
+
+ /* Dialog content */
+ term content = `HBox(`HSpacing(3), `VBox(`VSpacing(vspacing + 0.5),
+ `VBox(
+ `CheckBoxFrame(`id(`iucv), _("&IUCVtty"), false, `VBox( `HBox(`HSpacing(hspacing),
+ `InputField(`id(`iucv_name), `opt(`notify, `hstretch), _("Terminal ID &Prefix"), "" ),
+ `HSpacing(2),
+ `IntField(`id(`iucv_instances), _("I&UCVtty instances"), 1, IUCVTerminal::MAX_IUCV_TTYS, 1 )
+ ,`HSpacing(hspacing)),`VSpacing(vspacing))),
+
+ `VSpacing (vspacing + 0.5),
+
+ `CheckBoxFrame(`id(`hvc), `opt(`notify), _("HVC"), false, `HBox(`HSpacing(hspacing),`VBox(`VSpacing(vspacing),
+ `HBox(
+ `IntField(`id(`hvc_instances), `opt(`notify), _("H&VC instances"), 1, 8, 1 )
+ ),
+ `VSpacing (vspacing),
+ `HBox(
+ `CheckBox (`id (`is_hvc_restricted), `opt(`notify), _("Restrict &access to")),
+ `HSpacing(1),
+ `InputField(`id(`restrict_hvc_to_srvs), `opt(`notify, `hstretch), _("Allowed Terminal &Servers"), "" )
+ ),
+ `VSpacing (vspacing),
+ `HBox(
+ `ComboBox (`id(`hvc_instance), `opt(`notify, `hstretch),
+ _("Select I&nstance"), IUCVTerminal::POSSIBLE_HVC_INSTANCES),
+ `HSpacing(1),
+ `ComboBox (`id(`hvc_emulation), `opt(`notify, `hstretch),
+ _("Select &Emulation"), IUCVTerminal::HVC_EMULATIONS)
+ ),
+ `VSpacing (vspacing + 0.7),
+ `Left(
+ `CheckBox (`id (`show_kernel_out_on_hvc), _("route &kernel messages to HVC0"))
+ )
+ ,`VSpacing(vspacing + 0.5)),`HSpacing(hspacing))
+ )
+ )
+ ,`VStretch()),`HSpacing(3));
+
+ Wizard::SetContentsButtons (caption, content, help, Label::BackButton (), Label::OKButton());
+ Wizard::HideBackButton();
+ Wizard::SetAbortButton(`cancel, Label::CancelButton());
+
+ // initialize hvc_emulations with default value
+ foreach (string key, IUCVTerminal::POSSIBLE_HVC_INSTANCES,{
+ hvc_emulations = add (hvc_emulations, key, DEFAULT_HVC_EMULATION);
+ });
+
+ if (size(IUCVTerminal::hvc_emulations) > 0)
+ {
+ integer i = 0;
+ foreach (string emulation, IUCVTerminal::hvc_emulations,{
+ hvc_emulations["hvc" + tostring(i)] = emulation;
+ i = i + 1;
+ });
+ UpdateHVCEmulation();
+ }
+
+ UI::ChangeWidget(`id(`show_kernel_out_on_hvc), `Value, IUCVTerminal::show_kernel_out_on_hvc);
+ if (IUCVTerminal::restrict_hvc_to_srvs != "")
+ {
+ UI::ChangeWidget(`id(`restrict_hvc_to_srvs), `Value, IUCVTerminal::restrict_hvc_to_srvs);
+ UI::ChangeWidget(`id(`is_hvc_restricted), `Value, true);
+ }
+
+ // initialize screen
+ if (IUCVTerminal::iucv_instances > 0) {
+ UI::ChangeWidget(`id(`iucv), `Value, true);
+ UI::ChangeWidget(`id(`iucv_instances), `Value, IUCVTerminal::iucv_instances);
+ }
+ if (IUCVTerminal::hvc_instances > 0) {
+ UI::ChangeWidget(`id(`hvc), `Value, true);
+ UI::ChangeWidget(`id(`hvc_instances), `Value, IUCVTerminal::hvc_instances);
+ }
+
+ if (IUCVTerminal::iucv_name != "")
+ {
+ UI::ChangeWidget(`id(`iucv_name), `Value, IUCVTerminal::iucv_name);
+ }
+
+ UpdateScreen(`hvc_instances);
+ UpdateScreen(`hvc_instance);
+ UpdateScreen(`iucv);
+ UpdateScreen(`hvc);
+
+ symbol ret = nil;
+ do
+ {
+ ret = (symbol) UI::UserInput();
+ UpdateScreen (ret);
+
+ if (ret == `restrict_hvc_to_srvs)
+ {
+ IsValidTerminalSrvList();
+ }
+
+ if (ret == `iucv_name)
+ {
+ IsValidIucvId();
+ }
+
+ // check for changes on final user actions
+ if (contains ([`back, `abort, `cancel, `next, `ok, `finish], ret))
+ {
+ IUCVTerminal::modified = ((IUCVTerminal::iucv_instances == 0
+ && (boolean)UI::QueryWidget (`id (`iucv), `Value))
+ || (IUCVTerminal::iucv_instances != 0
+ && !(boolean)UI::QueryWidget (`id (`iucv), `Value))
+ || (IUCVTerminal::iucv_instances != 0
+ && IUCVTerminal::iucv_instances != (integer)UI::QueryWidget (`id (`iucv_instances), `Value))
+ || IUCVTerminal::iucv_name != (string)UI::QueryWidget (`id (`iucv_name), `Value)
+ || (IUCVTerminal::hvc_instances != 0
+ && IUCVTerminal::hvc_instances != (integer)UI::QueryWidget (`id (`hvc_instances), `Value))
+ || (IUCVTerminal::hvc_instances == 0 && (boolean)UI::QueryWidget (`id (`hvc), `Value))
+ || (IUCVTerminal::hvc_instances != 0 && !(boolean)UI::QueryWidget (`id (`hvc), `Value))
+ || IUCVTerminal::show_kernel_out_on_hvc != (boolean)UI::QueryWidget (`id (`show_kernel_out_on_hvc), `Value)
+ || IUCVTerminal::restrict_hvc_to_srvs != (string)UI::QueryWidget (`id (`restrict_hvc_to_srvs), `Value)
+ || (IUCVTerminal::restrict_hvc_to_srvs != ""
+ && !(boolean)UI::QueryWidget (`id (`is_hvc_restricted), `Value))
+ || (HasEmulationChanged() && (boolean)UI::QueryWidget (`id (`hvc), `Value))
+ );
+
+ // if settings were changed don't exit without asking
+ if (contains ([`back, `abort, `cancel], ret) && IUCVTerminal::modified
+ && !Popup::YesNo (_("Really leave without saving?")))
+ {
+ ret = `again;
+ }
+
+ if (contains ([`next, `ok, `finish], ret))
+ {
+ // check iucv id
+ string iucv_name = (string)UI::QueryWidget (`id (`iucv_name), `Value);
+ if (!IsValidIucvId() || iucv_name == "")
+ {
+ UI::SetFocus(`iucv_name);
+ Popup::Notify(_("The IUCV ID is not valid."));
+ ret = `again;
+ }
+
+ // check restrict_hvc_to_srvs and make sure they doesn't end with a comma
+ if ((boolean) UI::QueryWidget (`id (`is_hvc_restricted), `Value))
+ {
+ string restrict_hvc_to_srvs = (string)UI::QueryWidget (`id (`restrict_hvc_to_srvs), `Value);
+ if (!IsValidTerminalSrvList() || restrict_hvc_to_srvs == "" || regexpmatch(restrict_hvc_to_srvs, ",$"))
+ {
+ UI::SetFocus(`restrict_hvc_to_srvs);
+ Popup::Notify(_("The Terminal Servers are not valid."));
+ ret = `again;
+ }
+ }
+ }
+ }
+ } while (!contains ([`back, `abort, `cancel, `next, `ok, `finish], ret));
+
+
+ // commit changes
+ if (IUCVTerminal::modified && (ret == `next || ret == `ok || ret == `finish))
+ {
+ // set instances to zero if it is disabled
+ integer current_hvc_instances = (boolean) UI::QueryWidget (`id (`hvc), `Value)
+ ? (integer) UI::QueryWidget (`id (`hvc_instances), `Value)
+ : 0;
+ // no need to provide allowed terminal servers if disabled
+ string current_restrict_hvc_to_srvs = (boolean) UI::QueryWidget (`id (`is_hvc_restricted), `Value)
+ ? (string) UI::QueryWidget (`id (`restrict_hvc_to_srvs), `Value)
+ : "";
+ // check if the bootloader settings need to be adjusted
+ IUCVTerminal::has_bootloader_changed =
+ ( IUCVTerminal::restrict_hvc_to_srvs != current_restrict_hvc_to_srvs
+ || IUCVTerminal::show_kernel_out_on_hvc != (boolean) UI::QueryWidget (`id (`show_kernel_out_on_hvc), `Value));
+
+ if (IUCVTerminal::has_bootloader_changed)
+ {
+ Popup::Notify(_("The system has to be rebooted for some changes to take effect."));
+ }
+
+ IUCVTerminal::hvc_instances = current_hvc_instances;
+ // set instances to zero if it is disabled
+ IUCVTerminal::iucv_instances = (boolean) UI::QueryWidget (`id (`iucv), `Value)
+ ? (integer) UI::QueryWidget (`id (`iucv_instances), `Value)
+ : 0;
+
+ IUCVTerminal::iucv_name = (string)UI::QueryWidget (`id (`iucv_name), `Value);
+ IUCVTerminal::restrict_hvc_to_srvs = current_restrict_hvc_to_srvs;
+ IUCVTerminal::show_kernel_out_on_hvc = (boolean) UI::QueryWidget (`id (`show_kernel_out_on_hvc), `Value);
+ // commit hvc emulations
+ if (IUCVTerminal::hvc_instances > 0)
+ {
+ list<string> hvc_emulation_list = [ ];
+ string key = "";
+ foreach (integer i, Integer::RangeFrom(0, IUCVTerminal::hvc_instances),{
+ key = "hvc" + tostring(i);
+ hvc_emulation_list = add (hvc_emulation_list, hvc_emulations[key]:DEFAULT_HVC_EMULATION);
+ });
+ IUCVTerminal::hvc_emulations = hvc_emulation_list;
+ }
+ }
+ return (symbol) ret;
+}
+
+
+/**
+ * The whole squence
+ * @return sequence result
+ */
+symbol IUCVTerminalSequence() {
+ symbol ret = nil;
+ Wizard::CreateDialog();
+ Wizard::SetDesktopIcon("iucvterminal");
+ IUCVTerminal::Read ();
+ ret = TerminalDialog ();
+ // only write during
+ if (ret == `next || ret == `finish || ret == `ok)
+ {
+ IUCVTerminal::Write ();
+ }
+ UI::CloseDialog();
+
+
+ return ret;
+}
+
+/* EOF */
+}
+
+
Modified: trunk/s390/src/modules/Dump.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/Dump.ycp?rev=66364&r1=66363&r2=66364&view=diff
==============================================================================
--- trunk/s390/src/modules/Dump.ycp (original)
+++ trunk/s390/src/modules/Dump.ycp Mon Oct 10 15:37:46 2011
@@ -80,15 +80,15 @@
* @return boolean true on success
*/
global define boolean FormatDisk (string dev, boolean force) {
- string caption = _("Creating Dump Device[s]");
+ string caption = _("Creating Dump Device");
integer steps = 1;
Progress::New (caption, " ", steps, [
/* Progress stage 1/1 */
- _("Creating dump device[s]")
+ _("Creating dump device")
], [
/* Progress step 1/1 */
- _("Creating dump device[s]. This process might take some minutes."),
+ _("Creating dump device. This process might take some minutes."),
/* Progress finished */
_("Finished")
],
Added: trunk/s390/src/modules/IUCVTerminal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/IUCVTerminal.ycp?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/modules/IUCVTerminal.ycp (added)
+++ trunk/s390/src/modules/IUCVTerminal.ycp Mon Oct 10 15:37:46 2011
@@ -0,0 +1,366 @@
+/**
+ * File: modules/IUCVTerminal.ycp
+ * Package: Configuration IUCV Terminal Settings
+ * Summary: IUCV Terminal settings, input and output functions
+ * Authors: Tim Hardeck
+ *
+ */
+
+{
+
+module "IUCVTerminal";
+textdomain "s390";
+
+import "FileUtils";
+import "Report";
+import "String";
+import "Progress";
+import "Integer";
+import "Bootloader";
+
+/**
+ * Maximal allowed IUCV ttys, 999 is the absolute maximum
+ */
+global const integer MAX_IUCV_TTYS = 99;
+
+/**
+ * Default Emulation for HVC
+ */
+global const string DEFAULT_HVC_EMULATION = "linux";
+
+/**
+ * Text field for changing settings of all HVC instances
+ */
+global define const string TEXT_INSTANCES_ALL = _("<all>");
+
+/**
+ * Text field for not changing the HVC emulation
+ */
+global define const string TEXT_EMU_NO_CHANGE = _("");
+
+/**
+ * List of all possible HVC terminals
+ */
+global define const list<string> POSSIBLE_HVC_INSTANCES = [ TEXT_INSTANCES_ALL, "hvc0", "hvc1", "hvc2", "hvc3", "hvc4", "hvc5", "hvc6", "hvc7" ];
+
+/**
+ * List of all HVC emulations
+ */
+global define const list<string> HVC_EMULATIONS = [ TEXT_EMU_NO_CHANGE, "linux", "dumb", "xterm", "vt220" ];
+
+/**
+ * Data was modified?
+ */
+global boolean modified = false;
+
+/**
+ * Number of IUCV instances
+ */
+global integer iucv_instances = 0;
+
+/**
+ * First part of the Terminal name (without the counter)
+ */
+global string iucv_name = "lxterm";
+
+/**
+ * Number of HVC instances
+ */
+global integer hvc_instances = 0;
+
+/**
+ * List of emulations per HVC device (first entry for hvc0, second for
+ * hvc1 and so on)
+ */
+global list<string> hvc_emulations = [ ];
+
+/**
+ * Show kernel output on hvc0?
+ */
+global boolean show_kernel_out_on_hvc = false;
+
+/**
+ * Allow only connections from the mentioned Terminal server
+ */
+global string restrict_hvc_to_srvs = "";
+
+/**
+ * Has the bootloader configuration changed?
+ */
+global boolean has_bootloader_changed = false;
+
+/**
+ * Read all settings
+ * @return true on success
+ */
+global define boolean Read () {
+ string caption = _("Loading IUCV Terminal Configuration");
+ integer steps = 2;
+
+ Progress::New (caption, " ", steps, [
+ /* Progress stage 1/3 */
+ _("Check IUCVtty entries"),
+ /* Progress stage 2/3 */
+ _("Check HVC entries"),
+ /* Progress stage 3/3 */
+ _("Read Kernel parameters")
+ ], [
+ /* Progress step 1/3 */
+ _("Checking IUCVtty entries..."),
+ /* Progress step 2/3 */
+ _("Checking HVC entries..."),
+ /* Progress step 3/3 */
+ _("Reading Kernel parameters..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
+ );
+
+
+ // Load IUCVtty settings
+ Progress::NextStage();
+ if (FileUtils::Exists ("/etc/inittab"))
+ {
+ iucv_instances = 0;
+ if (SCR::Read(.etc.inittab.i001) != nil)
+ {
+ string id = "";
+ // count the iucvtty instances
+ foreach (integer i, Integer::RangeFrom(1, MAX_IUCV_TTYS + 1),{
+ id = "i";
+ if (i < 10)
+ {
+ id = id + "00";
+ }
+ else if (i < 100)
+ {
+ id = id + "0";
+ }
+ if (SCR::Read(.etc.inittab + (id + tostring(i))) != nil)
+ {
+ iucv_instances = iucv_instances + 1;
+ }
+ else
+ {
+ break;
+ }
+ });
+ // extract IUCVtty Terminal name
+ if (iucv_instances > 0)
+ {
+ string value = (string)SCR::Read(.etc.inittab + "i001");
+ // remove the following number
+ list<string> temp = regexptokenize(value, " ([a-z0-9]{1,7})1$");
+ iucv_name = temp[0]:"lxterm";
+ }
+ }
+ }
+
+ // Load HVC settings
+ Progress::NextStage();
+ if (FileUtils::Exists ("/etc/inittab"))
+ {
+ hvc_instances = 0;
+ if (SCR::Read(.etc.inittab.h0) != nil)
+ {
+ string id = "";
+ string console = nil;
+ // count the hvc instances
+ foreach (integer i, Integer::RangeFrom(0, 8),{
+ id = "h";
+ console = (string) SCR::Read(.etc.inittab + (id + tostring(i)));
+ if (console != nil)
+ {
+ hvc_instances = hvc_instances + 1;
+ // read emulation
+ hvc_emulations = (list<string>)merge(hvc_emulations, regexptokenize(console, " (.{4,5})$"));
+ }
+ else
+ {
+ break;
+ }
+ });
+
+ }
+ }
+
+ // Extract settings from the kernel parameters
+ Progress::NextStage();
+ boolean old_progress = Progress::set (false);
+ Bootloader::Read();
+ Progress::set (old_progress);
+
+ // load actual boot selection
+ string actual_boot_section = Bootloader::getDefaultSection ();
+
+ string restrict_hvc_to_srvs_output = Bootloader::getKernelParam (actual_boot_section, "hvc_iucv_allow");
+ if (restrict_hvc_to_srvs_output != "false")
+ {
+ restrict_hvc_to_srvs = restrict_hvc_to_srvs_output;
+ }
+
+ string console = Bootloader::getKernelParam (actual_boot_section, "console");
+ // if console is defined
+ if (console != "false")
+ {
+ if (console == "hvc0")
+ {
+ show_kernel_out_on_hvc = true;
+ }
+ else
+ {
+ // since it is possible to use more than one console parameter and getKernelParam
+ // is only able to read one, cmdline is used as fallback
+ list<string> parameters = (list<string>) SCR::Read(.proc.cmdline);
+ foreach (string parameter, parameters,{
+ if (regexpmatch(parameter, "console=hvc0"))
+ {
+ show_kernel_out_on_hvc = true;
+ }
+ });
+ }
+ }
+
+ Progress::NextStage();
+ return true;
+}
+
+
+/**
+ * Write all settings
+ * @return true on success
+ */
+global define boolean Write () {
+ if (!modified)
+ {
+ return true;
+ }
+
+ /* Inittab write dialog caption */
+ string caption = _("Saving IUCV Terminal Configuration");
+ integer steps = 2;
+
+ Progress::New (caption, " ", steps, [
+ /* Progress stage 1/4 */
+ _("Write IUCVtty settings"),
+ /* Progress stage 2/4 */
+ _("Write HVC settings"),
+ /* Progress stage 3/4 */
+ _("Write Kernel parameters"),
+ /* Progress stage 4/4 */
+ _("Initialize Init")
+ ], [
+ /* Progress step 1/4 */
+ _("Writing IUCVtty settings..."),
+ /* Progress step 2/4 */
+ _("Writing HVC settings..."),
+ /* Progress step 3/4 */
+ _("Writing Kernel parameters..."),
+ /* Progress step 4/4 */
+ _("Initializing Init..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
+ );
+
+ // save IUCVtty settings
+ Progress::NextStage();
+ string id = "";
+ foreach (integer i, Integer::RangeFrom(1, MAX_IUCV_TTYS + 1),{
+ id = "i";
+ if (i < 10)
+ {
+ id = id + "00";
+ }
+ else if (i < 100)
+ {
+ id = id + "0";
+ }
+
+ if (i <= iucv_instances)
+ {
+ // the maximum for terminal ids are 8 characters
+ SCR::Write (.etc.inittab + (id + tostring(i)), "2345:respawn:/usr/bin/iucvtty " + iucv_name + tostring(i));
+ }
+ else
+ {
+ // delete all other iucv inittab entries
+ SCR::Write (.etc.inittab + (id + tostring(i)), nil);
+ }
+ });
+
+ // save HVC settings
+ Progress::NextStage();
+ string console = "";
+ foreach (integer i, Integer::RangeFrom(0, 8),{
+ id = "h";
+ // hvc starts with zero instead of 1
+ if (i < hvc_instances)
+ {
+ /* this console was build according to the documentation from 2009 but SP2 seems to have already inittab entries
+ * for HVC so using the same syntax
+ * console = "2345:respawn:/sbin/agetty -L 9600 hvc" + tostring(i) + " " + hvc_emulations[i]:DEFAULT_HVC_EMULATION;
+ */
+
+ console = "2345:respawn:/sbin/ttyrun hvc" + tostring(i) + " /sbin/agetty -L 9600 %t " + hvc_emulations[i]:DEFAULT_HVC_EMULATION;
+ SCR::Write (.etc.inittab + (id + tostring(i)), console);
+ }
+ else
+ {
+ // delete all other hvc inittab entries
+ SCR::Write (.etc.inittab + (id + tostring(i)), nil);
+ }
+ });
+
+ // flush cache
+ SCR::Write (.etc.inittab, nil);
+
+ // writing Kernel parameters
+ Progress::NextStage();
+ string actual_boot_section = Bootloader::getDefaultSection ();
+ // only change/save the bootloader configuration if it was adjusted
+ if (has_bootloader_changed)
+ {
+ // removing empty option
+ if (restrict_hvc_to_srvs == "")
+ {
+ restrict_hvc_to_srvs = "false";
+ }
+ Bootloader::setKernelParam (actual_boot_section, "hvc_iucv_allow", restrict_hvc_to_srvs);
+
+ // this might overwrite other console options but this is mentioned in the help text
+ if (show_kernel_out_on_hvc)
+ {
+ Bootloader::setKernelParam (actual_boot_section, "console", "hvc0");
+ }
+ else
+ {
+ // remove console entry if there is only one or the last is hvc0
+ // otherwise it might not be possible to access it with SetKernelParm
+ // make sure not to remove other console tags
+ if (Bootloader::getKernelParam (actual_boot_section, "console") == "hvc0")
+ {
+ Bootloader::setKernelParam (actual_boot_section, "console", "false");
+ }
+ }
+
+ boolean old_progress = Progress::set (false);
+ Bootloader::Write();
+ Progress::set (old_progress);
+ }
+
+ // initialize init system
+ Progress::NextStage();
+ string cmd = "init q";
+ y2milestone ("Running command %1", cmd);
+ map output = (map) SCR::Execute (.target.bash_output, cmd);
+ string message = output["stdout"]:"" + output["stderr"]:"";
+ y2milestone ("%1 output: %2", cmd, message);
+
+ Progress::NextStage();
+ return true;
+}
+/* EOF */
+}
Added: trunk/s390/src/modules/IUCVTerminalServer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/IUCVTerminalServer.ycp?rev=66364&view=auto
==============================================================================
--- trunk/s390/src/modules/IUCVTerminalServer.ycp (added)
+++ trunk/s390/src/modules/IUCVTerminalServer.ycp Mon Oct 10 15:37:46 2011
@@ -0,0 +1,606 @@
+/**
+ * File: modules/IUCVTerminalServer.ycp
+ * Package: Configuration IUCV Terminal Server
+ * Summary: IUCV Terminal Server settings, input and output functions
+ * Authors: Tim Hardeck
+ *
+ */
+
+{
+
+module "IUCVTerminalServer";
+textdomain "s390";
+
+import "FileUtils";
+import "Report";
+import "String";
+import "Progress";
+import "Integer";
+import "Popup";
+import "Users";
+
+/**
+ * Text to select all
+ */
+global define const string TEXT_ALL = _("<ALL>");
+
+/**
+ * Path of the TS-Shell
+ */
+define const string TSSHELL_SHELL = "/usr/bin/ts-shell";
+
+/**
+ * Path of the IUCVConn shell
+ */
+define const string IUCVCONN_SHELL = "/usr/bin/iucvconn_on_login";
+
+/**
+ * Data was modified?
+ */
+global boolean modified = false;
+
+/**
+ * List of zvmids
+ */
+global list<string> zvm_id_list = [];
+
+/**
+ * Is TS-Shell enabled?
+ */
+global boolean ts_enabled = false;
+
+/**
+ * TS-Shell Home Directory
+ */
+global string ts_home = "/home/tsshell";
+
+/**
+ * List of audited tsshell ids
+ */
+global list<string> ts_audited_ids = [];
+
+/**
+ * Did the TS-Shell status change (from off to on or vice versa)
+ */
+global boolean ts_has_status_changed = false;
+
+/**
+ * List/Regex/file map per TS-Shell user/group
+ * the key of the first map is the user/group name
+ * the key of the second map is the selected radio button symbol
+ */
+global define map > ts_member_conf = $[ ];
+
+/**
+ * Map of the loaded ts-authorization.conf settings (for saving purposes)
+ */
+define map ts_authorization_map = $[ ];
+
+
+/**
+ * Is IUCVConn enabled?
+ */
+global boolean ic_enabled = false;
+
+/**
+ * IUCVConn Home Directory
+ */
+global string ic_home = "/home/iucvconn";
+
+global boolean CheckUserGroupName (string name) {
+ return regexpmatch(name, "^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_][ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-]*[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.$-]\?$");
+}
+
+/**
+ * GetUsers
+ * @param boolean local (only local users?)
+ * @return map of users
+ */
+global map GetUsers (boolean local) {
+ map users = (map) Users::GetUsers ("uid","local");
+ if (!local)
+ {
+ users = (map) union (users, Users::GetUsers ("uid","system"));
+ }
+ return users;
+}
+
+/**
+ * GetGroups
+ * @param boolean local (only local groups?)
+ * @return map of groups
+ */
+global map GetGroups (boolean local) {
+ map groups = (map) Users::GetGroups ("cn","local");
+ if (!local)
+ {
+ groups = (map) union (groups, Users::GetGroups ("cn","system"));
+ }
+ return groups;
+}
+
+/**
+ * Delete users
+ * @param username
+ * @return boolean true if deletion was successful
+ */
+global boolean DeleteUser (string username)
+{
+ Users::SelectUserByName (username);
+ // don't remove home since we only have one for all
+ boolean ret = Users::DeleteUser (false);
+ Users::CommitUser ();
+ return ret;
+}
+
+/**
+ * Gather all users which have TS-Shell as their shell
+ * @return list of usernames
+ */
+global list<string> GetTsUsersList () {
+ list<string> ts_users = [];
+ map local_users = GetUsers(true);
+ foreach (string username, map user, local_users,{
+ if ( user["loginShell"]:nil == TSSHELL_SHELL )
+ {
+ ts_users = add(ts_users, username);
+ }
+ });
+ return ts_users;
+}
+
+/**
+ * Gather all users which have TS-Shell as their shell
+ * @return list of usernames
+ */
+global list<string> GetIcUsersList () {
+ list<string> ic_users = [];
+ map local_users = GetUsers(true);
+ foreach (string username, map user, local_users,{
+ if ( user["loginShell"]:nil == IUCVCONN_SHELL )
+ {
+ ic_users = add(ic_users, username);
+ }
+ });
+ return ic_users;
+}
+
+/**
+ * Abstract add a new user function
+ * @parm string username, string password, string group_id, string home, string shell, map additional_groups ($[user : "1", user2 : "1" ...]
+ * @return the new user id as a string
+ */
+define string AddUser(string username, string password, string group_id, string home, string shell, map additional_groups, boolean force_pw_change) {
+ string new_userid = "";
+
+ // create home directory if it doesn't exist
+ boolean create_home = !FileUtils::IsDirectory(home);
+
+ // make sure that the user doesn't already exist
+ map users = GetUsers(false);
+
+ if (!haskey(users, username))
+ {
+ map user = $[
+ "uid" : username,
+ "loginShell" : shell,
+ "homeDirectory" : home,
+ "userPassword" : password,
+ "create_home" : create_home,
+ "chown_home" : false,
+ "grouplist" : additional_groups
+ ];
+ // only change the default group id if defined
+ if (group_id != "")
+ {
+ user = add(user, "gidNumber", group_id);
+ }
+ if (force_pw_change)
+ {
+ user = add(user, "shadowLastChange", "0");
+ }
+
+ string error = Users::AddUser (user);
+ // if adding successfull
+ if (error == "")
+ {
+ Users::CommitUser();
+
+ // get uid of the new user
+ map user = Users::GetUserByName (username, "");
+ new_userid = user["uidNumber"]:"0";
+ }
+ else
+ {
+ y2milestone("Adding user %1 failed with the error: %2", username, error);
+ }
+ }
+ else
+ {
+ y2milestone("The user %1 does already exist.", username);
+ }
+ return new_userid;
+}
+
+/**
+ * Sync z/VM ids with the user accounts
+ * @parm list of z/VM ids and the default IC password
+ * @return void
+ */
+global void SyncIucvConnUsers (list<string> zvmid_list, string ic_password) {
+ y2milestone("Syncing IUCVConn users.");
+
+ list<string> ic_users = GetIcUsersList();
+
+ // delete obsolete users
+ list<string> obsolete_users = filter (string user, ic_users, { return (!contains(zvmid_list, user)); });
+ foreach (string user, obsolete_users,{
+ y2milestone("Delete obsolete IUCVConn user %1", user);
+ DeleteUser(user);
+ });
+
+ // add missing users
+ list<string> users_to_add = filter (string user, zvmid_list, { return (!contains(ic_users, user)); });
+ foreach (string user, users_to_add,{
+ y2milestone("Add missing IUCVConn user %1", user);
+ AddUser(user, ic_password, "", ic_home, IUCVCONN_SHELL, $[], false);
+ });
+}
+
+/**
+ * Add a new TS-Shell user
+ * @parm string username, string password, string home, map additional_groups ($[user : "1", user2 : "1" ...]
+ * @return the new user id as a string
+ */
+global string AddTsUser(string username, string password, string home, map additional_groups, boolean force_pw_change) {
+ y2milestone("Adding TS-Shell user %1.", username);
+ // get TS-Shell group id
+ map group = Users::GetGroupByName ("ts-shell","system");
+ string group_id = group["gidNumber"]:"";
+
+ string new_uid = AddUser(username, password, group_id, home, TSSHELL_SHELL, additional_groups, force_pw_change);
+
+ return new_uid;
+}
+
+/**
+ * Update a configuration entry for TS-Shell users and configured groups
+ * @param name of the entry (groups start with an "@"); value
+ * @return void
+ */
+define void UpdateTsMemberConfig(string name, string value) {
+ // if entry doesn't exist create it
+ if (!haskey(ts_member_conf, name))
+ {
+ ts_member_conf = add(ts_member_conf, name,
+ $[ `type : (symbol)`rb_ts_list,
+ `rb_ts_list : (list <string>) [ ],
+ `rb_ts_regex: (string) "",
+ `rb_ts_file : (string) ""
+ ]);
+ }
+
+ // update entries
+ if (regexpmatch( value, "^list:"))
+ {
+ // remove leading "list:"
+ value = substring(value, 5);
+
+ list<string> loaded_ids = splitstring(value, ",");
+ // filter unknown z/VM IDs
+ loaded_ids = filter (string name, loaded_ids, { return (contains(zvm_id_list, name)); });
+
+ ts_member_conf[name, `rb_ts_list] = loaded_ids;
+ ts_member_conf[name, `type] = `rb_ts_list;
+ }
+ else if (regexpmatch( value, "^regex:"))
+ {
+ value = substring(value, 6);
+ ts_member_conf[name, `rb_ts_regex] = value;
+ ts_member_conf[name, `type] = `rb_ts_regex;
+ }
+ else if (regexpmatch( value, "^file:"))
+ {
+ value = substring(value, 5);
+ ts_member_conf[name, `rb_ts_file] = value;
+ ts_member_conf[name, `type] = `rb_ts_file;
+ }
+}
+
+/**
+ * Read all settings
+ * @return true on success
+ */
+global define boolean Read () {
+ string caption = _("Loading IUCV Terminal Server Configuration");
+ integer steps = 2;
+
+ Progress::New (caption, " ", steps, [
+ /* Progress stage 1/2 */
+ _("Read configuration files"),
+ /* Progress stage 2/2 */
+ _("Load user/group settings")
+ ], [
+ /* Progress step 1/2 */
+ _("Reading configuration files..."),
+ /* Progress step 2/2 */
+ _("Loading user/group settings..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
+ );
+
+ Progress::NextStage();
+ y2milestone("Reading user and group entries.");
+ boolean old_progress = Progress::set(false);
+ // read global user and group entries
+ Users::Read();
+ Progress::set(old_progress);
+
+ // initialize tsshell user list
+ list<string> ts_users = GetTsUsersList();
+ foreach (string username, ts_users,{
+ UpdateTsMemberConfig(username, "");
+ });
+
+ // Load settings
+ Progress::NextStage();
+ string filename = "/etc/sysconfig/iucv_terminal_server";
+ if (FileUtils::Exists (filename))
+ {
+ y2milestone("Reading configuration from sysconfig %1.", filename);
+ string zvm_ids = (string) SCR::Read(.sysconfig.iucv_terminal_server.ZVM_IDS);
+ if (zvm_ids != nil)
+ {
+ zvm_id_list = splitstring(zvm_ids, " ");
+ }
+
+ ts_enabled = ("true" == (string)SCR::Read(.sysconfig.iucv_terminal_server.ENABLE_TSSHELL));
+ string home = (string) SCR::Read(.sysconfig.iucv_terminal_server.TSSHELL_HOME);
+ // use default if not set
+ if (home != nil)
+ {
+ ts_home = home;
+ }
+
+ ic_enabled = ("true" == (string)SCR::Read(.sysconfig.iucv_terminal_server.ENABLE_IUCVCONN));
+ home = (string) SCR::Read(.sysconfig.iucv_terminal_server.IUCVCONN_HOME);
+ // user default if not set
+ if (home != nil)
+ {
+ ic_home = home;
+ }
+ }
+
+ filename = "/etc/iucvterm/ts-audit-systems.conf";
+ if (FileUtils::Exists (filename))
+ {
+ y2milestone("Reading configuration from %1.", filename);
+ list<string> original_ts_audited_ids = splitstring((string)SCR::Read (.target.string, filename), "\n");
+ if(contains(original_ts_audited_ids, "[*ALL*]"))
+ {
+ // add all if configured
+ ts_audited_ids = (list<string>) merge( [TEXT_ALL], zvm_id_list);
+ }
+ else
+ {
+ // only add known ids
+ ts_audited_ids = filter (string name, original_ts_audited_ids, { return (!contains(zvm_id_list, name)); });
+ }
+ }
+
+ filename = "/etc/iucvterm/ts-authorization.conf";
+ if (FileUtils::Exists (filename))
+ {
+ y2milestone("Reading configuration from %1.", filename);
+ // the settings map is globally kept for saving purposes
+ ts_authorization_map = (map ) SCR::Read(.etc.iucvterm-ts-authorization.all);
+ list