From 2bed824a46de14144d8c3c963bb5d04aea299395 Mon Sep 17 00:00:00 2001 From: Philipp Eder Date: Mon, 11 Nov 2024 09:49:14 +0000 Subject: [PATCH] Removes obsolete kerberos dir --- kerberos/.gitignore | 3 -- kerberos/authenticate_test.c | 77 ------------------------------------ 2 files changed, 80 deletions(-) delete mode 100644 kerberos/.gitignore delete mode 100644 kerberos/authenticate_test.c diff --git a/kerberos/.gitignore b/kerberos/.gitignore deleted file mode 100644 index bb1351e23..000000000 --- a/kerberos/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -a.out -test.sh -krb5.conf diff --git a/kerberos/authenticate_test.c b/kerberos/authenticate_test.c deleted file mode 100644 index e35c008ad..000000000 --- a/kerberos/authenticate_test.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "../misc/openvas-krb5.h" - -#include -#include -#include - -#define GUARD_ENV_SET(var, env) \ - do \ - { \ - okrb5_set_slice_from_str (var, getenv (env)); \ - if (var.len == 0) \ - { \ - fprintf (stderr, env " is not set\n"); \ - return 1; \ - } \ - } \ - while (0) - -struct OKrb5GSSContext *cached_gss_context = NULL; -int -main () -{ - char *kdc = NULL; - OKrb5ErrorCode result = O_KRB5_SUCCESS; - OKrb5Credential credentials; - - memset (&credentials, 0, sizeof (OKrb5Credential)); - struct OKrb5Slice from_application = {.data = NULL, .len = 0}; - struct OKrb5Slice *to_application = NULL; - bool more = false; - GUARD_ENV_SET (credentials.config_path, "KRB5_CONFIG"); - GUARD_ENV_SET (credentials.realm, "KRB5_REALM"); - GUARD_ENV_SET (credentials.user.user, "KRB5_USER"); - GUARD_ENV_SET (credentials.user.password, "KRB5_PASSWORD"); - GUARD_ENV_SET (credentials.target.host_name, "KRB5_TARGET_HOST"); - GUARD_ENV_SET (credentials.kdc, "KRB5_KDC"); - credentials.target.service = okrb5_slice_from_str ("cifs"); - memset (&credentials.target.domain, 0, sizeof (struct OKrb5Slice)); - printf ("Using realm: %s\n", (char *) credentials.realm.data); - // TODO: move to overall function - // TODO: refactor signature to use slice - // if (o_krb5_find_kdc (&credentials, &kdc)) - // { - // if (o_krb5_add_realm (&credentials, credentials.kdc.data)) - // { - // fprintf (stderr, "Unable to add kdc\n"); - // return 1; - // } - // } - // else - // { - // printf ("Using kdc: %s\n", kdc); - // free (kdc); - // } - cached_gss_context = okrb5_gss_init_context (); - printf ("Using realm: %s\n", (char *) credentials.realm.data); - if ((result = o_krb5_gss_prepare_context (&credentials, cached_gss_context))) - { - fprintf (stderr, "Unable to prepare context: %d\n", result); - return 1; - } - printf ("Using realm: %s\n", (char *) credentials.realm.data); - // first call always empty - if ((result = o_krb5_gss_update_context ( - cached_gss_context, &from_application, &to_application, &more))) - { - fprintf (stderr, "Unable to update context: %d\n", result); - return 1; - } - printf ("success: %d: outdata_len: %zu\n", result, to_application->len); - - for (size_t i = 0; i < to_application->len; i++) - { - printf ("%02x", ((char *) to_application->data)[i]); - } - printf ("\n"); -}