krb5 commit: Load additional krb5 and come_err funcs

Benjamin Kaduk kaduk at MIT.EDU
Thu Aug 23 15:32:44 EDT 2012


https://github.com/krb5/krb5/commit/fd2d1932d262e6e342f795f9aaab2da62585fae2
commit fd2d1932d262e6e342f795f9aaab2da62585fae2
Author: Kevin Wasserman <kevin.wasserman at painless-security.com>
Date:   Tue Jul 17 14:25:39 2012 -0400

    Load additional krb5 and come_err funcs
    
    Required for multiple identity management and for migration of code from
    leashdll to leash proper.
    
    Signed-off-by: Kevin Wasserman <kevin.wasserman at painless-security.com>
    
    ticket: 7238 (new)
    queue: kfw
    target_version: 1.10.4
    tags: pullup

 src/windows/include/loadfuncs-krb5.h |   78 ++++++++++++++++++++++++++++++++++
 src/windows/leash/Leash.cpp          |   56 ++++++++++++++++++++++++
 src/windows/leash/Leash.h            |    1 +
 src/windows/leash/Lglobals.h         |   27 ++++++++++++
 src/windows/leashdll/leashdll.c      |   24 ++++++++++
 src/windows/leashdll/leashdll.h      |   12 +++++
 6 files changed, 198 insertions(+), 0 deletions(-)

diff --git a/src/windows/include/loadfuncs-krb5.h b/src/windows/include/loadfuncs-krb5.h
index a89cf16..a906788 100644
--- a/src/windows/include/loadfuncs-krb5.h
+++ b/src/windows/include/loadfuncs-krb5.h
@@ -1325,6 +1325,13 @@ TYPEDEF_FUNC(
 TYPEDEF_FUNC(
     krb5_error_code,
     KRB5_CALLCONV,
+    krb5_enctype_to_name,
+    (krb5_enctype, krb5_boolean, char *, size_t)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
     krb5_salttype_to_string,
     (krb5_int32, char *, size_t)
     );
@@ -1679,6 +1686,13 @@ TYPEDEF_FUNC(
     );
 
 TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_cc_get_full_name,
+    (krb5_context context, krb5_ccache cache, char **)
+    );
+
+TYPEDEF_FUNC(
     char *,
     KRB5_CALLCONV,
     krb5_kt_get_type,
@@ -1767,4 +1781,68 @@ TYPEDEF_FUNC(
     krb5_is_config_principal,
     (krb5_context, krb5_const_principal)
     );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_cccol_cursor_new,
+    (krb5_context, krb5_cccol_cursor *)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_cccol_cursor_next,
+    (krb5_context, krb5_cccol_cursor cursor, krb5_ccache *)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_cccol_cursor_free,
+    (krb5_context, krb5_cccol_cursor *cursor)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_cc_cache_match,
+    (krb5_context, krb5_principal, krb5_ccache *)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_cc_new_unique,
+    (krb5_context, const char *, const char *, krb5_ccache *)
+    );
+
+TYPEDEF_FUNC(
+    krb5_boolean,
+    KRB5_CALLCONV,
+    krb5_cc_support_switch,
+    (krb5_context, const char *)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_cc_switch,
+    (krb5_context, krb5_ccache)
+    );
+
+TYPEDEF_FUNC(
+    void,
+    KRB5_CALLCONV,
+    krb5_free_string,
+    (krb5_context, char *)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5int_cc_user_set_default_name,
+    (krb5_context context, const char *)
+    );
+
 #endif /* __LOADFUNCS_KRB5_H__ */
diff --git a/src/windows/leash/Leash.cpp b/src/windows/leash/Leash.cpp
index 0c68faf..a446997 100644
--- a/src/windows/leash/Leash.cpp
+++ b/src/windows/leash/Leash.cpp
@@ -55,6 +55,7 @@ HANDLE m_tgsReqMutex = 0;
 
 HWND CLeashApp::m_hProgram = 0;
 HINSTANCE CLeashApp::m_hLeashDLL = 0;
+HINSTANCE CLeashApp::m_hComErr = 0;
 ////@#+Remove
 #ifndef NO_KRB4
 HINSTANCE CLeashApp::m_hKrb4DLL = 0;
@@ -625,6 +626,12 @@ FUNC_INFO krb4_fi[] = {
 };
 #endif
 
+// com_err funcitons
+DECL_FUNC_PTR(error_message);
+FUNC_INFO ce_fi[] =  {
+    MAKE_FUNC_INFO(error_message),
+    END_FUNC_INFO
+};
 
 // psapi functions
 DECL_FUNC_PTR(GetModuleFileNameExA);
@@ -669,6 +676,27 @@ DECL_FUNC_PTR(krb5_free_cred_contents);
 DECL_FUNC_PTR(krb5_cc_resolve);
 DECL_FUNC_PTR(krb5_unparse_name);
 DECL_FUNC_PTR(krb5_free_unparsed_name);
