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

Update to libssh2-sys 0.3.0 #919

Merged
merged 1 commit into from
Feb 5, 2023
Merged

Conversation

luqmana
Copy link
Member

@luqmana luqmana commented Jan 22, 2023

Pull in upstream libssh2 changes were pulled in that fix a number of issues (specifically getting the sha2 signature algorithm support).

Using the fetch example in the repo with a small patch:

diff --git a/examples/fetch.rs b/examples/fetch.rs
index 64374a6..050769d 100644
--- a/examples/fetch.rs
+++ b/examples/fetch.rs
@@ -76,6 +76,19 @@ fn run(args: &Args) -> Result<(), git2::Error> {
         true
     });
 
+    cb.credentials(|_url, username, _cred_type| {
+        use std::path::Path;
+
+        let cred = git2::Cred::ssh_key(
+            username.unwrap(),
+            Some(Path::new("/home/luqman/.ssh/id_rsa.pub")),
+            Path::new("/home/luqman/.ssh/id_rsa"),
+            None,
+        )
+        .unwrap();
+        Ok(cred)
+    });
+
     // Download the packfile and index it. This function updates the amount of
     // received data and the indexer stats which lets you inform the user about
     // progress.

Before:

$ ~/git2-rs/target/debug/examples/fetch
Fetching origin for repo
error: ERROR: You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.

; class=Ssh (23); code=Eof (-20)

After:

$ ~/git2-rs/target/debug/examples/fetch
Fetching origin for repo
remote: Enumerating objects: 230, done.
remote: Counting objects: 100% (230/230), done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 230 (delta 133), reused 212 (delta 121), pack-reused 0
Received 230/230 objects in 81776 bytes (used 10 local objects)

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ehuss ehuss merged commit 1ab62f3 into rust-lang:master Feb 5, 2023
@luqmana luqmana deleted the update-libssh2-sys branch February 5, 2023 21:59
@ehuss ehuss mentioned this pull request Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants