Next: , Previous: , Up: Programming Manual   [Contents][Index]


5.2 Initialization Functions

shishi

Function: Shishi * shishi ()

Description: Initializes the Shishi library, and primes logging so that future warnings and informational messages are printed on stderr. If this function fails, it may send its own diagnostic errors to stderr.

Return value: Returns a Shishi library handle, or NULL on error.

shishi_server

Function: Shishi * shishi_server ()

Description: Initializes the Shishi library, and primes logging so that future warnings and informational messages are sent to the syslog system. If this function fails, it may print diagnostic errors in the syslog.

Return value: Returns a Shishi library handle, or NULL on error.

shishi_done

Function: void shishi_done (Shishi * handle)

handle: Shishi handle as allocated by shishi_init().

Description: Deallocates the Shishi library handle. The handle must not be used in any call to a shishi function after an execution of shishi_done().

If there is a default tkts, it is written to the default tkts file. If you do not wish to write the default tkts file, close the default file before calling this function. It is closed with a simple shishi_tkts_done(handle, NULL). For related information, see shishi_tkts_default_file_set().

shishi_init

Function: int shishi_init (Shishi ** handle)

handle: Pointer to a Shishi handle created by this call.

Description: Creates a Shishi library handle, using shishi(), and reads the system configuration file, user configuration file and user tickets from their default locations. The paths to the system configuration file is decided at compile time, and is sysconfdir/shishi.conf. The user configuration file is HOME/.shishi/config, and the user ticket file is HOME/.shishi/ticket.

The handle is allocated regardless of return value. The single exception being SHISHI_HANDLE_ERROR, which indicates a problem in allocating the handle. Other error conditions could arise while reading files.

Return value: Returns SHISHI_OK iff successful.

shishi_init_with_paths

Function: int shishi_init_with_paths (Shishi ** handle, const char * tktsfile, const char * systemcfgfile, const char * usercfgfile)

handle: Pointer to a Shishi handle created by this call.
tktsfile: Filename of ticket file, or NULL.
systemcfgfile: Filename of system configuration, or NULL.
usercfgfile: Filename of user configuration, or NULL.

Description: Creates a Shishi library handle, using shishi(), and reads the system configuration file, user configuration file, and user tickets at the specified locations. If any of usercfgfile or systemcfgfile is NULL, the file is read from its default location, which for the system configuration is decided at compile time, and is sysconfdir/shishi.conf, and for the user configuration it is HOME/.shishi/config. If the ticket file name is NULL, a ticket file is not read at all.

The handle is allocated regardless of return value. The single exception being SHISHI_HANDLE_ERROR, which indicates a problem in allocating the handle. Other error conditions could arise while reading files.

Return value: Returns SHISHI_OK iff successful.

shishi_init_server

Function: int shishi_init_server (Shishi ** handle)

handle: Pointer to a Shishi handle created by this call.

Description: Creates a Shishi library handle, using shishi_server(), and reads the system configuration file. The path to the system configuration file is decided at compile time, and is sysconfdir/shishi.conf.

The handle is allocated regardless of return value. The single exception being SHISHI_HANDLE_ERROR, which indicates a problem in allocating the handle. Other error conditions could arise while reading the file.

Return value: Returns SHISHI_OK iff successful.

shishi_init_server_with_paths

Function: int shishi_init_server_with_paths (Shishi ** handle, const char * systemcfgfile)

handle: Pointer to a Shishi handle created by this call.
systemcfgfile: Filename of system configuration, or NULL.

Description: Creates a Shishi library handle, using shishi_server(), and reads the system configuration file from the specified location. The path to the system configuration file is decided at compile time, and is sysconfdir/shishi.conf.

The handle is allocated regardless of return value. The single exception being SHISHI_HANDLE_ERROR, which indicates a problem in allocating the handle. Other error conditions could arise while reading the file.

Return value: Returns SHISHI_OK iff successful.

shishi_cfg

Function: int shishi_cfg (Shishi * handle, const char * option)

handle: Shishi library handle created by shishi_init().
option: String containing shishi library options.

Description: Configures the shishi library according to the options given in option.

Return value: Returns SHISHI_OK if option is valid and configuration was successful.

shishi_cfg_from_file

Function: int shishi_cfg_from_file (Shishi * handle, const char * cfg)

handle: Shishi library handle created by shishi_init().
cfg: Name of configuration file.

Description: Configures the shishi library using a configuration file located at cfg.

