This shows you the differences between two versions of the page.
esmith:util [2015/05/22 08:24] stephdl [CONVENTIONS:] |
esmith:util [2019/06/05 19:48] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== esmith:: | ||
- | esmith:: | ||
- | |||
- | In a root terminal you can do the command below if you want to display the up-to-date content | ||
- | perldoc esmith:: | ||
- | ===== VERSION ===== | ||
- | This file documents " | ||
- | |||
- | ==== SYNOPSIS ==== | ||
- | use esmith:: | ||
- | |||
- | ===== DESCRIPTION ===== | ||
- | This module provides general utilities of use to developers of the e-smith server and gateway. | ||
- | |||
- | ===== GENERAL UTILITIES ===== | ||
- | ==== setRealToEffective() ==== | ||
- | |||
- | Sets the real UID to the effective UID and the real GID to the effective GID. | ||
- | |||
- | ==== processTemplate({ CONFREF => $conf, TEMPLATE_PATH => $path }) ==== | ||
- | |||
- | Depreacted interface to esmith:: | ||
- | |||
- | ==== chownfile($user, | ||
- | |||
- | This routine changes the ownership of a file, automatically converting usernames and groupnames to UIDs and GIDs respectively. | ||
- | |||
- | ==== determineRelease() ==== | ||
- | |||
- | Returns the current release version of the software. | ||
- | |||
- | ==== NETWORK ADDRESS TRANSLATION UTILITIES ==== | ||
- | ==== IPquadToAddr($ip) ==== | ||
- | |||
- | Convert IP address from " | ||
- | |||
- | ==== IPaddrToQuad($address) ==== | ||
- | Convert IP address from a 32-bit integer to " | ||
- | |||
- | ==== IPaddrToBackwardQuad($address) ==== | ||
- | |||
- | Convert IP address from a 32-bit integer to reversed " | ||
- | |||
- | ==== computeNetworkAndBroadcast($ipaddr, | ||
- | |||
- | Given an IP address and netmask (both in " | ||
- | |||
- | ==== computeLocalNetworkPrefix($ipaddr, | ||
- | |||
- | Given an IP address and netmask, the computeLocalNetworkPrefix function computes the network prefix for local machines. | ||
- | |||
- | i.e. for an IP address of 192.168.8.4 and netmask of 255.255.255.0, | ||
- | |||
- | This string is suitable for use in configuration files (such as / | ||
- | |||
- | ==== computeAllLocalNetworkPrefixes ($ipaddress, | ||
- | |||
- | Given an IP address and netmask, the computeAllLocalNetworkPrefixes function computes the network prefix or list of prefixes that fully describe the network to which the IP address belongs. | ||
- | |||
- | examples: | ||
- | |||
- | * for an IP address of 192.168.8.4 and netmask of 255.255.255.0, | ||
- | |||
- | * for an IP address of 192.168.8.4 and netmask of 255.255.254.0, | ||
- | |||
- | This array is suitable for use in configuration of tools such as djbdns where other network notations are not supported. | ||
- | |||
- | ==== computeLocalNetworkShortSpec($ipaddr, | ||
- | |||
- | Given an IP address and netmask, the computeLocalNetworkShortSpec function computes a valid xxx.xxx.xxx.xxx/ | ||
- | |||
- | i.e. for an IP address of 192.168.8.4 and netmask of 255.255.255.0, | ||
- | |||
- | This string is suitable for use in configuration files (such as / | ||
- | |||
- | ==== computeLocalNetworkSpec($ipaddr, | ||
- | |||
- | Given an IP address and netmask, the computeLocalNetworkSpec function computes a valid xxx.xxx.xxx.xxx/ | ||
- | |||
- | ==== computeNetmaskFromBits ($bits) ==== | ||
- | |||
- | Given a number of bits of network address, calculate the appropriate netmask. | ||
- | |||
- | ==== computeLocalNetworkReversed($ipaddr, | ||
- | |||
- | Given an IP address and netmask, the computeLocalNetworkReversed function computes the appropriate DNS domain field. | ||
- | |||
- | === NOTE: === | ||
- | The return value is aligned to the next available byte boundary, i.e. | ||
- | |||
- | 192.168.8.4/ | ||
- | 192.168.8.4/ | ||
- | 192.168.8.4/ | ||
- | 192.168.8.4/ | ||
- | 192.168.8.4/ | ||
- | |||
- | This string is suitable for use in BIND configuration files. | ||
- | |||
- | ==== computeHostRange($ipaddr, | ||
- | |||
- | Given a network specification (IP address and netmask), compute the total number of hosts in that network, as well as the first and last IP addresses in the range. | ||
- | |||
- | ==== ldapBase($domain) ==== | ||
- | |||
- | Given a domain name such as foo.bar.com, | ||
- | |||
- | ==== backgroundCommand($delaySec, | ||
- | |||
- | Run command in background after a specified delay. | ||
- | |||
- | ===== PASSWORD UTILITIES ===== | ||
- | Low-level password-changing utilities. These utilities each change passwords for a single underlying password database, for example / | ||
- | |||
- | ==== validatePassword($password, | ||
- | |||
- | Validate Unix password. | ||
- | |||
- | ==== setUnixPassword($username, | ||
- | |||
- | Set Unix password | ||
- | |||
- | ==== authenticateUnixPassword ($username, $password) ==== | ||
- | |||
- | Check if the given username/ | ||
- | |||
- | ==== setUnixPasswordRequirePrevious($username, | ||
- | |||
- | Set Unix password but require previous password for authentication. | ||
- | |||
- | ==== setSambaPassword($username, | ||
- | |||
- | Set Samba password | ||
- | |||
- | ==== cancelSambaPassword($username) ==== | ||
- | |||
- | Cancel Samba password | ||
- | |||
- | ==== LdapPassword() ==== | ||
- | |||
- | Returns the LDAP password from the file "/ | ||
- | |||
- | Returns undef if the password could not be generated/ | ||
- | |||
- | ===== HIGH LEVEL PASSWORD UTILITIES ===== | ||
- | High-level password-changing utilities. These utilities each change passwords for a single e-smith entity (system, user or ibay). Each one works by calling the appropriate low-level password changing utilities. | ||
- | |||
- | ==== setUnixSystemPassword($password) ==== | ||
- | |||
- | Set the e-smith system password | ||
- | |||
- | ==== setServerSystemPassword($password) ==== | ||
- | |||
- | Set the samba administrator password. | ||
- | |||
- | ==== setUserPassword($username, | ||
- | |||
- | Set e-smith user password | ||
- | |||
- | ==== setUserPasswordRequirePrevious($username, | ||
- | |||
- | Set e-smith user password - require previous password | ||
- | |||
- | ==== cancelUserPassword ==== | ||
- | |||
- | Cancel user password. This is called when a user is deleted from the system. We assume that the Unix " | ||
- | |||
- | ==== setIbayPassword($ibayname, | ||
- | |||
- | Set ibay password | ||
- | |||
- | ===== SERVICE MANAGEMENT UTILITIES ===== | ||
- | ==== serviceControl() ==== | ||
- | Manage services - stop/ | ||
- | |||
- | Returns 1 for success, 0 if something went wrong, fatal exception on bad arguments. | ||
- | |||
- | | ||
- | | ||
- | | ||
- | [ BACKGROUND=> | ||
- | ); | ||
- | |||
- | ==== EXAMPLE: ==== | ||
- | |||
- | | ||
- | |||
- | ====NOTES: ==== | ||
- | |||
- | The BACKGROUND parameter is optional and can be set to true if start/ | ||
- | |||
- | === CONVENTIONS: | ||
- | |||
- | This command is the supported method for action scripts, blade handlers, etc., to start/ | ||
- | |||
- | ====getLicenses() ==== | ||
- | |||
- | Return all available licenses In scalar context, returns one string combining all licenses In array context, returns an array of individual licenses | ||
- | |||
- | Optionally takes a language tag to be used for retrieving the licenses, defaulting to the locale of the server. | ||
- | |||
- | ==== initialize_default_databases ==== | ||
- | Initialize all databases located at / | ||
- | |||
- | =====AUTHOR ===== | ||
- | Mitel Networks Corp. | ||
- | |||
- | For more information, | ||
- | {{tag> neth-development sme-development }} | ||