Skip Menu |
 

Subject: ret_boolean in profile_get_boolean() should be krb5_boolean * instead of int *
Otherwise I see compile errors like:
"../../../../mit-krb5/src/lib/krb5/os/locate_kdc.c", line 82: argument
#6 is incompatible with prototype:
prototype: pointer to int : "../../../include/profile.h", line 89
argument : pointer to unsigned int (E_ARG_INCOMPATIBLE_WITH_ARG_L)
cc: acomp failed for ../../../../mit-krb5/src/lib/krb5/os/locate_kdc.c

which involve:

use_dns_uri(krb5_context ctx)
{
krb5_error_code ret;
krb5_boolean use;

ret = profile_get_boolean(ctx->profile, KRB5_CONF_LIBDEFAULTS,
KRB5_CONF_DNS_URI_LOOKUP, NULL,
DEFAULT_URI_LOOKUP, &use); <<< use is
krb5_boolean which is unsigned int.

but:

use_dns_uri(krb5_context ctx)
{
krb5_error_code ret;
krb5_boolean use;

ret = profile_get_boolean(ctx->profile, KRB5_CONF_LIBDEFAULTS,
KRB5_CONF_DNS_URI_LOOKUP, NULL,
DEFAULT_URI_LOOKUP, &use);

This is preventing use of stricter compile flags.
I would say the calling code is at fault here. At least notionally, the
profile library is a dependency of libkrb5 and not the other way around, so
profile functions should not use krb5 types.
Date: Thu, 29 Sep 2016 12:27:09 -0500
From: Will Fiveash <will.fiveash@oracle.com>
To: rt@krbdev.mit.edu
Subject: Re: [krbdev.mit.edu #8502] ret_boolean in profile_get_boolean() should be krb5_boolean * instead of int *
RT-Send-Cc:
It would be good if the various interfaces could agree on a common type
definition for a boolean, yes? Either krb5_boolean should be int or
functions that take a boolean arg should specify them as unsigned int.

--
Will Fiveash
Oracle Solaris Software Engineer
krb5_boolean is a public type. profile_get_boolean() is a public API.
While it might be nice if they agreed, changing public APIs and types can
break existing code.
Date: Thu, 29 Sep 2016 13:08:32 -0500
From: Will Fiveash <will.fiveash@oracle.com>
To: rt@krbdev.mit.edu
Subject: Re: [krbdev.mit.edu #8502] ret_boolean in profile_get_boolean() should be krb5_boolean * instead of int *
RT-Send-Cc:
I see. Sounds like krb5 code calling profile_get_boolean() needs to
cast the boolean arg to (int *) in several places.

--
Will Fiveash
Oracle Solaris Software Engineer
Date: Thu, 29 Sep 2016 13:59:05 -0500
From: Will Fiveash <will.fiveash@oracle.com>
To: rt@krbdev.mit.edu
Subject: Re: [krbdev.mit.edu #8502] ret_boolean in profile_get_boolean() should be krb5_boolean * instead of int *
RT-Send-Cc:
Actually, there is only one call to profile_get_boolean() in
use_dns_uri() that needs a cast:

ret = profile_get_boolean(ctx->profile, KRB5_CONF_LIBDEFAULTS,
KRB5_CONF_DNS_URI_LOOKUP, NULL,
DEFAULT_URI_LOOKUP, (int *)&use);
^^^^^^^

and everything else compiles without error.
--
Will Fiveash
Oracle Solaris Software Engineer
It would be better to change the type of "use" to int in that function. I
will submit a PR to do that. (We actually see a warning in our regular
builds of locate_kdc.c, but didn't catch it when integrating PR #481
recently.)
From: ghudson@mit.edu
Subject: git commit

Fix use_dns_uri() type safety

profile_get_boolean() outputs an int, not a krb5_boolean. Adjust the
local variable "use" to match, or we get a warning. Reported by Will
Fiveash.

https://github.com/krb5/krb5/commit/f648205247da436893dae97dd7949053da927af4
Author: Greg Hudson <ghudson@mit.edu>
Commit: f648205247da436893dae97dd7949053da927af4
Branch: master
src/lib/krb5/os/locate_kdc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)