YaST2 Developers Documentation: Configuration of inetd

Configuration of inetd

modules/Inetd.ycp
Data for configuration of inetd, input and output functions.
Representation of the configuration of inetd. Input and output routines.

Imports

  • Directory
  • Progress
  • Report
  • Service
  • String
  • Summary

Includes

  • inetd/default_conf_xinetd.ycp
  • inetd/routines.ycp

Structures

Global Variables

Global Functions

Info:

Structure service

 <pre>
 A service map looks like this:
 $[
* as seen on TV^H^H (x)inetd.conf:
   "service": string      // * different from equally named field above
   "rpc_version": string
   "socket_type": string
   "protocol": string
   "wait": boolean
   "max": integer         // inetd only
   "user": string         // *
   "group": string
   "server": string
   "server_args": string
   "comment": string      // possibly multiline, without #
   "enabled": boolean     // service is active
* bookkeeping fields:
   "iid": string          // internal id, use as table `id
                          //   Iid is necessary because there may be multiple variants
                          //   of the same service. See next for iid handling.
   "changed": boolean     // when writing, unchanged services are ignored
                          //   new services (created) must be set as changed
                          //   see changeLine() and see addLine() for more details
   "deleted": boolean     // when deleting, this is set to TRUE and changed
                          // must be set too (see deleteLine())
   "script": string	// which configuration file this comes from
   "package": string	// which rpm it is in
* other fields:
 When handling existing maps, take care to preserve any other fields
 that may be present!

  "unparsed": string	// what the agent could not parse
 ]

 path netd = .whatever.inetd or .whatever.xinetd;

 SCR::Read (.etc.inetd_conf.services) -> list of inetd configuration
 SCR::Read (.etc.xinetd_conf.services) -> list of xinetd configuration
 SCR::Write (.etc.inetd_conf.services, list) -> boolean
 SCR::Write (.etc.xinetd_conf.services, list) -> boolean

 "iid" handling:
 The agent (ag_netd) uses it to locate the service in the config
 files.  Its value should be considered opaque, except that
 ag_netd will check whether it contains a colon (:) and if not,
 consider it a new service.
 Thus new services get "new"+number.
 Non-installed services:
   in normal ui they appear only in the table and get "NI"+number
   in autoyast ui they get "inst"+number
 Where number is last_created
 </pre>
See
autoyast docs.
global AbortFunction -> block<boolean>

Abort function return boolean return true if abort

global Abort () -> boolean

Abort function

Return value:
If AbortFunction not defined, returnes false
global modified -> boolean

Configuration was changed

global proposal_valid -> boolean

used in unused module inetd_proposal.ycp. This will be removed

global write_only -> boolean

For autoinstallation Write() process. Write_only means that the service will not be actually started, because it is done by init later. But also that the service data are only a patch to be applied to the system.

global auto_mode -> boolean

If autoinstallation mode (true), we do not want to install RPMs during configuration. Otherwise (false) we allow all.

global autoyast_initialized -> boolean

Autoyast now does not initially call Import $[] anymore. But our design is so broken that we need it and will work hard to achieve it.

global Modified () -> boolean

Data was modified? This function returnes modified variable.

Return value:
true if modified
global netd_conf -> list<map <string, any> >

 These variable holds inetd configuration.
 This is list of maps. Each map has the following structure:
   $[
     "comment": String,
     "comment_inside": String, // this is agent internal
     "enabled": boolean,
     "group": String,
     "user": String,
     "iid": String,
     "protocol": String,
     "rpc_version": String,
     "server": String,
     "server_args": String,
     "service": String,
     "socket_type": String,
     "unparsed": String,       // agent internal
     "wait": boolean
  ]
 

global netd_status -> integer

Is xinetd running? These variables contains return values from Service::Status() calls.

global last_created -> integer

This variable is used for new iid "generator"

global Read () -> boolean

Read all inetd settings

Return value:
true on success
global MergeEditedWithSystem (services_t system_conf, services_t edited_conf) -> services_t

This function solves differences between new (after installing requested packages) xinetd configuration and the configuration edited by the user.

 In normal mode:
 take the system services
   if it matches a service in the ui (ServicesMatch)
     use the ui data
 (not-installed ones are not a part of netd_conf, they
 only enter the table in mergexinetdconfs)
 Deleted services: OK.
 Added services: a separate pass needed
 
TODO reduce the quadratic complexity.

Parameters:
system_conf holds new configuration (on the system)
edited_conf holds old configuration (UI)
Return value:
Returnes new solved xinetd configuration (ready for Write()).
global Write () -> boolean

Write all inetd settings

Return value:
true on success
global WriteOnly () -> boolean

Only Write settings

Return value:
True on success
global mergeAfterInstall (services_t system_c, services_t user_c) -> services_t

Merges autoinstall profile into the system configuration.

Parameters:
system_c holds new configuration (on the system)
user_c holds old configuration (auto: profile + defaults)
Return value:
Returnes new solved xinetd configuration (ready for Write()).
See
MergeAyProfile
global mergeWithDefaults (services_t changes) -> services_t

merges imported changes with services defaults

Parameters:
changes imported changes
Return value:
complete configuration with user changes
See
MergeAyProfile
global SafeRemove (map m, list keys) -> map

Removes keys from a map. Unlike the remove builtin, does not mind if the keys are already removed.

Parameters:
m a map
keys list of keys to remove
Return value:
the map without the specified keys
global MergeAyProfile (services_t target, services_t changes) -> services_t

Merges AY profile items into a target list (defaults or system).

Parameters:
target base list of services
changes imported changes
Return value:
merged list of services
See
autoyast docs.
global Import (map settings) -> boolean

Get all inetd settings from the first parameter (For use by autoinstallation.)

Parameters:
settings The YCP structure to be imported.
Return value:
True on success
global getChanged (services_t config) -> services_t

Get only changed entries

Parameters:
config complete configuration
Return value:
Returnse list of changes only
global Export () -> map

Dump the inetd settings to a single map (For use by autoinstallation.)

Return value:
Dumped settings (later acceptable by Import ())
global mkeServiceSummary () -> string

Create unsorted list of enabled services

Return value:
Returnes string with RichText-formated list
global Summary () -> string

Create a textual summary and a list of unconfigured cards

Return value:
summary of the current configuration
global deleteLine (any line_number) -> void

delete line in netd_conf

Parameters:
line_number "iid" geted from table's item ID
global addLine (service_t new_line) -> void

add a line in DB

Parameters:
new_line new_line contains new entry for global netd_conf configuration
global changeLine (service_t new_line, any line_number) -> void

Change a line in DB

Parameters:
new_line new_line contains changes for entry in netd_conf
line_number line_number contains iid of changed entry in netd_conf
global AutoPackages () -> map

Return required packages for auto-installation FIXME: Need to make this return the needed packages during installation

Return value:
of packages to be installed and to be removed