Skip to content

Commit

Permalink
Handle some auth failures neutral
Browse files Browse the repository at this point in the history
Related #54
  • Loading branch information
KSAlpha committed Feb 7, 2019
1 parent 83659d6 commit b745fa3
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions owl-daemon/src/handler/exploit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,40 +464,41 @@ fn add_to_task_queue(resource: &DaemonResource, exploit: &Exploit) -> Result<(),
.then(move |result| {
if let Ok(con) = db_pool.get() {
let con = &*con;
let failed = result.is_err();
let exploit_update_message = result.unwrap_or_else(|err| {
let (exploit_update_message, failed) = result.map(
|exploit_update_message| (exploit_update_message, false)
).unwrap_or_else(|err| {
info!(target: "exploit", "[ExploitTask] Failed: {}", exploit_task.id);
if let Error::ExploitError(err) = err {
match err {
ExploitError::ExploitProcessError(err) => {
(ExploitStatus::ExploitProcessError, err.to_string())
((ExploitStatus::ExploitProcessError, err.to_string()), true)
},
ExploitError::ExploitReturnCodeNotZero {
return_code,
stderr,
} => (
} => ((
ExploitStatus::ExploitReturnCodeNotZero,
format!("code {:?}: {}", return_code, stderr),
),
), true),
ExploitError::ExploitTimeout(err) => {
(ExploitStatus::ExploitProcessError, err.to_string())
((ExploitStatus::ExploitProcessError, err.to_string()), true)
},
ExploitError::AuthProcessError(err) => {
(ExploitStatus::AuthProcessError, err.to_string())
((ExploitStatus::AuthProcessError, err.to_string()), false)
},
ExploitError::AuthReturnCodeNotZero {
return_code,
stderr,
} => (
} => ((
ExploitStatus::AuthReturnCodeNotZero,
format!("code {:?}: {}", return_code, stderr),
),
), false),
ExploitError::WrongFlag(flag) => {
(ExploitStatus::WrongFlag, flag)
((ExploitStatus::WrongFlag, flag), true)
},
}
} else {
(ExploitStatus::UnknownFailure, err.to_string())
((ExploitStatus::UnknownFailure, err.to_string()), false)
}
});

Expand All @@ -521,7 +522,7 @@ pub fn run_exploit(
let con: &PgConnection = &*resource.db_pool.get()?;

let exploit_name = params.name;
let wait_for_exploit = params.wait;
let _wait_for_exploit = params.wait;

let exploit = exploits::table
.filter(exploits::name.eq(exploit_name))
Expand Down

0 comments on commit b745fa3

Please sign in to comment.