krb5_principal(3)
πΈ NAME πΈ
okay bestie, so you've opened krb5_principal(3) β that's the Heimdal Kerberos 5 library page for the Heimdal Kerberos 5 principal functions. it's giving "the entire principal system, laid out for you," and yes it's long, but we're doing this together. π
β¨ SYNOPSIS β¨
π«Ά Functions π«Ά
here's the whole lineup, exactly as written, no cap:
KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_principal (krb5_context context, krb5_principal p)
KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_principal_set_type (krb5_context context, krb5_principal principal, int type)
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_principal_get_type (krb5_context context, krb5_const_principal principal)
KRB5_LIB_FUNCTION const char *KRB5_LIB_CALL krb5_principal_get_realm (krb5_context context, krb5_const_principal principal)
KRB5_LIB_FUNCTION unsigned int KRB5_LIB_CALL krb5_principal_get_num_comp (krb5_context context, krb5_const_principal principal)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name_flags (krb5_context context, const char *name, int flags, krb5_principal *principal)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name (krb5_context context, const char *name, krb5_principal *principal)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed (krb5_context context, krb5_const_principal principal, char *name, size_t len)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_short (krb5_context context, krb5_const_principal principal, char *name, size_t len)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_flags (krb5_context context, krb5_const_principal principal, int flags, char *name, size_t len)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name (krb5_context context, krb5_const_principal principal, char **name)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_flags (krb5_context context, krb5_const_principal principal, int flags, char **name)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_short (krb5_context context, krb5_const_principal principal, char **name)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_principal_set_realm (krb5_context context, krb5_principal principal, krb5_const_realm realm)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_principal (krb5_context context, krb5_principal *principal, int rlen, krb5_const_realm realm,...)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_make_principal (krb5_context context, krb5_principal *principal, krb5_const_realm realm,...)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_principal (krb5_context context, krb5_const_principal inprinc, krb5_principal *outprinc)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_compare_any_realm (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_compare (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_realm_compare (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_match (krb5_context context, krb5_const_principal princ, krb5_const_principal pattern)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_nametype (krb5_context context, const char *str, int32_t *nametype)
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_null (krb5_context context, krb5_const_principal principal)
krb5_boolean KRB5_LIB_FUNCTION krb5_realm_is_lkdc (const char *realm)
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_lkdc (krb5_context context, krb5_const_principal principal)
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_pku2u (krb5_context context, krb5_const_principal principal)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_is_krbtgt (krb5_context context, krb5_const_principal p)
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_gss_hostbased_service (krb5_context context, krb5_const_principal principal)
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_root_krbtgt (krb5_context context, krb5_const_principal p)
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_is_anonymous (krb5_context context, krb5_const_principal p, unsigned int flags)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sname_to_principal (krb5_context context, const char *hostname, const char *sname, int32_t type, krb5_principal *ret_princ)
π¦ Detailed Description π¦
girl, that's it. that's the whole detailed description. iconic minimalism. π
π Function Documentation π
π§Έ krb5_build_principal π§Έ
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_principal
(krb5_context context, krb5_principal * principal, int rlen,
krb5_const_realm realm, ...)
Build a principal using vararg style building β yes bestie, it's a vararg moment, so bring your NULL terminator. π
Parameters:
contextβ A Kerberos context.principalβ returned principalrlenβ length of realmrealmβ realm name...β a list of components ended with NULL.
Returns: An krb5 error code, see krb5_get_error_message().
π krb5_copy_principal π
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_principal
(krb5_context context, krb5_const_principal inprinc, krb5_principal *
outprinc)
Copy a principal. dupe it, but make it a real copy, not just a "we're the same person" situation. π
Parameters:
contextβ A Kerberos context.inprincβ principal to copyoutprincβ copied principal, free withkrb5_free_principal()
Returns: An krb5 error code, see krb5_get_error_message().
π krb5_free_principal π
KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_principal (krb5_context
context, krb5_principal p)
Frees a Kerberos principal allocated by the library with krb5_parse_name(), krb5_make_principal() or any other related principal functions.
Parameters:
contextβ A Kerberos context.pβ a principal to free.
Returns: An krb5 error code, see krb5_get_error_message().
not me pointing out that this one is declaredvoidbut the page still lists a Returns line saying "An krb5 error code, seekrb5_get_error_message()." that's exactly what it says though, so we're keeping it fr fr. π«Ά
π krb5_make_principal π
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_make_principal
(krb5_context context, krb5_principal * principal, krb5_const_realm
realm, ...)
Build a principal using vararg style building β same energy as krb5_build_principal, but without the rlen guest star. β¨
Parameters:
contextβ A Kerberos context.principalβ returned principalrealmβ realm name...β a list of components ended with NULL.
Returns: An krb5 error code, see krb5_get_error_message().
π krb5_parse_name π
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name
(krb5_context context, const char * name, krb5_principal * principal)
Parse a name into a krb5_principal structure. you hand it a string, it hands you a principal, main character transformation arc. π
Parameters:
contextβ Kerberos 5 contextnameβ name to parse into a Kerberos principalprincipalβ returned principal, free withkrb5_free_principal().
Returns: An krb5 error code, see krb5_get_error_message().
π¦ krb5_parse_name_flags π¦
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name_flags
(krb5_context context, const char * name, int flags, krb5_principal *
principal)
Parse a name into a krb5_principal structure, flags controls the behavior. same as above but now you get to have opinions via flags. π₯
Parameters:
contextβ Kerberos 5 contextnameβ name to parse into a Kerberos principalflagsβ flags to control the behaviorprincipalβ returned principal, free withkrb5_free_principal().
Returns: An krb5 error code, see krb5_get_error_message().
β krb5_parse_nametype β
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_nametype
(krb5_context context, const char * str, int32_t * nametype)
Parse nametype string and return a nametype integer. glowed up from text to int32_t, we love a numeric era. β¨
π«Ά krb5_principal_compare π«Ά
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_compare
(krb5_context context, krb5_const_principal princ1, krb5_const_principal
princ2)
Compares the two principals, including realm of the principals and returns TRUE if they are the same and FALSE if not.
Parameters:
contextβ Kerberos 5 contextprinc1β first principal to compareprinc2β second principal to compare
See also:
krb5_principal_compare_any_realm()krb5_realm_compare()
π§ krb5_principal_compare_any_realm π§
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
krb5_principal_compare_any_realm (krb5_context context,
krb5_const_principal princ1, krb5_const_principal princ2)
Return TRUE iff princ1 == princ2 (without considering the realm). the realm is literally not invited to this comparison. π
Parameters:
contextβ Kerberos 5 contextprinc1β first principal to compareprinc2β second principal to compare
Returns: non zero if equal, 0 if not
See also:
krb5_principal_compare()krb5_realm_compare()
π krb5_principal_get_num_comp π
KRB5_LIB_FUNCTION unsigned int KRB5_LIB_CALL krb5_principal_get_num_comp
(krb5_context context, krb5_const_principal principal)
Get number of component is principal. (that's the original wording bestie, we're keeping it verbatim energy.) πΈ
Parameters:
contextβ Kerberos 5 contextprincipalβ principal to query
Returns: number of components in string
π krb5_principal_get_realm π
KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_principal_get_realm
(krb5_context context, krb5_const_principal principal)
Get the realm of the principal.
Parameters:
contextβ A Kerberos context.principalβ principal to get the realm for
Returns: realm of the principal, don't free or use after krb5_principal is freed
important!! do not free it, and do not touch it after the krb5_principal is freed. it's borrowed, bestie, hands off. π
π¦ krb5_principal_get_type π¦
KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_principal_get_type (krb5_context
context, krb5_const_principal principal)
Get the type of the principal.
Parameters:
contextβ A Kerberos context.principalβ principal to get the type for
Returns: the type of principal
π krb5_principal_is_anonymous π
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_is_anonymous
(krb5_context context, krb5_const_principal p, unsigned int flags)
Returns true iff name is WELLKNOWN/ANONYMOUS.
π krb5_principal_is_gss_hostbased_service π
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_gss_hostbased_service
(krb5_context context, krb5_const_principal principal)
Returns true iff name is an WELLKNOWN:ORG.H5L.HOSTBASED-SERVICE.
π§Έ krb5_principal_is_krbtgt π§Έ
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_is_krbtgt
(krb5_context context, krb5_const_principal p)
Check if the cname part of the principal is a krbtgt principal.
β¨ krb5_principal_is_lkdc β¨
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_lkdc (krb5_context context,
krb5_const_principal principal)
Returns true if name is Kerberos an LKDC realm.
π krb5_principal_is_null π
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_null (krb5_context context,
krb5_const_principal principal)
Returns true if name is Kerberos NULL name.
π¦ krb5_principal_is_pku2u π¦
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_pku2u (krb5_context
context, krb5_const_principal principal)
Returns true if name is Kerberos an LKDC realm.
heads up bestie β yes, this one says the exact same thing as krb5_principal_is_lkdc up there. that's the page's own wording, and we do not edit the source of truth. π€·ββοΈ
π krb5_principal_is_root_krbtgt π
krb5_boolean KRB5_LIB_FUNCTION krb5_principal_is_root_krbtgt (krb5_context
context, krb5_const_principal p)
Check if the cname part of the principal is a initial or renewed krbtgt principal.
π«Ά krb5_principal_match π«Ά
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_match
(krb5_context context, krb5_const_principal princ, krb5_const_principal
pattern)
return TRUE iff princ matches pattern.
and that's where part 1 wraps... but bestie, we are NOT done. more parts incoming, keep scrolling energy activated. π₯
β¨ krb5_principal_set_realm β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_principal_set_realm (krb5_context context, krb5_principal principal, krb5_const_realm realm)
Okay so this one sets a whole new realm for a principal, and as a side-effect it frees the previous realm. It's giving new realm, who dis? energy. π
πΈ Parameters πΈ
contextβ A Kerberos context.principalβ principal set the realm forrealmβ the new realm to set
π Returns π
An krb5 error code, see krb5_get_error_message(). π«Ά
β¨ krb5_principal_set_type β¨
KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_principal_set_type (krb5_context context, krb5_principal principal, int type)
Set the type of the principal. No cap, just assign the new type. π
πΈ Parameters πΈ
contextβ A Kerberos context.principalβ principal to set the type fortypeβ the new type
π Returns π
An krb5 error code, see krb5_get_error_message(). π
β¨ krb5_realm_compare β¨
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_realm_compare (krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)
This one returns TRUE iff realm(princ1) == realm(princ2). It's literally checking if the realms match. π¦
πΈ Parameters πΈ
contextβ Kerberos 5 contextprinc1β first principal to compareprinc2β second principal to compare
π¦ See also π¦
krb5_principal_compare_any_realm()krb5_principal_compare()
β¨ krb5_realm_is_lkdc β¨
krb5_boolean KRB5_LIB_FUNCTION krb5_realm_is_lkdc (const char * realm)
Returns true if name is Kerberos an LKDC realm. (Yes, it says "name" β we're just the messengers. π)
β¨ krb5_sname_to_principal β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sname_to_principal (krb5_context context, const char * hostname, const char * sname, int32_t type, krb5_principal * ret_princ)
Create a principal for the given service running on the given hostname. If KRB5_NT_SRV_HST is used, the hostname is canonicalized according the configured name canonicalization rules, with canonicalization delayed in some cases. One rule involves DNS, which is insecure unless DNSSEC is used, but we don't use DNSSEC-capable resolver APIs here, so that if DNSSEC is used we wouldn't know it. β οΈ
Canonicalization is immediate (not delayed) only when there is only one canonicalization rule and that rule indicates that we should do a host lookup by name (i.e., DNS). β¨
πΈ Parameters πΈ
contextβ A Kerberos context.hostnameβ hostname to usesnameβ Service name to usetypeβ name type of principal, useKRB5_NT_SRV_HSTorKRB5_NT_UNKNOWN.ret_princβ return principal, free withkrb5_free_principal().
π Returns π
An krb5 error code, see krb5_get_error_message(). π«Ά
β¨ krb5_unparse_name β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name (krb5_context context, krb5_const_principal principal, char ** name)
Unparse the Kerberos name into a string. It's the principal-to-string glow-up. π
πΈ Parameters πΈ
contextβ Kerberos 5 contextprincipalβ principal to querynameβ resulting string, free withkrb5_xfree()
π Returns π
An krb5 error code, see krb5_get_error_message(). π
β¨ krb5_unparse_name_fixed β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed (krb5_context context, krb5_const_principal principal, char * name, size_t len)
Unparse the principal name to a fixed buffer. No malloc drama, just a buffer you already own. π
πΈ Parameters πΈ
contextβ A Kerberos context.principalβ principal to unparsenameβ buffer to write name tolenβ length of buffer
π Returns π
An krb5 error code, see krb5_get_error_message(). π«Ά
β¨ krb5_unparse_name_fixed_flags β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_flags (krb5_context context, krb5_const_principal principal, int flags, char * name, size_t len)
Unparse the principal name with unparse flags to a fixed buffer. Same fixed-buffer vibe, but now with flags. π¦
πΈ Parameters πΈ
contextβ A Kerberos context.principalβ principal to unparseflagsβ unparse flagsnameβ buffer to write name tolenβ length of buffer
π Returns π
An krb5 error code, see krb5_get_error_message(). β¨
β¨ krb5_unparse_name_fixed_short β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_short (krb5_context context, krb5_const_principal principal, char * name, size_t len)
Unparse the principal name to a fixed buffer. The realm is skipped if its a default realm. (Grammar? Never heard of her. π )
πΈ Parameters πΈ
contextβ A Kerberos context.principalβ principal to unparsenameβ buffer to write name tolenβ length of buffer
π Returns π
An krb5 error code, see krb5_get_error_message(). π«Ά
β¨ krb5_unparse_name_flags β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_flags (krb5_context context, krb5_const_principal principal, int flags, char ** name)
Unparse the Kerberos name into a string. Now with flags to determine the behavior. π₯
πΈ Parameters πΈ
contextβ Kerberos 5 contextprincipalβ principal to queryflagsβ flag to determine the behaviornameβ resulting string, free withkrb5_xfree()
π Returns π
An krb5 error code, see krb5_get_error_message(). π
β¨ krb5_unparse_name_short β¨
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_short (krb5_context context, krb5_const_principal principal, char ** name)
Unparse the principal name to a allocated buffer. The realm is skipped if its a default realm. π
πΈ Parameters πΈ
contextβ A Kerberos context.principalβ principal to unparsenameβ returned buffer, free withkrb5_xfree()
π Returns π
An krb5 error code, see krb5_get_error_message(). π«Ά
π Author π
Generated automatically by Doxygen for Heimdal Kerberos 5 library from the source code. π€β¨
This whole page is from Heimdal Kerberos 5 library, version 7.8.0, dated Tue Nov 15 2022, and it's krb5_principal(3). That's the tea, 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