diff options
| author | Denys Zariaiev <denys.zariaiev@gmail.com> | 2019-03-13 21:00:45 +0100 |
|---|---|---|
| committer | Denys Zariaiev <denys.zariaiev@gmail.com> | 2019-03-13 21:00:45 +0100 |
| commit | eeb5f171da2486c34e4e473c97a1468279d05e7c (patch) | |
| tree | b452442f799d5d62141419e7091de13c212de9ff /src/libstd/sys/windows/ext | |
| parent | 5c7ec6c421af26666d3ec1c5fe022d099133951c (diff) | |
| parent | 8bf1f1c8f4100247c1f9b3d9b7aecea5c970263e (diff) | |
| download | rust-eeb5f171da2486c34e4e473c97a1468279d05e7c.tar.gz rust-eeb5f171da2486c34e4e473c97a1468279d05e7c.zip | |
Merge remote-tracking branch 'upstream/master' into asm-compile-tests
Diffstat (limited to 'src/libstd/sys/windows/ext')
| -rw-r--r-- | src/libstd/sys/windows/ext/ffi.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/fs.rs | 34 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/io.rs | 14 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/process.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/raw.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/thread.rs | 6 |
6 files changed, 44 insertions, 30 deletions
diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs index 6508c0cf447..547b1ef796b 100644 --- a/src/libstd/sys/windows/ext/ffi.rs +++ b/src/libstd/sys/windows/ext/ffi.rs @@ -59,13 +59,13 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ffi::{OsString, OsStr}; -use sys::os_str::Buf; -use sys_common::wtf8::Wtf8Buf; -use sys_common::{FromInner, AsInner}; +use crate::ffi::{OsString, OsStr}; +use crate::sys::os_str::Buf; +use crate::sys_common::wtf8::Wtf8Buf; +use crate::sys_common::{FromInner, AsInner}; #[stable(feature = "rust1", since = "1.0.0")] -pub use sys_common::wtf8::EncodeWide; +pub use crate::sys_common::wtf8::EncodeWide; /// Windows-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 89038da6295..268a14ff0aa 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs::{self, OpenOptions, Metadata}; -use io; -use path::Path; -use sys; -use sys_common::{AsInnerMut, AsInner}; +use crate::fs::{self, OpenOptions, Metadata}; +use crate::io; +use crate::path::Path; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner}; /// Windows-specific extensions to [`File`]. /// @@ -220,13 +220,27 @@ pub trait OpenOptionsExt { /// the specified value (or combines it with `custom_flags` and `attributes` /// to set the `dwFlagsAndAttributes` for [`CreateFile`]). /// - /// By default, `security_qos_flags` is set to `SECURITY_ANONYMOUS`. For - /// information about possible values, see [Impersonation Levels] on the - /// Windows Dev Center site. + /// By default `security_qos_flags` is not set. It should be specified when + /// opening a named pipe, to control to which degree a server process can + /// act on behalf of a client process (security impersonation level). /// + /// When `security_qos_flags` is not set a malicious program can gain the + /// elevated privileges of a privileged Rust process when it allows opening + /// user-specified paths, by tricking it into opening a named pipe. So + /// arguably `security_qos_flags` should also be set when opening arbitrary + /// paths. However the bits can then conflict with other flags, specifically + /// `FILE_FLAG_OPEN_NO_RECALL`. + /// + /// For information about possible values, see [Impersonation Levels] on the + /// Windows Dev Center site. The `SECURITY_SQOS_PRESENT` flag is set + /// automatically when using this method. + /// # Examples /// /// ```no_run + /// # #[cfg(for_demonstration_only)] + /// extern crate winapi; + /// # mod winapi { pub const SECURITY_IDENTIFICATION: u32 = 0; } /// use std::fs::OpenOptions; /// use std::os::windows::prelude::*; /// @@ -235,9 +249,9 @@ pub trait OpenOptionsExt { /// .create(true) /// /// // Sets the flag value to `SecurityIdentification`. - /// .security_qos_flags(1) + /// .security_qos_flags(winapi::SECURITY_IDENTIFICATION) /// - /// .open("foo.txt"); + /// .open(r"\\.\pipe\MyPipe"); /// ``` /// /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx diff --git a/src/libstd/sys/windows/ext/io.rs b/src/libstd/sys/windows/ext/io.rs index fbe0426ce5a..1a7d734b89e 100644 --- a/src/libstd/sys/windows/ext/io.rs +++ b/src/libstd/sys/windows/ext/io.rs @@ -1,12 +1,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs; -use os::windows::raw; -use net; -use sys_common::{self, AsInner, FromInner, IntoInner}; -use sys; -use io; -use sys::c; +use crate::fs; +use crate::os::windows::raw; +use crate::net; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::sys; +use crate::sys::c; +use crate::io; /// Raw HANDLEs. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index 15f0fd4e11f..b2e6cdead4f 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -2,10 +2,10 @@ #![stable(feature = "process_extensions", since = "1.2.0")] -use os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}; -use process; -use sys; -use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}; +use crate::process; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; #[stable(feature = "process_extensions", since = "1.2.0")] impl FromRawHandle for process::Stdio { diff --git a/src/libstd/sys/windows/ext/raw.rs b/src/libstd/sys/windows/ext/raw.rs index 77428d9e774..d2bab272036 100644 --- a/src/libstd/sys/windows/ext/raw.rs +++ b/src/libstd/sys/windows/ext/raw.rs @@ -2,7 +2,7 @@ #![stable(feature = "raw_ext", since = "1.1.0")] -use os::raw::c_void; +use crate::os::raw::c_void; #[stable(feature = "raw_ext", since = "1.1.0")] pub type HANDLE = *mut c_void; #[cfg(target_pointer_width = "32")] diff --git a/src/libstd/sys/windows/ext/thread.rs b/src/libstd/sys/windows/ext/thread.rs index 29d612fedc0..fdc7e7fa32f 100644 --- a/src/libstd/sys/windows/ext/thread.rs +++ b/src/libstd/sys/windows/ext/thread.rs @@ -2,9 +2,9 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] -use os::windows::io::{RawHandle, AsRawHandle, IntoRawHandle}; -use thread; -use sys_common::{AsInner, IntoInner}; +use crate::os::windows::io::{RawHandle, AsRawHandle, IntoRawHandle}; +use crate::thread; +use crate::sys_common::{AsInner, IntoInner}; #[stable(feature = "thread_extensions", since = "1.9.0")] impl<T> AsRawHandle for thread::JoinHandle<T> { |
