svn rev #21906: trunk/src/lib/kadm5/
epeisach@MIT.EDU
epeisach at MIT.EDU
Fri Feb 6 00:22:38 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=21906
Commit By: epeisach
Log Message:
ticket: 6374
subject: Do not assume sizeof(bool_t) == sizeof(krb5_boolean)
bool_t is defined as int, krb5_boolean as unsigned int. These are
similar size but someone someday might change the krb5_boolean.
Instead of passing a krb5_boolean * to xdr_bool, implement xdr_krb5_boolean
which keeps the different types separate.
This cleans up a number of warnings.
Changed Files:
U trunk/src/lib/kadm5/kadm_rpc_xdr.c
Modified: trunk/src/lib/kadm5/kadm_rpc_xdr.c
===================================================================
--- trunk/src/lib/kadm5/kadm_rpc_xdr.c 2009-02-06 02:46:14 UTC (rev 21905)
+++ trunk/src/lib/kadm5/kadm_rpc_xdr.c 2009-02-06 05:22:34 UTC (rev 21906)
@@ -220,6 +220,29 @@
+static bool_t xdr_krb5_boolean(XDR *xdrs, krb5_boolean *kbool)
+{
+ bool_t val;
+
+ switch (xdrs->x_op) {
+ case XDR_DECODE:
+ if (!xdr_bool(xdrs, &val))
+ return FALSE;
+
+ *kbool = (val == FALSE) ? FALSE : TRUE;
+ return TRUE;
+
+ case XDR_ENCODE:
+ val = *kbool ? TRUE : FALSE;
+ return xdr_bool(xdrs, &val);
+
+ case XDR_FREE:
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
bool_t xdr_krb5_key_data_nocontents(XDR *xdrs, krb5_key_data *objp)
{
/*
@@ -655,7 +678,7 @@
if (!xdr_krb5_principal(xdrs, &objp->princ)) {
return (FALSE);
}
- if (!xdr_bool(xdrs, &objp->keepold)) {
+ if (!xdr_krb5_boolean(xdrs, &objp->keepold)) {
return (FALSE);
}
if (!xdr_array(xdrs, (caddr_t *)&objp->ks_tuple,
@@ -715,7 +738,7 @@
if (!xdr_krb5_principal(xdrs, &objp->princ)) {
return (FALSE);
}
- if (!xdr_bool(xdrs, &objp->keepold)) {
+ if (!xdr_krb5_boolean(xdrs, &objp->keepold)) {
return (FALSE);
}
if (!xdr_array(xdrs, (caddr_t *) &objp->ks_tuple,
@@ -752,7 +775,7 @@
if (!xdr_krb5_principal(xdrs, &objp->princ)) {
return (FALSE);
}
- if (!xdr_bool(xdrs, &objp->keepold)) {
+ if (!xdr_krb5_boolean(xdrs, &objp->keepold)) {
return (FALSE);
}
if (!xdr_array(xdrs, (caddr_t *)&objp->ks_tuple,
More information about the cvs-krb5
mailing list