From external application binary, get version of dynamically loaded Kerberos library

Benjamin Kaduk kaduk at MIT.EDU
Mon Nov 12 14:18:30 EST 2012


On Mon, 12 Nov 2012, Elzey, Blaine A (Blaine) wrote:

> How can I get the version of the Kerberos (krb5-1.10.3) shared libraries that are dynamically loaded by an external application.  I want to be able to print a debug message about the version of the library(ies) that are loaded.  Here are the libs I load dynamically (linked by "-l<lib_name> on link line):
>
> com_err
> gssapi_krb5
> k5crypto
> krb5
> krb5support
>
> I am hoping for something (constant defined in a header file used in the 
> library) like I am using for other libraries:  "OPENSSL_VERSION_TEXT" 
> for the OpenSSL version text and "LIBXML_DOTTED_VERSION" for the libxml2 
> version text.  Alternately might there be a get_version() function that 
> I can call from my application after loading the library?

Hi Blaine,

You have posted this question to both kfwdev and krbdev; are you 
interested in both windows and unix systems or just one?

The central source of the versioning information for the source tree is 
src/patchlevel.h, which is not installed.  Windows is a bit more 
complicated.

We have a symbol 'krb5_brand' in src/lib/krb5/krb/brand.c that attempts to 
retain this information, and a hack in krb5_init_context that tries to 
keep it from being optimized away, but whether this succeeds seems to be 
compiler-dependent.  I don't know of any other way to get the version 
information at runtime.

-Ben Kaduk


More information about the krbdev mailing list