+DECL_FUNC_PTR(krb5_cc_destroy);
+DECL_FUNC_PTR(krb5_cccol_cursor_new);
+DECL_FUNC_PTR(krb5_cccol_cursor_free);
+DECL_FUNC_PTR(krb5_cccol_cursor_next);
+DECL_FUNC_PTR(krb5_cc_start_seq_get);
+DECL_FUNC_PTR(krb5_cc_next_cred);
+DECL_FUNC_PTR(krb5_cc_end_seq_get);
+DECL_FUNC_PTR(krb5_cc_get_name);
+DECL_FUNC_PTR(krb5_cc_set_flags);
+DECL_FUNC_PTR(krb5_is_config_principal);
+DECL_FUNC_PTR(krb5_free_ticket);
+DECL_FUNC_PTR(krb5_decode_ticket);
+DECL_FUNC_PTR(krb5_cc_switch);
+DECL_FUNC_PTR(krb5_build_principal_ext);
+DECL_FUNC_PTR(krb5_get_renewed_creds);
+DECL_FUNC_PTR(krb5_cc_initialize);
+DECL_FUNC_PTR(krb5_cc_store_cred);
+DECL_FUNC_PTR(krb5_cc_get_full_name);
+DECL_FUNC_PTR(krb5_enctype_to_name);
+DECL_FUNC_PTR(krb5_cc_get_type);
+DECL_FUNC_PTR(krb5int_cc_user_set_default_name);
 
 FUNC_INFO krb5_fi[] = {
     MAKE_FUNC_INFO(krb5_cc_default_name),
@@ -691,6 +719,27 @@ FUNC_INFO krb5_fi[] = {
     MAKE_FUNC_INFO(krb5_cc_resolve),
     MAKE_FUNC_INFO(krb5_unparse_name),
     MAKE_FUNC_INFO(krb5_free_unparsed_name),
+    MAKE_FUNC_INFO(krb5_cc_destroy),
+    MAKE_FUNC_INFO(krb5_cccol_cursor_new),
+    MAKE_FUNC_INFO(krb5_cccol_cursor_next),
+    MAKE_FUNC_INFO(krb5_cccol_cursor_free),
+    MAKE_FUNC_INFO(krb5_cc_start_seq_get),
+    MAKE_FUNC_INFO(krb5_cc_next_cred),
+    MAKE_FUNC_INFO(krb5_cc_end_seq_get),
+    MAKE_FUNC_INFO(krb5_cc_get_name),
+    MAKE_FUNC_INFO(krb5_cc_set_flags),
+    MAKE_FUNC_INFO(krb5_is_config_principal),
+    MAKE_FUNC_INFO(krb5_free_ticket),
+    MAKE_FUNC_INFO(krb5_decode_ticket),
+    MAKE_FUNC_INFO(krb5_cc_switch),
+    MAKE_FUNC_INFO(krb5_build_principal_ext),
+    MAKE_FUNC_INFO(krb5_get_renewed_creds),
+    MAKE_FUNC_INFO(krb5_cc_initialize),
+    MAKE_FUNC_INFO(krb5_cc_store_cred),
+    MAKE_FUNC_INFO(krb5_cc_get_full_name),
+    MAKE_FUNC_INFO(krb5_enctype_to_name),
+    MAKE_FUNC_INFO(krb5_cc_get_type),
+    MAKE_FUNC_INFO(krb5int_cc_user_set_default_name),
     END_FUNC_INFO
 };
 
@@ -738,6 +787,7 @@ BOOL CLeashApp::InitDLLs()
 #endif
     m_hKrb5DLL = AfxLoadLibrary(KERB5DLL);
     m_hKrb5ProfileDLL = AfxLoadLibrary(KERB5_PPROFILE_DLL);
+    m_hComErr - AfxLoadLibrary(COMERR_DLL);
 
 #ifndef NO_AFS
     afscompat_init();
@@ -767,6 +817,12 @@ BOOL CLeashApp::InitDLLs()
         return FALSE;
     }
 
+    if (!LoadFuncs(COMERR_DLL, ce_fi, &m_hComErr, 0, 0, 1, 0)) {
+        MessageBox(hwnd,
+                   "Functions within " COMERR_DLL "didn't load properly!",
+                   "Error", MB_OK);
+        return FALSE;
+    }
 ////
 #ifndef NO_KRB4
     if (m_hKrb4DLL)
diff --git a/src/windows/leash/Leash.h b/src/windows/leash/Leash.h
index 557e40f..43c7da7 100644
--- a/src/windows/leash/Leash.h
+++ b/src/windows/leash/Leash.h
@@ -106,6 +106,7 @@ private:
 public:
 	static HWND			m_hProgram;
 	static HINSTANCE	m_hLeashDLL;
+	static HINSTANCE	m_hComErr;
 ////
 #ifndef NO_KRB4
 	static HINSTANCE	m_hKrb4DLL;
diff --git a/src/windows/leash/Lglobals.h b/src/windows/leash/Lglobals.h
index 2ec5f75..7ad47a2 100644
--- a/src/windows/leash/Lglobals.h
+++ b/src/windows/leash/Lglobals.h
@@ -17,6 +17,7 @@
 #define LEASHGLOBALS_H
 
 #include <tlhelp32.h>
+#include <loadfuncs-com_err.h>
 #include <loadfuncs-krb5.h>
 ////#include <loadfuncs-krb.h>
 #include <loadfuncs-profile.h>
@@ -167,6 +168,9 @@ extern DECL_FUNC_PTR(CreateToolhelp32Snapshot);
 extern DECL_FUNC_PTR(Module32First);
 extern DECL_FUNC_PTR(Module32Next);
 
+// com_err functions
+extern DECL_FUNC_PTR(error_message);
+
 // krb5 functions
 extern DECL_FUNC_PTR(krb5_cc_default_name);
 extern DECL_FUNC_PTR(krb5_cc_set_default_name);
@@ -185,6 +189,29 @@ extern DECL_FUNC_PTR(krb5_unparse_name);
 extern DECL_FUNC_PTR(krb5_free_unparsed_name);
 extern DECL_FUNC_PTR(krb5_free_principal);
 extern DECL_FUNC_PTR(krb5_cc_close);
+extern DECL_FUNC_PTR(krb5_cc_default);
+extern DECL_FUNC_PTR(krb5_cc_destroy);
+extern DECL_FUNC_PTR(krb5_cc_set_flags);
+extern DECL_FUNC_PTR(krb5_cc_get_name);
+extern DECL_FUNC_PTR(krb5_cc_start_seq_get);
+extern DECL_FUNC_PTR(krb5_cc_end_seq_get);
+extern DECL_FUNC_PTR(krb5_cc_next_cred);
+extern DECL_FUNC_PTR(krb5_cccol_cursor_new);
+extern DECL_FUNC_PTR(krb5_cccol_cursor_next);
+extern DECL_FUNC_PTR(krb5_cccol_cursor_free);
+extern DECL_FUNC_PTR(krb5_decode_ticket);
+extern DECL_FUNC_PTR(krb5_free_ticket);
+extern DECL_FUNC_PTR(krb5_init_context);
+extern DECL_FUNC_PTR(krb5_is_config_principal);
+extern DECL_FUNC_PTR(krb5_cc_switch);
+extern DECL_FUNC_PTR(krb5_build_principal_ext);
+extern DECL_FUNC_PTR(krb5_get_renewed_creds);
+extern DECL_FUNC_PTR(krb5_cc_initialize);
+extern DECL_FUNC_PTR(krb5_cc_store_cred);
+extern DECL_FUNC_PTR(krb5_cc_get_full_name);
+extern DECL_FUNC_PTR(krb5_enctype_to_name);
+extern DECL_FUNC_PTR(krb5_cc_get_type);
+extern DECL_FUNC_PTR(krb5int_cc_user_set_default_name);
 // extern DECL_FUNC_PTR(krb5_get_host_realm);
 
 // profile functions
diff --git a/src/windows/leashdll/leashdll.c b/src/windows/leashdll/leashdll.c
index 4c736c0..b6d6318 100644
--- a/src/windows/leashdll/leashdll.c
+++ b/src/windows/leashdll/leashdll.c
@@ -33,6 +33,7 @@ DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_out_ccache);
 DECL_FUNC_PTR(krb5_get_init_creds_password);
 DECL_FUNC_PTR(krb5_build_principal_ext);
+DECL_FUNC_PTR(krb5_cc_get_name);
 DECL_FUNC_PTR(krb5_cc_resolve);
 DECL_FUNC_PTR(krb5_cc_default);
 DECL_FUNC_PTR(krb5_cc_default_name);
@@ -86,6 +87,17 @@ DECL_FUNC_PTR(krb5_free_default_realm);
 DECL_FUNC_PTR(krb5_principal_compare);
 DECL_FUNC_PTR(krb5_string_to_deltat);
 DECL_FUNC_PTR(krb5_is_config_principal);
+DECL_FUNC_PTR(krb5_cccol_cursor_new);
+DECL_FUNC_PTR(krb5_cccol_cursor_free);
+DECL_FUNC_PTR(krb5_cccol_cursor_next);
+DECL_FUNC_PTR(krb5_cc_cache_match);
+DECL_FUNC_PTR(krb5_cc_get_type);
+DECL_FUNC_PTR(krb5_cc_new_unique);
+DECL_FUNC_PTR(krb5_cc_support_switch);
+DECL_FUNC_PTR(krb5_cc_switch);
+DECL_FUNC_PTR(krb5_cc_get_full_name);
+DECL_FUNC_PTR(krb5_free_string);
+DECL_FUNC_PTR(krb5int_cc_user_set_default_name);
 
 // ComErr functions
 DECL_FUNC_PTR(com_err);
