Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse credential.helper command line using shell-words #680

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ url = "2.0"
bitflags = "1.1.0"
libc = "0.2"
log = "0.4.8"
shell-words = "1.0"
libgit2-sys = { path = "libgit2-sys", version = "0.12.18" }

[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
Expand Down
14 changes: 9 additions & 5 deletions src/cred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,16 @@ impl CredentialHelper {
Ok(p) => p,
Err(e) => {
debug!("`sh` failed to spawn: {}", e);
let mut parts = cmd.split_whitespace();
let mut parts = match shell_words::split(cmd) {
Ok(parts) => parts.into_iter(),
Err(e) => {
debug!("command {:?} parsing failed with {}", cmd, e);
return (None, None);
}
};
let mut c = Command::new(parts.next().unwrap());
for arg in parts {
c.arg(arg);
}
c.arg("get")
c.args(parts)
.arg("get")
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
Expand Down