krb5_support(3)
πΈ NAME πΈ
krb5_support β Heimdal Kerberos 5 support functions π
Okay so hi bestie!! π«Ά Welcome to krb5_support(3), the support-functions corner of the Heimdal Kerberos 5 library. This page is packed, and it's giving very much "the glue that holds everything together" energy. β¨
β¨ SYNOPSIS β¨
π Data Structures
struct krb5plugin_an2ln_ftable_descβ the description of thekrb5_aname_to_lname(3)plugin facility.struct krb5plugin_db_ftable_descβ the description of the krb5 DB plugin facility.struct krb5plugin_kuserok_ftable_descβ the description of thekrb5_kuserok(3)plugin facility.
π Functions
Lowkey a whole friend group of functions, no cap. Here they all are, verbatim, because names are sacred:
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_acl_match_string
(krb5_context context, const char *string, const char *format,...)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_acl_match_file
(krb5_context context, const char *file, const char *format,...)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_aname_to_localname
(krb5_context context, krb5_const_principal aname, size_t lnsize,
char *lname)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_config_parse_file_multi (krb5_context context, const char
*fname, krb5_config_section **res)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_config_file_free
(krb5_context context, krb5_config_section *s)
KRB5_LIB_FUNCTION const krb5_config_binding *KRB5_LIB_CALL
krb5_config_get_list (krb5_context context, const
krb5_config_section *c,...)
KRB5_LIB_FUNCTION const krb5_config_binding *KRB5_LIB_CALL
krb5_config_vget_list (krb5_context context, const
krb5_config_section *c, va_list args)
KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL krb5_config_get_string
(krb5_context context, const krb5_config_section *c,...)
KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL krb5_config_vget_string
(krb5_context context, const krb5_config_section *c, va_list args)
KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL
krb5_config_vget_string_default (krb5_context context, const
krb5_config_section *c, const char *def_value, va_list args)
KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL
krb5_config_get_string_default (krb5_context context, const
krb5_config_section *c, const char *def_value,...)
KRB5_LIB_FUNCTION char **KRB5_LIB_CALL krb5_config_vget_strings
(krb5_context context, const krb5_config_section *c, va_list args)
KRB5_LIB_FUNCTION char **KRB5_LIB_CALL krb5_config_get_strings
(krb5_context context, const krb5_config_section *c,...)
KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_config_free_strings (char
**strings)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
krb5_config_vget_bool_default (krb5_context context, const
krb5_config_section *c, krb5_boolean def_value, va_list args)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_vget_bool
(krb5_context context, const krb5_config_section *c, va_list args)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
krb5_config_get_bool_default (krb5_context context, const
krb5_config_section *c, krb5_boolean def_value,...)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_get_bool
(krb5_context context, const krb5_config_section *c,...)
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_vget_time_default
(krb5_context context, const krb5_config_section *c, int def_value,
va_list args)
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_vget_time (krb5_context
context, const krb5_config_section *c, va_list args)
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_time_default
(krb5_context context, const krb5_config_section *c, int
def_value,...)
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_time (krb5_context
context, const krb5_config_section *c,...)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_expand_hostname
(krb5_context context, const char *orig_hostname, char
**new_hostname)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_expand_hostname_realms (krb5_context context, const char
*orig_hostname, char **new_hostname, char ***realms)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_host_realm
(krb5_context context, krb5_realm *realmlist)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_kuserok (krb5_context
context, krb5_principal principal, const char *luser)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_plugin_register
(krb5_context context, enum krb5_plugin_type type, const char *name,
void *symbol)
π Detailed Description π
Not me checking this section and finding it's justβ¦ vibes. π« There's no extra prose here in the original β the whole story lives down in the Function Documentation, so let's go, bestie. π
π Function Documentation π
π krb5_acl_match_file
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_acl_match_file
(krb5_context context, const char *file, const char *format, ...)
So krb5_acl_match_file takes an ACL format and matches it against each line in a file, doing that via krb5_acl_match_string(). π And the cutest little detail: lines starting with # are treated like comments and ignored. Periodt.
Parameters:
contextβ Kerberos 5 context.fileβ file with acl listed in the file.formatβ format to match....β parameter to format string.
Returns:
Return an error code or 0.
See also:
krb5_acl_match_string
π¦ krb5_acl_match_string
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_acl_match_string
(krb5_context context, const char *string, const char *format, ...)
krb5_acl_match_string matches an ACL format against a string. β¨
The ACL format has three format specifiers: s, f, and r. Each specifier will retrieve one argument from the variable arguments, either for matching or for storing data. The input string is split up using ' ' (space) and '\t' (tab) as a delimiter; multiple ' ' and '\t' in a row are considered to be the same. π₯
List of format specifiers:
sβ Matches a string usingstrcmp(3)(case sensitive).fβ Matches the string withfnmatch(3). Theflags argument (the last argument) passed to thefnmatchfunction is0.rβ Returns a copy of the string in thechar **passed in; the copy must be freed withfree(3). There is no need tofree(3)the string on error: the function will clean up and set the pointer toNULL. π
Parameters:
contextβ Kerberos 5 contextstringβ string to match withformatβ format to match...β parameter to format string
Returns:
Return an error code or 0.
And here's the example, verbatim, because it ate:
char *s;
ret = krb5_acl_match_string(context, "foo", "s", "foo");
if (ret)
krb5_errx(context, 1, "acl didn't match");
ret = krb5_acl_match_string(context, "foo foo baz/kaka",
"ss", "foo", &s, "foo/\*");
if (ret) {
// no need to free(s) on error
assert(s == NULL);
krb5_errx(context, 1, "acl didn't match");
}
free(s);
See also:
krb5_acl_match_file
π krb5_aname_to_localname
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_aname_to_localname
(krb5_context context, krb5_const_principal aname, size_t lnsize, char *lname)
Map a principal name to a local username. π«
Returns 0 on success, KRB5_NO_LOCALNAME if no mapping was found, or some Kerberos or system error.
Inputs:
Parameters:
contextβ Akrb5_contextanameβ A principal namelnsizeβ The size of the buffer into which the username will be writtenlnameβ The buffer into which the username will be written
πΈ krb5_config_file_free
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_config_file_free
(krb5_context context, krb5_config_section *s)
Free a configuration file section β aka the result of krb5_config_parse_file() and krb5_config_parse_file_multi(). Cleanup queen behavior, honestly. π§Ή
Parameters:
contextβ A Kerberos 5 contextsβ the configuration section to free
Returns:
returns 0 on successes, otherwise an error code, see krb5_get_error_message()
π krb5_config_free_strings
KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_config_free_strings (char **strings)
Free the resulting strings from krb5_config-get_strings() and krb5_config_vget_strings(). You have to do this, bestie β no leaking on my watch. π
Parameters:
stringsβ strings to free
π krb5_config_get_bool
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_get_bool
(krb5_context context, const krb5_config_section *c, ...)
Like krb5_config_get_bool() but with a va_list list of configuration selection. (Yes, fr fr, that's what it says β iconic copy-paste energy, we keep it exactly.) π
Configuration value to a boolean value, where yes/true and any non-zero number means TRUE and other value is FALSE.
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from context...β a list of names, terminated withNULL.
Returns:
TRUE or FALSE
β¨ krb5_config_get_bool_default
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_get_bool_default
(krb5_context context, const krb5_config_section *c, krb5_boolean def_value, ...)
krb5_config_get_bool_default() will convert the configuration option value to a boolean value, where yes/true and any non-zero number means TRUE and other value is FALSE. π₯
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextdef_valueβ the default value to return if no configuration found in the database....β a list of names, terminated withNULL.
Returns:
TRUE or FALSE
π krb5_config_get_list
KRB5_LIB_FUNCTION const krb5_config_binding *KRB5_LIB_CALL
krb5_config_get_list (krb5_context context, const krb5_config_section *c, ...)
Get a list of configuration binding list for more processing. π
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from context...β a list of names, terminated withNULL.
Returns:
NULL if configuration list is not found, a list otherwise
π¦ krb5_config_get_string
KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL krb5_config_get_string
(krb5_context context, const krb5_config_section *c, ...)
Returns a 'const char *' to a string in the configuration database. β οΈ Heads up bestie: the string may not be valid after a reload of the configuration database, so a caller should make a local copy if it needs to keep the string. Don't be caught holding a stale pointer, that's not the vibe. π
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from context...β a list of names, terminated withNULL.
Returns:
NULL if configuration string not found, a string otherwise
πΈ krb5_config_get_string_default
KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL krb5_config_get_string_default
(krb5_context context, const krb5_config_section *c, const char *def_value, ...)
Like krb5_config_get_string(), but instead of returning NULL, instead return a default value. Glow-up behavior. β¨
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextdef_valueβ the default value to return if no configuration found in the database....β a list of names, terminated withNULL.
Returns:
a configuration string
π krb5_config_get_strings
KRB5_LIB_FUNCTION char **KRB5_LIB_CALL krb5_config_get_strings
(krb5_context context, const krb5_config_section *c, ...)
Get a list of configuration strings, free the result with krb5_config_free_strings(). π«Ά
okay so back to that function we were just on β its params are giving:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from context...β a list of names, terminated withNULL.
And it returns TRUE or FALSE. periodt. π
krb5_config_get_time β³β¨
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_time (krb5_context context, const krb5_config_section * c, ...)
This one gets the time from the configuration file using a relative time, for example: 1h30s. So like, you can say 1h30s and it just gets it. Lowkey iconic. π°οΈ
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from context...β a list of names, terminated withNULL.
Returns:
- parsed the time or
-1on error
krb5_config_get_time_default πΈ
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_time_default (krb5_context context, const krb5_config_section * c, int def_value, ...)
Get the time from the configuration file using a relative time, for example: 1h30s. (Same vibe as above but with a default, bestie.)
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextdef_valueβ the default value to return if no configuration found in the database....β a list of names, terminated withNULL.
Returns:
- parsed the time (or
def_valueon parse error)
krb5_config_parse_file_multi π
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_config_parse_file_multi (krb5_context context, const char * fname, krb5_config_section ** res)
Parse a configuration file and add the result into res. This interface can be used to parse several configuration files into one resulting krb5_config_section by calling it repeatably. So you can stack them like leggings under a skirt. π§
Parameters:
contextβ a Kerberos 5 context.fnameβ a file name to a Kerberos configuration fileresβ the returned result, must be free withkrb5_free_config_files().
Returns:
- Return an error code or
0, seekrb5_get_error_message().
If thefnamestarts with'~/'parse configuration file in the current users home directory. The behavior can be disabled and enabled by callingkrb5_set_home_dir_access().
krb5_config_vget_bool β
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_vget_bool (krb5_context context, const krb5_config_section * c, va_list args)
krb5_config_get_bool() will convert the configuration option value to a boolean value, where yes/true and any non-zero number means TRUE and other value is FALSE. So basically if it's not yes, true, or a non-zero number, it's a no. π«
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextargsβ ava_listof arguments
Returns:
TRUEorFALSE
krb5_config_vget_bool_default π
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_vget_bool_default (krb5_context context, const krb5_config_section * c, krb5_boolean def_value, va_list args)
Like krb5_config_get_bool_default() but with a va_list list of configuration selection.
Configuration value to a boolean value, where yes/true and any non-zero number means TRUE and other value is FALSE. Same rules as above, but you get a default if nothing's found.
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextdef_valueβ the default value to return if no configuration found in the database.argsβ ava_listof arguments
Returns:
TRUEorFALSE
krb5_config_vget_list π
KRB5_LIB_FUNCTION const krb5_config_binding* KRB5_LIB_CALL krb5_config_vget_list (krb5_context context, const krb5_config_section * c, va_list args)
Get a list of configuration binding list for more processing. It's giving "here's the list, go off." π
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextargsβ ava_listof arguments
Returns:
NULLif configuration list is not found, a list otherwise
krb5_config_vget_string π§΅
KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_config_vget_string (krb5_context context, const krb5_config_section * c, va_list args)
Like krb5_config_get_string(), but uses a va_list instead of .... So it's the same but with extra steps. π
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextargsβ ava_listof arguments
Returns:
NULLif configuration string not found, a string otherwise
krb5_config_vget_string_default π
KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_config_vget_string_default (krb5_context context, const krb5_config_section * c, const char * def_value, va_list args)
Like krb5_config_vget_string(), but instead of returning NULL, instead return a default value. So you never get NULL, you get your little default. πΌ
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextdef_valueβ the default value to return if no configuration found in the database.argsβ ava_listof arguments
Returns:
- a configuration string
krb5_config_vget_strings π
KRB5_LIB_FUNCTION char** KRB5_LIB_CALL krb5_config_vget_strings (krb5_context context, const krb5_config_section * c, va_list args)
Get a list of configuration strings, free the result with krb5_config_free_strings(). Don't forget to free, bestie, or it's a leak. π
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextargsβ ava_listof arguments
Returns:
TRUEorFALSE
krb5_config_vget_time β°
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_vget_time (krb5_context context, const krb5_config_section * c, va_list args)
Get the time from the configuration file using a relative time, for example: 1h30s. Same as the non-v version but with va_list. π
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextargsβ ava_listof arguments
Returns:
- parsed the time or
-1on error
krb5_config_vget_time_default π
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_vget_time_default (krb5_context context, const krb5_config_section * c, int def_value, va_list args)
Get the time from the configuration file using a relative time.
Like krb5_config_get_time_default() but with a va_list list of configuration selection.
Parameters:
contextβ A Kerberos 5 context.cβ a configuration section, orNULLto use the section from contextdef_valueβ the default value to return if no configuration found in the database.argsβ ava_listof arguments
Returns:
- parsed the time (or
def_valueon parse error)
krb5_expand_hostname π
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_expand_hostname (krb5_context context, const char * orig_hostname, char ** new_hostname)
krb5_expand_hostname() tries to make orig_hostname into a more canonical one in the newly allocated space returned in new_hostname. It's like glow-up for hostnames. β¨
Parameters:
contextβ a Keberos contextorig_hostnameβ hostname to canonicalise.new_hostnameβ output hostname, caller must free hostname withkrb5_xfree().
Returns:
- Return an error code or
0, seekrb5_get_error_message().
krb5_expand_hostname_realms π
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_expand_hostname_realms (krb5_context context, const char * orig_hostname, char ** new_hostname, char *** realms)
krb5_expand_hostname_realms() expands orig_hostname to a name we believe to be a hostname in newly allocated space in new_hostname and return the realms new_hostname is believed to belong to in realms. So it's the hostname glow-up plus the realms it belongs to. π«
Parameters:
contextβ a Keberos contextorig_hostnameβ hostname to canonicalise.new_hostnameβ output hostname, caller must free hostname withkrb5_xfree().realmsβ output possible realms, is an array that is terminated withNULL. Caller must free withkrb5_free_host_realm().
Returns:
- Return an error code or
0, seekrb5_get_error_message().
krb5_free_host_realm ποΈ
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_host_realm (krb5_context context, krb5_realm * realmlist)
Free all memory allocated by realmlist. It's the cleanup queen. π§Ή
Parameters:
contextβ A Kerberos 5 context.realmlistβ realmlist to free,NULLis ok
Returns:
- a Kerberos error code, always
0.
krb5_kuserok π
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_kuserok (krb5_context context, krb5_principal principal, const char * luser)
This function takes the name of a local user and checks if principal is allowed to log in as that user.
The user may have a ~/.k5login file listing principals that are allowed to login as that user. If that file does not exist, all principals with only one component that is identical to the username, and a realm considered local, are allowed access.
The .k5login file must contain one principal per line, be owned by user and not be writable by group or other (but must be readable by anyone).
Note that if the file exists, no implicit access rights are given to user@LOCALREALM.
Optionally, a set of files may be put in ~/.k5login.d (a directory), in which case they will all be checked in the same manner as .k5login. The files may be called anything, but files starting with a hash (#) , or ending with a tilde (~) are ignored. Subdirectories are not traversed. Note that this directory may not be checked by other Kerberos implementations.
If no configuration file exists, match user against local domains, ie luser@LOCAL-REALMS-IN-CONFIGURATION-FILES.
Parameters:
contextβ Kerberos 5 context.principalβ principal to check if allowed to loginluserβ local user id
Returns:
- returns
TRUEif access should be granted,FALSEotherwise.
krb5_plugin_register π§©
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_plugin_register (krb5_context context, enum krb5_plugin_type type, const char * name, void * symbol)
Register a plugin symbol name of specific type. Plug it in, plug it in. π
Parameters:
contextβ a Keberos contexttypeβ type of plugin symbolnameβ name of plugin symbolsymbolβ a pointer to the named symbol
Returns:
- In case of error a non zero error com_err error is returned and the Kerberos error string is set.
β¨ Author β¨
Generated automatically by Doxygen for Heimdal Kerberos 5 library from the source code. So it's a robot, not a person. Beep boop. π€
Anyways, that's the whole vibe. This page is from Heimdal Kerberos 5 library, version 7.8.0, dated Tue Nov 15 2022, and it's krb5_support(3). Stay slay, bestie. πβ¨
π¦ where this page comes from
- alpine 3.22: heimdal-doc 7.8.0-r4 Β· BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 Β· BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms