clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
		@ -6,7 +6,6 @@ use std::process::{Command, Stdio};
 | 
				
			|||||||
use std::io::Write;
 | 
					use std::io::Write;
 | 
				
			||||||
use std::ffi::{CString, CStr};
 | 
					use std::ffi::{CString, CStr};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use base64;
 | 
					 | 
				
			||||||
use anyhow::{bail, format_err, Error};
 | 
					use anyhow::{bail, format_err, Error};
 | 
				
			||||||
use serde_json::json;
 | 
					use serde_json::json;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -25,8 +24,7 @@ impl ProxmoxAuthenticator for PAM {
 | 
				
			|||||||
        let mut auth = pam::Authenticator::with_password("proxmox-backup-auth").unwrap();
 | 
					        let mut auth = pam::Authenticator::with_password("proxmox-backup-auth").unwrap();
 | 
				
			||||||
        auth.get_handler().set_credentials(username.as_str(), password);
 | 
					        auth.get_handler().set_credentials(username.as_str(), password);
 | 
				
			||||||
        auth.authenticate()?;
 | 
					        auth.authenticate()?;
 | 
				
			||||||
        return Ok(());
 | 
					        Ok(())
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn store_password(&self, username: &UsernameRef, password: &str) -> Result<(), Error> {
 | 
					    fn store_password(&self, username: &UsernameRef, password: &str) -> Result<(), Error> {
 | 
				
			||||||
@ -99,7 +97,7 @@ pub fn encrypt_pw(password: &str) -> Result<String, Error> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
pub fn verify_crypt_pw(password: &str, enc_password: &str) -> Result<(), Error> {
 | 
					pub fn verify_crypt_pw(password: &str, enc_password: &str) -> Result<(), Error> {
 | 
				
			||||||
    let verify = crypt(password.as_bytes(), enc_password)?;
 | 
					    let verify = crypt(password.as_bytes(), enc_password)?;
 | 
				
			||||||
    if &verify != enc_password {
 | 
					    if verify != enc_password {
 | 
				
			||||||
        bail!("invalid credentials");
 | 
					        bail!("invalid credentials");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    Ok(())
 | 
					    Ok(())
 | 
				
			||||||
 | 
				
			|||||||
@ -251,8 +251,8 @@ async fn pull_snapshot(
 | 
				
			|||||||
        Err(err) => {
 | 
					        Err(err) => {
 | 
				
			||||||
            match err.downcast_ref::<HttpError>() {
 | 
					            match err.downcast_ref::<HttpError>() {
 | 
				
			||||||
                Some(HttpError { code, message }) => {
 | 
					                Some(HttpError { code, message }) => {
 | 
				
			||||||
                    match code {
 | 
					                    match *code {
 | 
				
			||||||
                        &StatusCode::NOT_FOUND => {
 | 
					                        StatusCode::NOT_FOUND => {
 | 
				
			||||||
                            worker.log(format!("skipping snapshot {} - vanished since start of sync", snapshot));
 | 
					                            worker.log(format!("skipping snapshot {} - vanished since start of sync", snapshot));
 | 
				
			||||||
                            return Ok(());
 | 
					                            return Ok(());
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
@ -434,7 +434,7 @@ pub async fn pull_group(
 | 
				
			|||||||
        let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time)?;
 | 
					        let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // in-progress backups can't be synced
 | 
					        // in-progress backups can't be synced
 | 
				
			||||||
        if let None = item.size {
 | 
					        if item.size.is_none() {
 | 
				
			||||||
            worker.log(format!("skipping snapshot {} - in-progress backup", snapshot));
 | 
					            worker.log(format!("skipping snapshot {} - in-progress backup", snapshot));
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -520,9 +520,8 @@ pub async fn pull_store(
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let group_count = list.len();
 | 
					    let group_count = list.len();
 | 
				
			||||||
    let mut groups_done = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for item in list {
 | 
					    for (groups_done, item) in list.into_iter().enumerate() {
 | 
				
			||||||
        let group = BackupGroup::new(&item.backup_type, &item.backup_id);
 | 
					        let group = BackupGroup::new(&item.backup_type, &item.backup_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let (owner, _lock_guard) = tgt_store.create_locked_backup_group(&group, &userid)?;
 | 
					        let (owner, _lock_guard) = tgt_store.create_locked_backup_group(&group, &userid)?;
 | 
				
			||||||
@ -547,7 +546,6 @@ pub async fn pull_store(
 | 
				
			|||||||
                errors = true; // do not stop here, instead continue
 | 
					                errors = true; // do not stop here, instead continue
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        groups_done += 1;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if delete {
 | 
					    if delete {
 | 
				
			||||||
 | 
				
			|||||||
@ -272,7 +272,7 @@ impl RRD {
 | 
				
			|||||||
            t += reso; index = (index + 1) % RRD_DATA_ENTRIES;
 | 
					            t += reso; index = (index + 1) % RRD_DATA_ENTRIES;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        (start, reso, list.into())
 | 
					        (start, reso, list)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn from_raw(mut raw: &[u8]) -> Result<Self, std::io::Error> {
 | 
					    pub fn from_raw(mut raw: &[u8]) -> Result<Self, std::io::Error> {
 | 
				
			||||||
@ -289,7 +289,7 @@ impl RRD {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if rrd.magic != PROXMOX_RRD_MAGIC_1_0 {
 | 
					        if rrd.magic != PROXMOX_RRD_MAGIC_1_0 {
 | 
				
			||||||
            let msg = format!("wrong magic number");
 | 
					            let msg = "wrong magic number".to_string();
 | 
				
			||||||
            return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
 | 
					            return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user