YaST2 Developers Documentation: Configuration of inetd

Configuration of inetd

include/inetd/routines.ycp
Miscelanous functions for configuration of inetd.
  • Petr Hadraba
  • Martin Lazar

This module has an unstable interface.

Imports

  • Inetd
  • Package
  • Popup
  • Progress
  • Service
  • String
  • UsersCache

Local Variables

Local Functions

local PollAbort () -> boolean

Check for pending Abort press

Return value:
true if pending abort
local ReallyAbort () -> boolean

If modified, ask for confirmation

Return value:
true if abort is confirmed
local ProgressNextStage (string title) -> void

Progress::NextStage and Progress::Title combined into one function

Parameters:
title progressbar title
local GetServerBasename (string server, string server_args) -> string

Used for cpmparisons whether the servers match: If server is /usr/sbin/tcpd, consider server_args instead. Then take the firse word (strips arguments or the parenthesized pkg name). Then take the last slash-delimited component. For sparse matching: nil is returned if server is nil (or if server args is nil AND is needed)

Parameters:
server "server" field of a service
server_args "server_args" field of a service
Return value:
basename of the real server
local struct_match (map a, map b, list fields) -> boolean

Considers the maps as structs and tests some of their fields for equality (conjunctively, short circuit).

Parameters:
a one struct
b other struct
fields list of keys
Return value:
Do the maps have all the named fields equal?
local struct_match_sparse (map a, map b, list fields) -> boolean

Considers the maps as structs and tests some of their fields for equality (conjunctively, short circuit). If a key is missing in either of the maps, it is considered as matching.

Used when merging autoyast items, to match only those fields that are specified in the profile. There, only one map is sparse. (the profile map)

Parameters:
a one struct
b other struct
fields list of keys
Return value:
Do the maps have all named fields that are in both of them equal?
Example
 match: $["a": 1, "b": 2, "c": 3], $["b": 2, "d": 4]
local isServiceMatchPresent (list<map <string, any> > netd_conf, map<string, any> s) -> boolean

Determine, if service package is installed. This function requires full configuration (like Inetd::netd_conf) and standalone map with service. Linear complexity (in the working config)

Parameters:
netd_conf Full configuration
s a service
Return value:
match found
local AddNotInstalled (list<map <string, any> > netd_conf, list<term> table_data) -> list<term>

This function merges real xinetd configuration (read by agent) and available services packages generated for SuSE distribution This function is automaticaly calld by CreateTableData() if Inetd::configured_service is `xinetd.

Adds those from default_conf that do not have a matching service in the working config.

Parameters:
netd_conf not used in this function, but used for isServiceMatchPresent call.
table_data Table data structure used as source data
Return value:
New table data
local ServiceToTableItem (map service, integer ni_index) -> term

Parameters:
service service
ni_index if nil, use iid as id, otherwise "NI"+ni_index
Return value:
main table item
local SortTableData (list <term> unsorted_terms, integer sort_by) -> list <term>

Sorts items for table of xinetd services

Parameters:
unsorted_terms
sort_by
Return value:
sorted_terms
local CreateTableData (list<map <string, any> > netd_conf) -> list<term>

Converts configuration format from agent to table data structures

Parameters:
netd_conf netd_conf handles whole configuration of configured service
Return value:
returnes table data
local CreateLocalUsersList () -> list<string>

Read user names from passwd. It does not get the NIS entries. "+" is filtered out.

Return value:
users
local CreateLocalGroupsList () -> list<string>

Read group names from group It does not get the NIS entries. "+" is filtered out.

Return value:
groups
local IsAnyServiceEnabled (list<map <string, any> > ready_conf) -> symbol

Find any service to be enabled If no found, return `no

Parameters:
ready_conf ready_conf handles whole service configuration (Inetd::netd_conf)
Return value:
returnes if found `yes, otherwise `no
local ServicesMatch (map<string, any> a, map<string, any> b) -> boolean

Do the services match? Considered fields: "script", "service", "protocol", "server" (or "server_args", if tcpd) The matching is sparse: a missing field in either map means the field is condidered as matching.

Parameters:
a one map
b other map
Return value:
match?
local is_installed_cache -> map

Cache for IsInstalled.

local IsInstalledClearCache () -> void

Clears cache for IsInstalled . This is too wasteful. Later, when it works, optimize for single packages.

local IsInstalled (string rpm) -> boolean

Queries RPM or autoyast list whether a package is installed. Results are cached in is_installed_cache

Parameters:
rpm eg. "finger-server", "" has special significance: package unknown, so it cannot be installed
Return value:
installed?