Rename X509FileType to X509Filetype

This commit is contained in:
Steven Fackler 2017-12-25 19:57:02 -07:00
parent 3eab162dc2
commit 77448362ce
3 changed files with 29 additions and 29 deletions

View File

@ -97,7 +97,7 @@ use dh::{Dh, DhRef};
use ec::EcKeyRef;
#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
use ec::EcKey;
use x509::{X509, X509FileType, X509Name, X509Ref, X509StoreContextRef, X509VerifyError};
use x509::{X509, X509Filetype, X509Name, X509Ref, X509StoreContextRef, X509VerifyError};
use x509::store::{X509StoreBuilderRef, X509StoreRef};
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
use x509::store::X509Store;
@ -744,7 +744,7 @@ impl SslContextBuilder {
pub fn set_certificate_file<P: AsRef<Path>>(
&mut self,
file: P,
file_type: X509FileType,
file_type: X509Filetype,
) -> Result<(), ErrorStack> {
let file = CString::new(file.as_ref().as_os_str().to_str().unwrap()).unwrap();
unsafe {
@ -813,7 +813,7 @@ impl SslContextBuilder {
pub fn set_private_key_file<P: AsRef<Path>>(
&mut self,
file: P,
file_type: X509FileType,
file_type: X509Filetype,
) -> Result<(), ErrorStack> {
let file = CString::new(file.as_ref().as_os_str().to_str().unwrap()).unwrap();
unsafe {

View File

@ -20,7 +20,7 @@ use ocsp::{OcspResponse, OcspResponseStatus};
use ssl;
use ssl::{Error, HandshakeError, ShutdownResult, Ssl, SslAcceptorBuilder, SslConnectorBuilder,
SslContext, SslMethod, SslStream, SslVerifyMode, StatusType};
use x509::{X509, X509FileType, X509Name, X509StoreContext};
use x509::{X509, X509Filetype, X509Name, X509StoreContext};
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
use x509::verify::X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS;
use pkey::PKey;
@ -349,9 +349,9 @@ fn test_write_hits_stream() {
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_verify(SslVerifyMode::PEER);
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
let stream = listener.accept().unwrap().0;
let mut stream = Ssl::new(&ctx.build()).unwrap().accept(stream).unwrap();
@ -620,10 +620,10 @@ fn test_npn_server_advertise_multiple() {
ctx.set_verify(SslVerifyMode::PEER);
ctx.set_npn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap();
assert!(
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.is_ok()
);
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
ctx.build()
};
@ -663,10 +663,10 @@ fn test_alpn_server_advertise_multiple() {
ctx.set_verify(SslVerifyMode::PEER);
ctx.set_alpn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap();
assert!(
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.is_ok()
);
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
ctx.build()
};
@ -706,10 +706,10 @@ fn test_alpn_server_select_none() {
ctx.set_verify(SslVerifyMode::PEER);
ctx.set_alpn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap();
assert!(
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.is_ok()
);
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
ctx.build()
};
@ -1162,9 +1162,9 @@ fn shutdown() {
thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
let ssl = Ssl::new(&ctx.build()).unwrap();
let mut stream = ssl.accept(stream).unwrap();
@ -1220,9 +1220,9 @@ fn tmp_dh_callback() {
thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_tmp_dh_callback(|_, _, _| {
CALLED_BACK.store(true, Ordering::SeqCst);
@ -1257,9 +1257,9 @@ fn tmp_ecdh_callback() {
thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_tmp_ecdh_callback(|_, _, _| {
CALLED_BACK.store(true, Ordering::SeqCst);
@ -1288,9 +1288,9 @@ fn tmp_dh_callback_ssl() {
thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
let mut ssl = Ssl::new(&ctx.build()).unwrap();
ssl.set_tmp_dh_callback(|_, _, _| {
@ -1325,9 +1325,9 @@ fn tmp_ecdh_callback_ssl() {
thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
let mut ssl = Ssl::new(&ctx.build()).unwrap();
ssl.set_tmp_ecdh_callback(|_, _, _| {
@ -1380,9 +1380,9 @@ fn status_callbacks() {
let guard = thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM)
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM)
ctx.set_private_key_file(&Path::new("test/key.pem"), X509Filetype::PEM)
.unwrap();
ctx.set_status_callback(|ssl| {
CALLED_BACK_SERVER.store(true, Ordering::SeqCst);

View File

@ -44,16 +44,16 @@ pub mod store;
#[cfg(test)]
mod tests;
pub struct X509FileType(c_int);
pub struct X509Filetype(c_int);
impl X509FileType {
impl X509Filetype {
pub fn as_raw(&self) -> c_int {
self.0
}
pub const PEM: X509FileType = X509FileType(ffi::X509_FILETYPE_PEM);
pub const ASN1: X509FileType = X509FileType(ffi::X509_FILETYPE_ASN1);
pub const DEFAULT: X509FileType = X509FileType(ffi::X509_FILETYPE_DEFAULT);
pub const PEM: X509Filetype = X509Filetype(ffi::X509_FILETYPE_PEM);
pub const ASN1: X509Filetype = X509Filetype(ffi::X509_FILETYPE_ASN1);
pub const DEFAULT: X509Filetype = X509Filetype(ffi::X509_FILETYPE_DEFAULT);
}
foreign_type_and_impl_send_sync! {