Next: , Previous: Preparation, Up: Programming Manual


5.2 Initialization Functions

shishi

— Function: Shishi * shishi ( void)

Initializes the Shishi library, and set up, using shishi_error_set_outputtype(), the library so that future warnings and informational messages are printed to stderr. If this function fails, it may print diagnostic errors to stderr.

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

shishi_server

— Function: Shishi * shishi_server ( void)

Initializes the Shishi library, and set up, using shishi_error_set_outputtype(), the library so that future warnings and informational messages are printed to the syslog. If this function fails, it may print diagnostic errors to the syslog.

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

shishi_done

— Function: void shishi_done (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Deallocates the shishi library handle. The handle must not be used in any calls to shishi functions after this.

If there is a default tkts, it is written to the default tkts file (call shishi_tkts_default_file_set() to change the default tkts file). If you do not wish to write the default tkts file, close the default tkts with shishi_tkts_done(handle, NULL) before calling this function.

shishi_init

— Function: int shishi_init (Shishi ** handle)

handle: pointer to handle to be created.

Create a Shishi library handle, using shishi(), and read 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 values, except for SHISHI_HANDLE_ERROR which indicates a problem allocating the handle. (The other error conditions comes from reading the 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 handle to be created.

tktsfile: Filename of ticket file, or NULL.

systemcfgfile: Filename of system configuration, or NULL.

usercfgfile: Filename of user configuration, or NULL.

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

The handle is allocated regardless of return values, except for SHISHI_HANDLE_ERROR which indicates a problem allocating the handle. (The other error conditions comes from reading the files.)

Return value: Returns SHISHI_OK iff successful.

shishi_init_server

— Function: int shishi_init_server (Shishi ** handle)

handle: pointer to handle to be created.

Create a Shishi library handle, using shishi_server(), and read the system configuration file. The paths to the system configuration file is decided at compile time, and is $sysconfdir/shishi.conf.

The handle is allocated regardless of return values, except for SHISHI_HANDLE_ERROR which indicates a problem allocating the handle. (The other error conditions comes from 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 handle to be created.

systemcfgfile: Filename of system configuration, or NULL.

Create a Shishi library handle, using shishi_server(), and read the system configuration file from specified location. The paths to the system configuration file is decided at compile time, and is $sysconfdir/shishi.conf. The handle is allocated regardless of return values, except for SHISHI_HANDLE_ERROR which indicates a problem allocating the handle. (The other error conditions comes from reading the file.)

Return value: Returns SHISHI_OK iff successful.

shishi_cfg

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

handle: Shishi library handle create by shishi_init().

option: string with shishi library option.

Configure shishi library with given option.

Return Value: Returns SHISHI_OK if option was valid.

shishi_cfg_from_file

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

handle: Shishi library handle create by shishi_init().

cfg: filename to read configuration from.

Configure shishi library using configuration file.

Return Value: Returns SHISHI_OK iff succesful.

shishi_cfg_print

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

handle: Shishi library handle create by shishi_init().

fh: file descriptor opened for writing.

Print library configuration status, mostly for debugging purposes.

Return Value: Returns SHISHI_OK.

shishi_cfg_default_systemfile

— Function: const char * shishi_cfg_default_systemfile (Shishi * handle)

handle: Shishi library handle create by shishi_init().

The system configuration file name is decided at compile-time, but may be overridden by the environment variable SHISHI_CONFIG.

Return value: Return system configuration file name.

shishi_cfg_default_userdirectory

— Function: const char * shishi_cfg_default_userdirectory (Shishi * handle)

handle: Shishi library handle create by shishi_init().

The default user directory (used for, e.g. Shishi ticket cache) is normally computed by appending BASE_DIR ("/.shishi") to the content of the environment variable $HOME, but can be overridden by specifying the complete path in the environment variable SHISHI_HOME.

Return value: Return directory with configuration files etc.

shishi_cfg_userdirectory_file

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

handle: Shishi library handle create by shishi_init().

file: basename of file to find in user directory.

Get the full path to specified file in the users' configuration directory.

Return value: Return full path to given relative filename, relative to the user specific Shishi configuration directory as returned by shishi_cfg_default_userdirectory() (typically $HOME/.shishi).

shishi_cfg_default_userfile

— Function: const char * shishi_cfg_default_userfile (Shishi * handle)

handle: Shishi library handle create by shishi_init().

Get filename of default user configuration file, typically $HOME/shishi.conf.

Return value: Return user configuration filename.

shishi_cfg_clientkdcetype

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

handle: Shishi library handle create by shishi_init().

etypes: output array with encryption types.

Set the etypes variable to the array of preferred client etypes.

Return value: Return the number of encryption types in the array, 0 means none.

shishi_cfg_clientkdcetype_fast

— Function: int32_t shishi_cfg_clientkdcetype_fast (Shishi * handle)

handle: Shishi library handle create by shishi_init().

Extract the default etype from the list of preferred client etypes.

Return value: Return the default encryption types.

shishi_cfg_clientkdcetype_set

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

handle: Shishi library handle create by shishi_init().

value: string with encryption types.

Set the "client-kdc-etypes" configuration option from given string. The string contains encryption types (integer or names) separated by comma or whitespace, e.g. "aes256-cts-hmac-sha1-96 des3-cbc-sha1-kd des-cbc-md5".

Return value: Return SHISHI_OK iff successful.

shishi_cfg_authorizationtype_set

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

handle: Shishi library handle create by shishi_init().

value: string with authorization types.

Set the "authorization-types" configuration option from given string. The string contains authorization types (integer or names) separated by comma or whitespace, e.g. "basic k5login".

Return value: Return SHISHI_OK iff successful.