diff --git a/crates/krb5_rs/src/ccache.rs b/crates/krb5_rs/src/ccache.rs index 28bca83..9aaa37c 100644 --- a/crates/krb5_rs/src/ccache.rs +++ b/crates/krb5_rs/src/ccache.rs @@ -30,7 +30,7 @@ impl<'a> CCache<'a> { pub fn resolve(context: &'a Context, cc_name: &str) -> Result> { let mut ccache: MaybeUninit = MaybeUninit::uninit(); - let cc_name = CString::new(cc_name).unwrap(); + let cc_name = CString::new(cc_name).map_err(|_| Krb5Error::StringConversionError)?; let error_code = unsafe { krb5_cc_resolve(context.inner, cc_name.as_ptr(), ccache.as_mut_ptr()) }; diff --git a/crates/krb5_rs/src/credentials.rs b/crates/krb5_rs/src/credentials.rs index 8c5d8d8..f5d90d0 100644 --- a/crates/krb5_rs/src/credentials.rs +++ b/crates/krb5_rs/src/credentials.rs @@ -18,7 +18,7 @@ impl<'a> Credentials<'a> { password: &str, ) -> Result> { let mut credentials: MaybeUninit = MaybeUninit::uninit(); - let password = CString::new(password).map_err(|_err| Krb5Error::StringConversionError)?; + let password = CString::new(password).map_err(|_| Krb5Error::StringConversionError)?; let error_code = unsafe { krb5_get_init_creds_password( context.inner, diff --git a/crates/krb5_rs/src/gssapi.rs b/crates/krb5_rs/src/gssapi.rs index a330970..aa5cd9f 100644 --- a/crates/krb5_rs/src/gssapi.rs +++ b/crates/krb5_rs/src/gssapi.rs @@ -58,7 +58,7 @@ pub fn import_name(principal: &str, input_name_type: &str) -> Result Result<(), String> { let mut minor = 0; let ccache_name = - CString::new(ccache_name).map_err(|_err| "Failed to convert ccache name to a c string")?; + CString::new(ccache_name).map_err(|_| "Failed to convert ccache name to a c string")?; let error_code = unsafe { gss_krb5_ccache_name(&mut minor, ccache_name.as_ptr(), std::ptr::null_mut()) }; diff --git a/crates/krb5_rs/src/keytab.rs b/crates/krb5_rs/src/keytab.rs index 9dfe38f..041fd79 100644 --- a/crates/krb5_rs/src/keytab.rs +++ b/crates/krb5_rs/src/keytab.rs @@ -14,7 +14,7 @@ pub struct Keytab<'a> { impl<'a> Keytab<'a> { pub fn resolve(context: &'a Context, name: &str) -> Result> { let mut keytab: MaybeUninit = MaybeUninit::uninit(); - let name = CString::new(name).unwrap(); + let name = CString::new(name).map_err(|_| Krb5Error::StringConversionError)?; let error_code = unsafe { krb5_kt_resolve(context.inner, name.as_ptr(), keytab.as_mut_ptr()) }; Krb5Error::exit_if_library_error(context, error_code)?;