refactor(oauth): safe oauth2 and remove custom json parser (#80)

* refactor(oauth): safe oauth2 and remove custom json parser

Closes #46,#53
This commit is contained in:
Friedel Ziegelmayer
2019-05-26 22:49:52 +02:00
committed by GitHub
parent 94aa314f30
commit a247e5b143
14 changed files with 491 additions and 1095 deletions

View File

@@ -123,9 +123,14 @@ pub unsafe extern "C" fn dc_get_oauth2_url(
redirect: *mut libc::c_char,
) -> *mut libc::c_char {
assert!(!context.is_null());
let context = &*context;
dc_oauth2::dc_get_oauth2_url(context, addr, redirect)
let context = &*context;
let addr = dc_tools::to_string(addr);
let redirect = dc_tools::to_string(redirect);
match oauth2::dc_get_oauth2_url(context, addr, redirect) {
Some(res) => libc::strdup(dc_tools::to_cstring(res).as_ptr()),
None => std::ptr::null_mut(),
}
}
#[no_mangle]