Skip to content

kadmin: build failure against krb5 v1.22 #213

@B4dM4n

Description

@B4dM4n

Building against krb5 v1.22 currently fails with the following error:

error[E0412]: cannot find type `krb5_boolean` in this scope
   --> kadmin/src/kadmin.rs:501:32
    |
501 |                     keepold as krb5_boolean,
    |                                ^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `krb5_boolean` in this scope
   --> kadmin/src/kadmin.rs:537:28
    |
537 |                 keepold as krb5_boolean,
    |                            ^^^^^^^^^^^^ not found in this scope

This happens, because krb5_boolean was removed from all public kadmin function signatures in v1.22, so it is no longer imported by bindgen automatically.

This can be either fixed by importing it via allowlist_type in build.rs:

diff --git a/kadmin-sys/build.rs b/kadmin-sys/build.rs
index 20a9a7e..ce2b064 100644
--- a/kadmin-sys/build.rs
+++ b/kadmin-sys/build.rs
@@ -53,4 +53,5 @@ fn main() {
         .allowlist_function("krb5_enctype_to_string")
         .allowlist_function("krb5_salttype_to_string")
+        .allowlist_type("krb5_boolean")
         .clang_arg("-fparse-all-comments")
         .derive_default(true)

or by using the underlying ffi type directly (which has not changed between v1.21 and v1.22):

diff --git a/kadmin/src/kadmin.rs b/kadmin/src/kadmin.rs
index 757186d..f8c7bb8 100644
--- a/kadmin/src/kadmin.rs
+++ b/kadmin/src/kadmin.rs
@@ -3,5 +3,5 @@
 use std::{
     collections::HashMap,
-    ffi::{CString, c_int},
+    ffi::{CString, c_int, c_uint},
     os::raw::{c_char, c_long, c_void},
     ptr::{null, null_mut},
@@ -499,5 +499,5 @@ impl KAdminImpl for KAdmin {
                     self.server_handle,
                     princ.raw,
-                    keepold as krb5_boolean,
+                    keepold as c_uint,
                     n_ks_tuple,
                     ks_tuple,
@@ -535,5 +535,5 @@ impl KAdminImpl for KAdmin {
                 self.server_handle,
                 princ.raw,
-                keepold as krb5_boolean,
+                keepold as c_uint,
                 n_ks_tuple,
                 ks_tuple,

Both fixes would be backward compatible with krb5 v1.21.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions