(values: &[String])
| 196 | } |
| 197 | |
| 198 | fn profiles_to_mask(values: &[String]) -> Result<i32, FirewallError> { |
| 199 | if values.is_empty() { |
| 200 | return Ok(NET_FW_PROFILE2_ALL.0); |
| 201 | } |
| 202 | |
| 203 | let mut mask = 0; |
| 204 | for value in values { |
| 205 | match value.to_ascii_lowercase().as_str() { |
| 206 | "all" => return Ok(NET_FW_PROFILE2_ALL.0), |
| 207 | "domain" => mask |= NET_FW_PROFILE2_DOMAIN.0, |
| 208 | "private" => mask |= NET_FW_PROFILE2_PRIVATE.0, |
| 209 | "public" => mask |= NET_FW_PROFILE2_PUBLIC.0, |
| 210 | _ => return Err(t!("firewall.invalidProfiles", value = value).to_string().into()), |
| 211 | } |
| 212 | } |
| 213 | Ok(mask) |
| 214 | } |
| 215 | |
| 216 | fn split_csv(value: Option<String>) -> Option<Vec<String>> { |
| 217 | value.map(|raw| { |
no test coverage detected