-
Notifications
You must be signed in to change notification settings - Fork 333
update deps of libzauth #2327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update deps of libzauth #2327
Changes from 12 commits
ab688c2
bd82723
3dd32ba
1081ab9
0d7db5b
adc2f35
3596af7
e05ecb9
6ac6ec0
95d5aa5
2000b3c
ec8a438
2d4f9c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Upgrade version of libzauth dependencies, notably sodiumoxide bindings to libsodium, and fix resulting errors and warnings. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| extern crate libc; | ||
| extern crate zauth; | ||
|
|
||
| use libc::{size_t, uint8_t}; | ||
| use libc::size_t; | ||
| use std::char; | ||
| use std::fs::File; | ||
| use std::io::{self, BufReader, Read}; | ||
|
|
@@ -41,7 +41,6 @@ macro_rules! try_unwrap { | |
| } | ||
|
|
||
| #[repr(C)] | ||
| #[no_mangle] | ||
| #[derive(Clone, Copy, Debug)] | ||
| pub struct Range { | ||
| ptr: *const u8, | ||
|
|
@@ -53,7 +52,7 @@ pub struct ZauthKeystore(zauth::Keystore); | |
| pub struct ZauthToken(zauth::Token<'static>); | ||
|
|
||
| #[no_mangle] | ||
| pub extern fn zauth_keystore_open(f: *const uint8_t, n: size_t, s: *mut *mut ZauthKeystore) -> ZauthResult { | ||
| pub extern fn zauth_keystore_open(f: *const u8, n: size_t, s: *mut *mut ZauthKeystore) -> ZauthResult { | ||
| if f.is_null() { | ||
| return ZauthResult::NullArg; | ||
| } | ||
|
|
@@ -77,7 +76,7 @@ pub extern fn zauth_keystore_delete(s: *mut ZauthKeystore) { | |
| } | ||
|
|
||
| #[no_mangle] | ||
| pub extern fn zauth_acl_open(f: *const uint8_t, n: size_t, a: *mut *mut ZauthAcl) -> ZauthResult { | ||
| pub extern fn zauth_acl_open(f: *const u8, n: size_t, a: *mut *mut ZauthAcl) -> ZauthResult { | ||
| if f.is_null() { | ||
| return ZauthResult::NullArg; | ||
| } | ||
|
|
@@ -104,7 +103,7 @@ pub extern fn zauth_acl_delete(a: *mut ZauthAcl) { | |
| } | ||
|
|
||
| #[no_mangle] | ||
| pub extern fn zauth_token_parse(cs: *const uint8_t, n: size_t, zt: *mut *mut ZauthToken) -> ZauthResult { | ||
| pub extern fn zauth_token_parse(cs: *const u8, n: size_t, zt: *mut *mut ZauthToken) -> ZauthResult { | ||
| if cs.is_null() { | ||
| return ZauthResult::NullArg; | ||
| } | ||
|
|
@@ -129,7 +128,7 @@ pub extern fn zauth_token_verify(t: &ZauthToken, s: &ZauthKeystore) -> ZauthResu | |
|
|
||
| #[no_mangle] | ||
| pub extern | ||
| fn zauth_token_allowed(t: &ZauthToken, acl: &ZauthAcl, cp: *const uint8_t, n: size_t, out: *mut uint8_t) -> ZauthResult { | ||
| fn zauth_token_allowed(t: &ZauthToken, acl: &ZauthAcl, cp: *const u8, n: size_t, out: *mut u8) -> ZauthResult { | ||
| catch_unwind(|| { | ||
| let b = unsafe { slice::from_raw_parts(cp, n) }; | ||
| let s = try_unwrap!(str::from_utf8(b)); | ||
|
|
@@ -154,12 +153,12 @@ pub extern fn zauth_token_type(t: &ZauthToken) -> ZauthTokenType { | |
| //} | ||
|
|
||
| #[no_mangle] | ||
| pub extern fn zauth_token_version(t: &ZauthToken) -> uint8_t { | ||
| pub extern fn zauth_token_version(t: &ZauthToken) -> u8 { | ||
| t.0.version | ||
| } | ||
|
|
||
| #[no_mangle] | ||
| pub extern fn zauth_token_lookup(t: &ZauthToken, c: uint8_t) -> Range { | ||
| pub extern fn zauth_token_lookup(t: &ZauthToken, c: u8) -> Range { | ||
| if let Some(k) = char::from_u32(c as u32) { | ||
| if let Some(s) = t.0.lookup(k) { | ||
| return Range { ptr: s.as_ptr(), len: s.len() } | ||
|
|
@@ -177,7 +176,6 @@ pub extern fn zauth_token_delete(t: *mut ZauthToken) { | |
| } | ||
|
|
||
| #[repr(C)] | ||
| #[no_mangle] | ||
| #[derive(Clone, Copy, Debug)] | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @comawill this is the place I'm least sure about my change: the no_mangle at the enum level led to warnings; but I'm not sure if removing them is okay to do here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine. I don't think enum names or enum value names are part of the C ABI.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for your reviews! |
||
| pub enum ZauthTokenType { | ||
| User = 0, | ||
|
|
@@ -204,7 +202,6 @@ impl From<TokenType> for ZauthTokenType { | |
| } | ||
|
|
||
| #[repr(C)] | ||
| #[no_mangle] | ||
| #[derive(Clone, Copy, Debug)] | ||
| pub enum ZauthResult { | ||
| Ok = 0, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # this file is not required to track in git as it is a library here and lock files are only used for binaries | ||
| # we track the lock file in libzauth-c. | ||
| Cargo.lock |
Uh oh!
There was an error while loading. Please reload this page.