pub fn add_keys(
        &mut self,
        name: &str,
        keys: Vec<AuthorizedKeyEntry>,
        replace: bool,
        force: bool,
    ) -> Result<Vec<AuthorizedKeyEntry>> {
        // if we are passed an empty vector of keys, don't create a file
        if keys.is_empty() {
            return Ok(vec![]);
        }

        if let Some(keyset) = self.keys.get(name) {
            if keyset.disabled && !force {
                return Err(ErrorKind::KeysDisabled(name.to_string()).into());
            } else if !replace {
                return Err(ErrorKind::KeysExist(name.to_string()).into());
            }
        }
        self.keys.insert(
            name.to_string(),
            AuthorizedKeySet {
                filename: name.to_string(),
                disabled: false,
                keys: keys.clone(),
            },
        );
        Ok(keys)
    }
/// add_keys adds a list of public keys with the provide name. if replace is
/// true, it will replace existing keys. if force is true, it will replace
/// disabled keys.
///
/// if the keys vector is empty, the function doesn't create an entry. empty
/// entries are reserved for representing disabled keysets.
///
/// add_keys returns an error if the key already exists and replace is
/// false, or if the key is disabled and force is false
add_keys adds a list of public keys with the provide name. if replace is
true, it will replace existing keys. if force is true, it will replace
disabled keys.

if the keys vector is empty, the function doesn't create an entry. empty
entries are reserved for representing disabled keysets.

add_keys returns an error if the key already exists and replace is
false, or if the key is disabled and force is false
add_keys adds a list of public keys with the provide name . if replace is true it will replace existing keys . if force is true it will replace disabled keys . if the keys vector is empty the function doesn ' t create an entry . empty entries are reserved for representing disabled keysets . add_keys returns an error if the key already exists and replace is false or if the key is disabled and force is false
pub fn add_keys(
        &mut self,
        name: &str,
        keys: Vec<AuthorizedKeyEntry>,
        replace: bool,
        force: bool,
    ) -> Result<Vec<AuthorizedKeyEntry>> {
        // if we are passed an empty vector of keys, don't create a file
        if keys.is_empty() {
            return Ok(vec![]);
        }
        if let Some(keyset) = self.keys.get(name) {
            if keyset.disabled && !force {
                return Err(ErrorKind::KeysDisabled(name.to_string()).into());
            } else if !replace {
                return Err(ErrorKind::KeysExist(name.to_string()).into());
            }
        }
        self.keys.insert(
            name.to_string(),
            AuthorizedKeySet {
                filename: name.to_string(),
                disabled: false,
                keys: keys.clone(),
            },
        );
        Ok(keys)
    }
pub fn add_keys ( & mut self , name : & str , keys : Vec < AuthorizedKeyEntry > , replace : bool , force : bool , ) -> Result < Vec < AuthorizedKeyEntry > > { // if we are passed an empty vector of keys, don't create a file if keys . is_empty ( ) { return Ok ( vec ! [ ] ) ; } if let Some ( keyset ) = self . keys . get ( name ) { if keyset . disabled && ! force { return Err ( ErrorKind :: KeysDisabled ( name . to_string ( ) ) . into ( ) ) ; } else if ! replace { return Err ( ErrorKind :: KeysExist ( name . to_string ( ) ) . into ( ) ) ; } } self . keys . insert ( name . to_string ( ) , AuthorizedKeySet { filename : name . to_string ( ) , disabled : false , keys : keys . clone ( ) , } , ) ; Ok ( keys ) }
add_keys adds a list of public keys with the provide name.
add_keys adds a list of public keys with the provide name .
&mut self
name
&str
keys
Vec<AuthorizedKeyEntry>
replace
bool
force
bool
&mut self
name
&str
keys
Vec<AuthorizedKeyEntry>
replace
bool
force
bool