mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-09 04:04:13 +00:00
Cleanup rust-analyzer warnings
This commit is contained in:
parent
da179d9930
commit
b329fb68a9
@ -364,13 +364,14 @@ public:
|
||||
}
|
||||
|
||||
char* doTokenExchange(const char *code) {
|
||||
char *ret = nullptr;
|
||||
#if ZT_SSO_ENABLED
|
||||
if (_idc == nullptr) {
|
||||
fprintf(stderr, "ainfo or idc null\n");
|
||||
return "";
|
||||
}
|
||||
|
||||
char *ret = zeroidc::zeroidc_token_exchange(_idc, code);
|
||||
ret = zeroidc::zeroidc_token_exchange(_idc, code);
|
||||
zeroidc::zeroidc_set_nonce_and_csrf(
|
||||
_idc,
|
||||
_config.ssoState,
|
||||
@ -381,11 +382,8 @@ public:
|
||||
memcpy(_config.authenticationURL, url, strlen(url));
|
||||
_config.authenticationURL[strlen(url)] = 0;
|
||||
zeroidc::free_cstr(url);
|
||||
|
||||
return ret;
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t getExpiryTime() {
|
||||
@ -1899,8 +1897,7 @@ public:
|
||||
scode = _controller->handleControlPlaneHttpPOST(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType);
|
||||
else scode = 404;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
scode = 401; // isAuth == false
|
||||
}
|
||||
} else if (httpMethod == HTTP_DELETE) {
|
||||
|
@ -219,7 +219,7 @@ pub extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
|
||||
let idc = unsafe { &mut *ptr };
|
||||
|
||||
let s = CString::new(idc.auth_url()).unwrap();
|
||||
return s.into_raw();
|
||||
s.into_raw()
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
|
@ -337,10 +337,7 @@ impl ZeroIDC {
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
println!(
|
||||
"Central post failed: {}",
|
||||
e.to_string()
|
||||
);
|
||||
println!("Central post failed: {}", e);
|
||||
println!(
|
||||
"hit url: {}",
|
||||
e.url().unwrap().as_str()
|
||||
@ -403,7 +400,7 @@ impl ZeroIDC {
|
||||
|
||||
pub fn set_nonce_and_csrf(&mut self, csrf_token: String, nonce: String) {
|
||||
let local = Arc::clone(&self.inner);
|
||||
(*local.lock().expect("can't lock inner"))
|
||||
let _ = (*local.lock().expect("can't lock inner"))
|
||||
.as_opt()
|
||||
.map(|i| {
|
||||
if i.running {
|
||||
@ -411,27 +408,16 @@ impl ZeroIDC {
|
||||
return;
|
||||
}
|
||||
|
||||
let need_verifier = match i.pkce_verifier {
|
||||
None => true,
|
||||
_ => false,
|
||||
};
|
||||
let need_verifier = matches!(i.pkce_verifier, None);
|
||||
|
||||
let csrf_diff = if let Some(csrf) = i.csrf_token.clone() {
|
||||
if *csrf.secret() != csrf_token {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
*csrf.secret() != csrf_token
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
let nonce_diff = if let Some(n) = i.nonce.clone() {
|
||||
if *n.secret() != nonce {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
*n.secret() != nonce
|
||||
} else {
|
||||
false
|
||||
};
|
||||
@ -474,7 +460,7 @@ impl ZeroIDC {
|
||||
});
|
||||
|
||||
match url {
|
||||
Some(url) => url.to_string(),
|
||||
Some(url) => url,
|
||||
None => "".to_string(),
|
||||
}
|
||||
}
|
||||
@ -631,16 +617,14 @@ impl ZeroIDC {
|
||||
};
|
||||
|
||||
Ok(bytes)
|
||||
} else {
|
||||
if res.status() == 402 {
|
||||
} else if res.status() == 402 {
|
||||
Err(SSOExchangeError::new(
|
||||
"additional license seats required. Please contact your network administrator.".to_string(),
|
||||
))
|
||||
} else {
|
||||
Err(SSOExchangeError::new(
|
||||
"error from central endpoint".to_string(),
|
||||
))
|
||||
}
|
||||
} else {
|
||||
Err(SSOExchangeError::new(
|
||||
"error from central endpoint".to_string(),
|
||||
))
|
||||
}
|
||||
}
|
||||
Err(res) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user