Skip to content

Commit 2f2b684

Browse files
committed
Add credential free and transport callbacks to NativeMethods
1 parent cf6a3c5 commit 2f2b684

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ internal static extern int git_cred_userpass_plaintext_new(
459459
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string username,
460460
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string password);
461461

462+
[DllImport(libgit2)]
463+
internal static extern void git_cred_free(IntPtr cred);
464+
462465
[DllImport(libgit2)]
463466
internal static extern int git_describe_commit(
464467
out DescribeResultSafeHandle describe,
@@ -1732,6 +1735,20 @@ internal static extern int git_transport_smart(
17321735
IntPtr remote,
17331736
IntPtr definition);
17341737

1738+
[DllImport(libgit2)]
1739+
internal static extern int git_transport_smart_certificate_check(
1740+
IntPtr transport,
1741+
IntPtr cert,
1742+
int valid,
1743+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string hostname);
1744+
1745+
[DllImport(libgit2)]
1746+
internal static extern int git_transport_smart_credentials(
1747+
out IntPtr cred_out,
1748+
IntPtr transport,
1749+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string user,
1750+
int methods);
1751+
17351752
[DllImport(libgit2)]
17361753
internal static extern int git_transport_unregister(
17371754
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string prefix);

LibGit2Sharp/Core/Proxy.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,15 @@ public static ConfigurationSafeHandle git_config_snapshot(ConfigurationSafeHandl
628628

629629
#endregion
630630

631+
#region git_cred_
632+
633+
public static void git_cred_free(IntPtr cred)
634+
{
635+
NativeMethods.git_cred_free(cred);
636+
}
637+
638+
#endregion
639+
631640
#region git_describe_
632641

633642
public static string git_describe_commit(
@@ -3181,6 +3190,15 @@ public static void git_transport_unregister(String prefix)
31813190

31823191
#endregion
31833192

3193+
#region git_transport_smart_
3194+
3195+
public static int git_transport_smart_credentials(out IntPtr cred, IntPtr transport, string user, int methods)
3196+
{
3197+
return NativeMethods.git_transport_smart_credentials(out cred, transport, user, methods);
3198+
}
3199+
3200+
#endregion
3201+
31843202
#region git_tree_
31853203

31863204
public static Mode git_tree_entry_attributes(SafeHandle entry)

0 commit comments

Comments
 (0)