@@ -133,6 +145,7 @@ FUNC_INFO k5_fi[] = {
     MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_out_ccache),
     MAKE_FUNC_INFO(krb5_get_init_creds_password),
     MAKE_FUNC_INFO(krb5_build_principal_ext),
+    MAKE_FUNC_INFO(krb5_cc_get_name),
     MAKE_FUNC_INFO(krb5_cc_resolve),
     MAKE_FUNC_INFO(krb5_cc_default),
     MAKE_FUNC_INFO(krb5_cc_default_name),
@@ -186,6 +199,17 @@ FUNC_INFO k5_fi[] = {
     MAKE_FUNC_INFO(krb5_principal_compare),
     MAKE_FUNC_INFO(krb5_string_to_deltat),
     MAKE_FUNC_INFO(krb5_is_config_principal),
+    MAKE_FUNC_INFO(krb5_cccol_cursor_new),
+    MAKE_FUNC_INFO(krb5_cccol_cursor_next),
+    MAKE_FUNC_INFO(krb5_cccol_cursor_free),
+    MAKE_FUNC_INFO(krb5_cc_cache_match),
+    MAKE_FUNC_INFO(krb5_cc_get_type),
+    MAKE_FUNC_INFO(krb5_cc_new_unique),
+    MAKE_FUNC_INFO(krb5_cc_support_switch),
+    MAKE_FUNC_INFO(krb5_cc_switch),
+    MAKE_FUNC_INFO(krb5_cc_get_full_name),
+    MAKE_FUNC_INFO(krb5_free_string),
+    MAKE_FUNC_INFO(krb5int_cc_user_set_default_name),
     END_FUNC_INFO
 };
 
diff --git a/src/windows/leashdll/leashdll.h b/src/windows/leashdll/leashdll.h
index 6f34b9d..a045583d 100644
--- a/src/windows/leashdll/leashdll.h
+++ b/src/windows/leashdll/leashdll.h
@@ -172,6 +172,7 @@ extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_out_ccache);
 extern DECL_FUNC_PTR(krb5_get_init_creds_password);
 extern DECL_FUNC_PTR(krb5_build_principal_ext);
+extern DECL_FUNC_PTR(krb5_cc_get_name);
 extern DECL_FUNC_PTR(krb5_cc_resolve);
 extern DECL_FUNC_PTR(krb5_cc_default);
 extern DECL_FUNC_PTR(krb5_cc_default_name);
@@ -189,9 +190,11 @@ extern DECL_FUNC_PTR(krb5_cc_end_seq_get);
 // extern DECL_FUNC_PTR(krb5_cc_remove_cred);
 extern DECL_FUNC_PTR(krb5_cc_set_flags);
 // extern DECL_FUNC_PTR(krb5_cc_get_type);
+extern DECL_FUNC_PTR(krb5_cc_get_full_name);
 extern DECL_FUNC_PTR(krb5_free_context);
 extern DECL_FUNC_PTR(krb5_free_cred_contents);
 extern DECL_FUNC_PTR(krb5_free_principal);
+extern DECL_FUNC_PTR(krb5_free_string);
 extern DECL_FUNC_PTR(krb5_get_in_tkt_with_password);
 extern DECL_FUNC_PTR(krb5_init_context);
 extern DECL_FUNC_PTR(krb5_parse_name);
@@ -225,6 +228,15 @@ extern DECL_FUNC_PTR(krb5_free_default_realm);
 extern DECL_FUNC_PTR(krb5_principal_compare);
 extern DECL_FUNC_PTR(krb5_string_to_deltat);
 extern DECL_FUNC_PTR(krb5_is_config_principal);
+extern DECL_FUNC_PTR(krb5_cccol_cursor_new);
+extern DECL_FUNC_PTR(krb5_cccol_cursor_next);
+extern DECL_FUNC_PTR(krb5_cccol_cursor_free);
+extern DECL_FUNC_PTR(krb5_cc_cache_match);
+extern DECL_FUNC_PTR(krb5_cc_get_type);
+extern DECL_FUNC_PTR(krb5_cc_new_unique);
+extern DECL_FUNC_PTR(krb5_cc_support_switch);
+extern DECL_FUNC_PTR(krb5_cc_switch);
+extern DECL_FUNC_PTR(krb5int_cc_user_set_default_name);
 
 #ifndef NO_KRB4
 // Krb524 functions


More information about the cvs-krb5 mailing list