Return value: Returns SHISHI_OK if successful.

shishi_cfg_print

Function: int shishi_cfg_print (Shishi * handle, FILE * fh)

handle: Shishi library handle created by shishi_init().
fh: File stream handle opened for writing.

Description: Prints library configuration status to fh. This function is mostly intended for debugging purposes.

Return value: Always returns SHISHI_OK.

shishi_cfg_default_systemfile

Function: const char * shishi_cfg_default_systemfile (Shishi * handle)

handle: Shishi library handle created by shishi_init().

Description: The system configuration file name is decided at compile time, but is replaced by assigning another file name to the environment variable SHISHI_CONFIG. This call offers a single interface for determining the file name, to which the library turns for its settings.

Return value: Returns file name of present system configuration.

shishi_cfg_default_userdirectory

Function: const char * shishi_cfg_default_userdirectory (Shishi * handle)

handle: Shishi library handle created by shishi_init().

Description: The default user directory, referred to for Shishi ticket cache and other purposes, is normally computed by appending the fixed string "/.shishi" to the content of the environment variable HOME.

This hard coded directory, i.e., "HOME/.shishi/", can be replaced by whatever complete path is stored in the environment variable SHISHI_HOME.

Return value: Returns the user’s directory name where the Shishi library will search for configuration files, ticket caches, etcetera.

shishi_cfg_userdirectory_file

Function: char * shishi_cfg_userdirectory_file (Shishi * handle, const char * file)

handle: Shishi library handle created by shishi_init().
file: Basename of file to use for the user’s configuration settings of the library.

Description: Reports the full path to the file where the Shishi library expects to find the user’s library configuration, given that the file itself is named by the parameter file.

The answer is composed from the value of file and the directory returned by shishi_cfg_default_userdirectory(). Typically, the returned string would be expanded from "HOME/.shishi/file".

Return value: Returns the absolute filename to the argument file, relative to the user specific Shishi configuration directory.

shishi_cfg_default_userfile

Function: const char * shishi_cfg_default_userfile (Shishi * handle)

handle: Shishi library handle created by shishi_init().

Description: Reports the absolute filename of the default user configuration file. This is typically "HOME/.shishi/shishi.conf".

The value of SHISHI_HOME will change the directory part, as stated regarding shishi_cfg_default_userdirectory().

Return value: Returns the user’s configuration filename.

shishi_cfg_clientkdcetype

Function: int shishi_cfg_clientkdcetype (Shishi * handle, int32_t ** etypes)

handle: Shishi library handle created by shishi_init().
etypes: Pointer to an array of encryption types.

Description: Sets the variable etypes to a static array of preferred encryption types applicable to clients.

Return value: Returns the number of encryption types referred to by the updated array pointer, or zero, should no type exist.

shishi_cfg_clientkdcetype_fast

Function: int32_t shishi_cfg_clientkdcetype_fast (Shishi * handle)

handle: Shishi library handle created by shishi_init().

Description: Extracts the default encryption type from the list of preferred encryption types acceptable to the client.

When the preferred list is empty, SHISHI_AES256_CTS_HMAC_SHA1_96 is returned as a sensible default type.

Return value: Returns the default encryption type.

shishi_cfg_clientkdcetype_set

Function: int shishi_cfg_clientkdcetype_set (Shishi * handle, char * value)

handle: Shishi library handle created by shishi_init().
value: String naming acceptable encryption types.

Description: Sets the configuration option "client-kdc-etypes" from value. The string contains encryption types, integers or names, separated by comma or by whitespace. An example naming three encryption types could be:

aes256-cts-hmac-sha1-96 des3-cbc-sha1-kd des-cbc-md5

Return value: Returns SHISHI_OK if successful, and SHISHI_INVALID_ARGUMENT otherwise.

shishi_cfg_authorizationtype_set

Function: int shishi_cfg_authorizationtype_set (Shishi * handle, char * value)

handle: Shishi library handle created by shishi_init().
value: String listing acceptable authorization types.

Description: Sets the configuration option "authorization-types" from value. The string contains authorization types, integers or names, separated by comma or whitespace.

As an example, "k5login basic" would first check Kerberos5 authentication based on preset principals, and then fall back to the basic test of identical principal names.

Return value: Returns SHISHI_OK if successful, and SHISHI_INVALID_ARGUMENT otherwise.


Next: , Previous: , Up: Programming Manual   [Contents][Index]