Ignore dapps_policy.json (#3919)
* Ignore dapps_policy.json * Produce warning for non-ignored files
This commit is contained in:
		
							parent
							
								
									269338d9bf
								
							
						
					
					
						commit
						9a5bb9470b
					
				
							
								
								
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -665,6 +665,7 @@ dependencies = [ | |||||||
|  "itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", |  "itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", |  "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", |  "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  |  "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", |  "parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", |  "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", |  "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"] | |||||||
| build = "build.rs" | build = "build.rs" | ||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
|  | log = "0.3" | ||||||
| libc = "0.2.11" | libc = "0.2.11" | ||||||
| rand = "0.3.14" | rand = "0.3.14" | ||||||
| ethkey = { path = "../ethkey" } | ethkey = { path = "../ethkey" } | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ use {json, SafeAccount, Error}; | |||||||
| use json::Uuid; | use json::Uuid; | ||||||
| use super::KeyDirectory; | use super::KeyDirectory; | ||||||
| 
 | 
 | ||||||
| const IGNORED_FILES: &'static [&'static str] = &["thumbs.db", "address_book.json"]; | const IGNORED_FILES: &'static [&'static str] = &["thumbs.db", "address_book.json", "dapps_policy.json"]; | ||||||
| 
 | 
 | ||||||
| #[cfg(not(windows))] | #[cfg(not(windows))] | ||||||
| fn restrict_permissions_to_owner(file_path: &Path) -> Result<(), i32>  { | fn restrict_permissions_to_owner(file_path: &Path) -> Result<(), i32>  { | ||||||
| @ -78,7 +78,7 @@ impl DiskDirectory { | |||||||
| 			.map(|entry| entry.path()) | 			.map(|entry| entry.path()) | ||||||
| 			.collect::<Vec<PathBuf>>(); | 			.collect::<Vec<PathBuf>>(); | ||||||
| 
 | 
 | ||||||
| 		paths | 		Ok(paths | ||||||
| 			.iter() | 			.iter() | ||||||
| 			.map(|p| ( | 			.map(|p| ( | ||||||
| 				fs::File::open(p) | 				fs::File::open(p) | ||||||
| @ -86,13 +86,17 @@ impl DiskDirectory { | |||||||
| 					.and_then(|r| json::KeyFile::load(r).map_err(|e| Error::Custom(format!("{:?}", e)))), | 					.and_then(|r| json::KeyFile::load(r).map_err(|e| Error::Custom(format!("{:?}", e)))), | ||||||
| 				p | 				p | ||||||
| 			)) | 			)) | ||||||
| 			.map(|(file, path)| match file { | 			.filter_map(|(file, path)| match file { | ||||||
| 				Ok(file) => Ok((path.clone(), SafeAccount::from_file( | 				Ok(file) => Some((path.clone(), SafeAccount::from_file( | ||||||
| 					file, Some(path.file_name().and_then(|n| n.to_str()).expect("Keys have valid UTF8 names only.").to_owned()) | 					file, Some(path.file_name().and_then(|n| n.to_str()).expect("Keys have valid UTF8 names only.").to_owned()) | ||||||
| 				))), | 				))), | ||||||
| 				Err(err) => Err(Error::InvalidKeyFile(format!("{:?}: {}", path, err))), | 				Err(err) => { | ||||||
|  | 					warn!("Invalid key file: {:?} ({})", path, err); | ||||||
|  | 					None | ||||||
|  | 				}, | ||||||
| 			}) | 			}) | ||||||
| 			.collect() | 			.collect() | ||||||
|  | 		) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -32,6 +32,9 @@ extern crate parking_lot; | |||||||
| extern crate ethkey as _ethkey; | extern crate ethkey as _ethkey; | ||||||
| extern crate ethcrypto as crypto; | extern crate ethcrypto as crypto; | ||||||
| 
 | 
 | ||||||
|  | #[macro_use] | ||||||
|  | extern crate log; | ||||||
|  | 
 | ||||||
| #[macro_use] | #[macro_use] | ||||||
| extern crate lazy_static; | extern crate lazy_static; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user