Skip to content

Instantly share code, notes, and snippets.

@mikhailnov
Created November 25, 2021 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikhailnov/8d40caedc71d12f6e9c081548fc42b74 to your computer and use it in GitHub Desktop.
Save mikhailnov/8d40caedc71d12f6e9c081548fc42b74 to your computer and use it in GitHub Desktop.
Check if libkrb5 understands a realm
// gcc -g realm.c -o realm -lkrb5
// HOST=XXX.LOC ./realm
#include <stdlib.h>
#include <stdio.h>
#include <krb5/krb5.h>
int main(){
// nfs-utils/utils/gssd/krb5_util.c, find_keytab_entry()
krb5_error_code test;
krb5_context context;
krb5_init_context(&context);
char **realmnames = NULL;
const char *host = getenv("HOST");
test = krb5_get_host_realm(context, host, &realmnames);
printf("%s\n", realmnames[0]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment