KRB5_CREDS(3)
β¨ KRB5_CREDS(3) β¨
okay bestie, welcome to KRB5_CREDS(3) β the Kerberos 5 credential handling functions, aka the page where we learn how to copy and yeet credentials π
no cap, it's giving "spreadsheet for your secret tickets" energy and honestly? iconic.
π NAME π
krb5_creds, krb5_copy_creds, krb5_copy_creds_contents, krb5_free_creds, krb5_free_cred_contents β Kerberos 5 credential handling functions π¦
π LIBRARY π
Kerberos 5 Library (libkrb5, -lkrb5) β yes you gotta link it, don't forget or the linker will simply not know you π
πΈ SYNOPSIS πΈ
#include <krb5.h>
krb5_error_code
krb5_copy_creds(krb5_context context, const krb5_creds *incred,
krb5_creds **outcred);
krb5_error_code
krb5_copy_creds_contents(krb5_context context, const krb5_creds *incred,
krb5_creds *outcred);
krb5_error_code
krb5_free_creds(krb5_context context, krb5_creds *outcred);
krb5_error_code
krb5_free_cred_contents(krb5_context context, krb5_creds *cred);
four little functions, one big vibe check on your memory management π«Ά
π DESCRIPTION π
so krb5_creds holds Kerberos credentials. that's the whole assignment. it's the lil container struct and it's lowkey carrying the entire plot:
typedef struct krb5_creds {
krb5_principal client;
krb5_principal server;
krb5_keyblock session;
krb5_times times;
krb5_data ticket;
krb5_data second_ticket;
krb5_authdata authdata;
krb5_addresses addresses;
krb5_ticket_flags flags;
} krb5_creds;
look at her. nine fields, zero notes. the way that she just sits there holding your client, your server, your session key, your times, your ticket, your second_ticket, your authdata, your addresses and your flagsβ¦ main character energy fr fr π
krb5_copy_creds() makes a copy of incred to outcred. and listen, bestie, outcred should be freed with krb5_free_creds() by the caller β that's you. you're the caller. the cleanup is your Roman empire now π§Ήβ¨
krb5_copy_creds_contents() makes a copy of the content of incred to outcreds. and yeah, outcreds should be freed by the called with krb5_free_creds_contents(). (that's what the page says, verbatim β "the called", iconic typo, we don't gatekeep, we preserve π«Ά the intent is: whoever called this, frees with krb5_free_creds_contents().)
β οΈ note the difference okay??krb5_copy_creds()copies into a freshly allocatedoutcredyou free withkrb5_free_creds(), whilekrb5_copy_creds_contents()copies into an existingoutcredsyou free withkrb5_free_creds_contents(). mixing them up is a memory leak speedrun and we are NOT doing that π
krb5_free_creds() frees the content of the cred structure and the structure itself. full send. everything goes. bye π
krb5_free_cred_contents() frees the content of the cred structure. just the contents, bestie β the structure itself stays. it's giving "empty the bag but keep the bag" π
π¦ SEE ALSO π¦
go read those too, iykyk π
π sign-off π
and that's the page!! brought to you by HEIMDAL, dated May 1, 2006 β yes she's vintage, yes she still slays, we stan a legacy queen ππ
now go free your creds, bestie. no leaks. periodt. β¨π«Ά
π¦ 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
- debian bookworm: heimdal-dev 7.8.git20221117.28daf24+dfsg-2 Β· BSD-3-Clause
- debian trixie: heimdal-dev 7.8.git20221117.28daf24+dfsg-9+deb13u1 Β· 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
- freebsd 14.5: base 14.5
- nixpkgs unstable: heimdal 7.8.0-unstable-2024-09-10
- ubuntu jammy: heimdal-dev 7.7.0+dfsg-3ubuntu1 Β· BSD-3-Clause
- ubuntu noble: heimdal-dev 7.8.git20221117.28daf24+dfsg-5ubuntu3 Β· BSD-3-Clause
- ubuntu questing: heimdal-dev 7.8.git20221117.28daf24+dfsg-9ubuntu1
- ubuntu resolute: heimdal-dev 7.8.git20221117.28daf24+dfsg-11ubuntu1 Β· BSD-3-Clause
- ubuntu stonking: heimdal-dev 7.8.git20240113.1b4565a+dfsg-2ubuntu1 Β· BSD-3-Clause
- Copyright (c) 2004, 2006 Kungliga Tekniska HΓΆgskolan
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms