odd error_message() behavior

Will Fiveash will.fiveash at oracle.com
Fri Apr 19 17:58:56 EDT 2013


When I compile and run:

#include <stdlib.h>
#include <stdio.h>
#include <krb5.h>
#include <com_err.h>

int
main (int argc, char *argv[])
{
    long error;

    if (argc != 2) {
        fprintf(stderr, "Usage: %s <krb error code>\n", argv[0]);
        fprintf(stderr, "Note, hex args are OK but must be prefixed with '0x'\n");
        exit(1);
    }

    error = (long) strtoul(argv[1], NULL, 0);
    printf("libkrb5 error_message(): \"%s\"\n", error_message(error));
}

so it uses MIT libkrb5 like so:

$ cc -o krb_error_message -I/usr/local/include -L/usr/local/lib -lcom_err -lkrb5 krb_error_message.c

Note in lib/krb5/error_tables/krb5_err.h:
#define KRB5KDC_ERR_NULL_KEY                     (-1765328375L)

$ LD_LIBRARY_PATH=/usr/local/lib ./krb_error_message -1765328375                                    
libkrb5 error_message(): "Unknown code krb5 9"

but when I run it using the Solaris libkrb5 I see:

$ ./krb_error_message_solaris -1765328375                                              
libkrb5 error_message(): "Client or server has a null key"

which is what I expect.  Thoughts?

-- 
Will Fiveash
Oracle Solaris Software Engineer


More information about the krbdev mailing list