rugged 0.27.10 → 0.27.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +0 -1
- data/vendor/libgit2/CMakeLists.txt +54 -98
- data/vendor/libgit2/COPYING +0 -28
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +1 -15
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +8 -9
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/http-parser/{COPYING → LICENSE-MIT} +0 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/regex/config.h +7 -0
- data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
- data/vendor/libgit2/deps/regex/regex.c +92 -0
- data/vendor/libgit2/deps/regex/regex.h +582 -0
- data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
- data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
- data/vendor/libgit2/deps/regex/regexec.c +4369 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +0 -1
- data/vendor/libgit2/deps/zlib/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +7 -0
- data/vendor/libgit2/include/git2.h +0 -5
- data/vendor/libgit2/include/git2/annotated_commit.h +0 -9
- data/vendor/libgit2/include/git2/attr.h +20 -38
- data/vendor/libgit2/include/git2/blame.h +25 -42
- data/vendor/libgit2/include/git2/blob.h +13 -45
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +16 -22
- data/vendor/libgit2/include/git2/checkout.h +32 -65
- data/vendor/libgit2/include/git2/cherrypick.h +7 -9
- data/vendor/libgit2/include/git2/clone.h +10 -12
- data/vendor/libgit2/include/git2/commit.h +3 -53
- data/vendor/libgit2/include/git2/common.h +8 -60
- data/vendor/libgit2/include/git2/config.h +19 -30
- data/vendor/libgit2/include/git2/describe.h +9 -32
- data/vendor/libgit2/include/git2/diff.h +156 -208
- data/vendor/libgit2/include/git2/errors.h +46 -54
- data/vendor/libgit2/include/git2/filter.h +0 -8
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +52 -74
- data/vendor/libgit2/include/git2/indexer.h +6 -76
- data/vendor/libgit2/include/git2/inttypes.h +309 -0
- data/vendor/libgit2/include/git2/merge.h +18 -35
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +29 -17
- data/vendor/libgit2/include/git2/odb.h +11 -12
- data/vendor/libgit2/include/git2/odb_backend.h +9 -10
- data/vendor/libgit2/include/git2/oid.h +2 -2
- data/vendor/libgit2/include/git2/pack.h +3 -14
- data/vendor/libgit2/include/git2/proxy.h +8 -14
- data/vendor/libgit2/include/git2/rebase.h +6 -53
- data/vendor/libgit2/include/git2/refs.h +15 -33
- data/vendor/libgit2/include/git2/refspec.h +0 -17
- data/vendor/libgit2/include/git2/remote.h +24 -123
- data/vendor/libgit2/include/git2/repository.h +39 -76
- data/vendor/libgit2/include/git2/revert.h +4 -6
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +12 -15
- data/vendor/libgit2/include/git2/status.h +20 -33
- data/vendor/libgit2/include/git2/submodule.h +12 -30
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/index.h +0 -3
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +4 -9
- data/vendor/libgit2/include/git2/sys/odb_backend.h +22 -66
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -76
- data/vendor/libgit2/include/git2/sys/repository.h +1 -5
- data/vendor/libgit2/include/git2/sys/stream.h +12 -92
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +83 -129
- data/vendor/libgit2/include/git2/tag.h +4 -13
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transaction.h +0 -1
- data/vendor/libgit2/include/git2/transport.h +311 -11
- data/vendor/libgit2/include/git2/tree.h +4 -4
- data/vendor/libgit2/include/git2/types.h +111 -33
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +13 -48
- data/vendor/libgit2/libgit2.pc.in +13 -0
- data/vendor/libgit2/src/CMakeLists.txt +164 -96
- data/vendor/libgit2/src/annotated_commit.c +8 -15
- data/vendor/libgit2/src/apply.c +31 -537
- data/vendor/libgit2/src/apply.h +1 -3
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +75 -81
- data/vendor/libgit2/src/attr_file.c +121 -207
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +53 -51
- data/vendor/libgit2/src/attrcache.h +1 -2
- data/vendor/libgit2/src/blame.c +20 -47
- data/vendor/libgit2/src/blame.h +1 -2
- data/vendor/libgit2/src/blame_git.c +20 -37
- data/vendor/libgit2/src/blob.c +42 -128
- data/vendor/libgit2/src/blob.h +2 -19
- data/vendor/libgit2/src/branch.c +43 -67
- data/vendor/libgit2/src/buf_text.c +6 -7
- data/vendor/libgit2/src/buffer.c +57 -69
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +45 -38
- data/vendor/libgit2/src/cache.h +3 -3
- data/vendor/libgit2/src/cc-compat.h +3 -20
- data/vendor/libgit2/src/checkout.c +90 -109
- data/vendor/libgit2/src/cherrypick.c +9 -15
- data/vendor/libgit2/src/clone.c +27 -49
- data/vendor/libgit2/src/clone.h +0 -4
- data/vendor/libgit2/src/commit.c +49 -117
- data/vendor/libgit2/src/commit.h +0 -7
- data/vendor/libgit2/src/commit_list.c +78 -30
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +91 -27
- data/vendor/libgit2/src/config.c +176 -194
- data/vendor/libgit2/src/config.h +20 -8
- data/vendor/libgit2/src/config_cache.c +35 -41
- data/vendor/libgit2/src/config_file.c +753 -439
- data/vendor/libgit2/src/config_file.h +73 -0
- data/vendor/libgit2/src/config_parse.c +63 -114
- data/vendor/libgit2/src/config_parse.h +16 -17
- data/vendor/libgit2/src/crlf.c +190 -219
- data/vendor/libgit2/src/delta.c +18 -25
- data/vendor/libgit2/src/describe.c +41 -42
- data/vendor/libgit2/src/diff.c +68 -53
- data/vendor/libgit2/src/diff.h +1 -2
- data/vendor/libgit2/src/diff_driver.c +49 -47
- data/vendor/libgit2/src/diff_file.c +17 -19
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +106 -162
- data/vendor/libgit2/src/diff_generate.h +3 -3
- data/vendor/libgit2/src/diff_parse.c +4 -4
- data/vendor/libgit2/src/diff_print.c +30 -42
- data/vendor/libgit2/src/diff_stats.c +7 -22
- data/vendor/libgit2/src/diff_tform.c +16 -16
- data/vendor/libgit2/src/diff_xdiff.c +3 -15
- data/vendor/libgit2/src/errors.c +39 -51
- data/vendor/libgit2/src/features.h.in +3 -11
- data/vendor/libgit2/src/fetch.c +5 -10
- data/vendor/libgit2/src/fetchhead.c +17 -17
- data/vendor/libgit2/src/filebuf.c +36 -32
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/{futils.c → fileops.c} +73 -80
- data/vendor/libgit2/src/{futils.h → fileops.h} +6 -6
- data/vendor/libgit2/src/filter.c +38 -46
- data/vendor/libgit2/src/filter.h +10 -0
- data/vendor/libgit2/src/fnmatch.c +248 -0
- data/vendor/libgit2/src/fnmatch.h +48 -0
- data/vendor/libgit2/src/global.c +63 -48
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/hash.c +0 -61
- data/vendor/libgit2/src/hash.h +19 -20
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +47 -0
- data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +17 -17
- data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
- data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +10 -4
- data/vendor/libgit2/src/hash/hash_openssl.h +59 -0
- data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +37 -47
- data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hashsig.c +5 -5
- data/vendor/libgit2/src/idxmap.c +61 -107
- data/vendor/libgit2/src/idxmap.h +31 -153
- data/vendor/libgit2/src/ignore.c +47 -43
- data/vendor/libgit2/src/index.c +232 -337
- data/vendor/libgit2/src/index.h +1 -17
- data/vendor/libgit2/src/indexer.c +175 -346
- data/vendor/libgit2/src/integer.h +26 -71
- data/vendor/libgit2/src/iterator.c +70 -142
- data/vendor/libgit2/src/iterator.h +0 -15
- data/vendor/libgit2/src/khash.h +1 -3
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +100 -144
- data/vendor/libgit2/src/merge_driver.c +11 -11
- data/vendor/libgit2/src/merge_file.c +2 -2
- data/vendor/libgit2/src/mwindow.c +29 -24
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/netops.c +156 -55
- data/vendor/libgit2/src/netops.h +23 -3
- data/vendor/libgit2/src/notes.c +11 -16
- data/vendor/libgit2/src/object.c +69 -120
- data/vendor/libgit2/src/object.h +9 -22
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +93 -116
- data/vendor/libgit2/src/odb.h +7 -8
- data/vendor/libgit2/src/odb_loose.c +55 -62
- data/vendor/libgit2/src/odb_mempack.c +34 -21
- data/vendor/libgit2/src/odb_pack.c +14 -18
- data/vendor/libgit2/src/offmap.c +35 -53
- data/vendor/libgit2/src/offmap.h +21 -108
- data/vendor/libgit2/src/oid.c +7 -12
- data/vendor/libgit2/src/oidmap.c +47 -49
- data/vendor/libgit2/src/oidmap.h +24 -101
- data/vendor/libgit2/src/pack-objects.c +87 -88
- data/vendor/libgit2/src/pack-objects.h +8 -2
- data/vendor/libgit2/src/pack.c +101 -99
- data/vendor/libgit2/src/pack.h +19 -17
- data/vendor/libgit2/src/parse.c +0 -10
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +4 -4
- data/vendor/libgit2/src/patch_generate.c +20 -20
- data/vendor/libgit2/src/patch_parse.c +63 -151
- data/vendor/libgit2/src/path.c +104 -117
- data/vendor/libgit2/src/path.h +71 -3
- data/vendor/libgit2/src/pathspec.c +19 -19
- data/vendor/libgit2/src/pool.c +22 -26
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +10 -10
- data/vendor/libgit2/src/posix.h +1 -12
- data/vendor/libgit2/src/proxy.c +3 -8
- data/vendor/libgit2/src/push.c +31 -37
- data/vendor/libgit2/src/push.h +1 -2
- data/vendor/libgit2/src/rebase.c +59 -115
- data/vendor/libgit2/src/refdb.c +3 -15
- data/vendor/libgit2/src/refdb_fs.c +254 -381
- data/vendor/libgit2/src/reflog.c +15 -13
- data/vendor/libgit2/src/refs.c +88 -118
- data/vendor/libgit2/src/refs.h +3 -5
- data/vendor/libgit2/src/refspec.c +37 -56
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +215 -266
- data/vendor/libgit2/src/remote.h +2 -11
- data/vendor/libgit2/src/repository.c +225 -280
- data/vendor/libgit2/src/repository.h +40 -52
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +9 -14
- data/vendor/libgit2/src/revparse.c +48 -47
- data/vendor/libgit2/src/revwalk.c +57 -120
- data/vendor/libgit2/src/revwalk.h +1 -22
- data/vendor/libgit2/src/settings.c +10 -47
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +36 -22
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +99 -125
- data/vendor/libgit2/src/status.c +22 -28
- data/vendor/libgit2/src/stream.h +2 -17
- data/vendor/libgit2/src/streams/curl.c +385 -0
- data/vendor/libgit2/src/{allocators/stdalloc.h → streams/curl.h} +5 -5
- data/vendor/libgit2/src/streams/openssl.c +114 -224
- data/vendor/libgit2/src/streams/openssl.h +108 -4
- data/vendor/libgit2/src/streams/socket.c +30 -55
- data/vendor/libgit2/src/streams/stransport.c +32 -57
- data/vendor/libgit2/src/streams/stransport.h +0 -5
- data/vendor/libgit2/src/streams/tls.c +19 -50
- data/vendor/libgit2/src/streams/tls.h +4 -12
- data/vendor/libgit2/src/strmap.c +74 -47
- data/vendor/libgit2/src/strmap.h +33 -108
- data/vendor/libgit2/src/submodule.c +216 -272
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +19 -29
- data/vendor/libgit2/src/tag.c +28 -41
- data/vendor/libgit2/src/tag.h +1 -2
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +38 -52
- data/vendor/libgit2/src/transaction.c +29 -30
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +11 -15
- data/vendor/libgit2/src/transports/auth.h +3 -10
- data/vendor/libgit2/src/transports/auth_negotiate.c +18 -33
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/cred.c +24 -24
- data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
- data/vendor/libgit2/src/transports/git.c +31 -26
- data/vendor/libgit2/src/transports/http.c +348 -881
- data/vendor/libgit2/src/transports/http.h +0 -2
- data/vendor/libgit2/src/transports/local.c +35 -35
- data/vendor/libgit2/src/transports/smart.c +47 -70
- data/vendor/libgit2/src/transports/smart.h +4 -3
- data/vendor/libgit2/src/transports/smart_pkt.c +40 -43
- data/vendor/libgit2/src/transports/smart_protocol.c +116 -96
- data/vendor/libgit2/src/transports/ssh.c +66 -77
- data/vendor/libgit2/src/transports/winhttp.c +314 -318
- data/vendor/libgit2/src/tree-cache.c +12 -19
- data/vendor/libgit2/src/tree.c +142 -103
- data/vendor/libgit2/src/tree.h +12 -1
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +11 -1
- data/vendor/libgit2/src/userdiff.h +1 -3
- data/vendor/libgit2/src/util.c +56 -70
- data/vendor/libgit2/src/util.h +156 -28
- data/vendor/libgit2/src/vector.c +4 -4
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +3 -3
- data/vendor/libgit2/src/win32/map.c +11 -9
- data/vendor/libgit2/src/win32/msvc-compat.h +0 -6
- data/vendor/libgit2/src/win32/path_w32.c +9 -113
- data/vendor/libgit2/src/win32/path_w32.h +29 -18
- data/vendor/libgit2/src/win32/posix.h +4 -1
- data/vendor/libgit2/src/win32/posix_w32.c +45 -70
- data/vendor/libgit2/src/win32/precompiled.h +2 -0
- data/vendor/libgit2/src/win32/thread.c +10 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +5 -9
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -3
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -26
- data/vendor/libgit2/src/win32/w32_stack.c +11 -6
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +64 -27
- data/vendor/libgit2/src/win32/w32_util.h +49 -5
- data/vendor/libgit2/src/worktree.c +60 -95
- data/vendor/libgit2/src/worktree.h +0 -2
- data/vendor/libgit2/src/xdiff/xdiffi.c +5 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +15 -27
- data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +33 -122
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
- data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
- data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
- data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
- data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
- data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
- data/vendor/libgit2/deps/pcre/COPYING +0 -5
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
- data/vendor/libgit2/deps/pcre/config.h.in +0 -57
- data/vendor/libgit2/deps/pcre/pcre.h +0 -641
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
- data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
- data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
- data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
- data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
- data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
- data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
- data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
- data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
- data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
- data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
- data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
- data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
- data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
- data/vendor/libgit2/deps/pcre/ucp.h +0 -224
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +0 -993
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +0 -502
- data/vendor/libgit2/deps/zlib/COPYING +0 -27
- data/vendor/libgit2/include/git2/apply.h +0 -149
- data/vendor/libgit2/include/git2/cert.h +0 -135
- data/vendor/libgit2/include/git2/cred.h +0 -308
- data/vendor/libgit2/include/git2/deprecated.h +0 -493
- data/vendor/libgit2/include/git2/mailmap.h +0 -115
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
- data/vendor/libgit2/include/git2/sys/cred.h +0 -90
- data/vendor/libgit2/include/git2/sys/path.h +0 -64
- data/vendor/libgit2/src/alloc.c +0 -43
- data/vendor/libgit2/src/alloc.h +0 -40
- data/vendor/libgit2/src/allocators/stdalloc.c +0 -119
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/config_backend.h +0 -96
- data/vendor/libgit2/src/config_entries.c +0 -229
- data/vendor/libgit2/src/config_entries.h +0 -24
- data/vendor/libgit2/src/config_mem.c +0 -220
- data/vendor/libgit2/src/config_snapshot.c +0 -206
- data/vendor/libgit2/src/errors.h +0 -81
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +0 -48
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
- data/vendor/libgit2/src/hash/sha1/mbedtls.h +0 -19
- data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
- data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
- data/vendor/libgit2/src/mailmap.c +0 -485
- data/vendor/libgit2/src/mailmap.h +0 -35
- data/vendor/libgit2/src/net.c +0 -184
- data/vendor/libgit2/src/net.h +0 -36
- data/vendor/libgit2/src/reader.c +0 -265
- data/vendor/libgit2/src/reader.h +0 -107
- data/vendor/libgit2/src/regexp.c +0 -221
- data/vendor/libgit2/src/regexp.h +0 -97
- data/vendor/libgit2/src/streams/mbedtls.c +0 -483
- data/vendor/libgit2/src/streams/mbedtls.h +0 -23
- data/vendor/libgit2/src/streams/registry.c +0 -118
- data/vendor/libgit2/src/streams/registry.h +0 -19
- data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
- data/vendor/libgit2/src/wildmatch.c +0 -320
- data/vendor/libgit2/src/wildmatch.h +0 -23
- data/vendor/libgit2/src/win32/w32_common.h +0 -39
data/vendor/libgit2/src/reader.h
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
-
*
|
4
|
-
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
-
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
-
*/
|
7
|
-
#ifndef INCLUDE_reader_h__
|
8
|
-
#define INCLUDE_reader_h__
|
9
|
-
|
10
|
-
#include "common.h"
|
11
|
-
|
12
|
-
/* Returned when the workdir does not match the index */
|
13
|
-
#define GIT_READER_MISMATCH 1
|
14
|
-
|
15
|
-
typedef struct git_reader git_reader;
|
16
|
-
|
17
|
-
/*
|
18
|
-
* The `git_reader` structure is a generic interface for reading the
|
19
|
-
* contents of a file by its name, and implementations are provided
|
20
|
-
* for reading out of a tree, the index, and the working directory.
|
21
|
-
*
|
22
|
-
* Note that the reader implementation is meant to have a short
|
23
|
-
* lifecycle and does not increase the refcount of the object that
|
24
|
-
* it's reading. Callers should ensure that they do not use a
|
25
|
-
* reader after disposing the underlying object that it reads.
|
26
|
-
*/
|
27
|
-
struct git_reader {
|
28
|
-
int (*read)(git_buf *out, git_oid *out_oid, git_filemode_t *mode, git_reader *reader, const char *filename);
|
29
|
-
};
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Create a `git_reader` that will allow random access to the given
|
33
|
-
* tree. Paths requested via `git_reader_read` will be rooted at this
|
34
|
-
* tree, callers are not expected to recurse through tree lookups. Thus,
|
35
|
-
* you can request to read `/src/foo.c` and the tree provided to this
|
36
|
-
* function will be searched to find another tree named `src`, which
|
37
|
-
* will then be opened to find `foo.c`.
|
38
|
-
*
|
39
|
-
* @param out The reader for the given tree
|
40
|
-
* @param tree The tree object to read
|
41
|
-
* @return 0 on success, or an error code < 0
|
42
|
-
*/
|
43
|
-
extern int git_reader_for_tree(
|
44
|
-
git_reader **out,
|
45
|
-
git_tree *tree);
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Create a `git_reader` that will allow random access to the given
|
49
|
-
* index, or the repository's index.
|
50
|
-
*
|
51
|
-
* @param out The reader for the given index
|
52
|
-
* @param repo The repository containing the index
|
53
|
-
* @param index The index to read, or NULL to use the repository's index
|
54
|
-
* @return 0 on success, or an error code < 0
|
55
|
-
*/
|
56
|
-
extern int git_reader_for_index(
|
57
|
-
git_reader **out,
|
58
|
-
git_repository *repo,
|
59
|
-
git_index *index);
|
60
|
-
|
61
|
-
/**
|
62
|
-
* Create a `git_reader` that will allow random access to the given
|
63
|
-
* repository's working directory. Note that the contents are read
|
64
|
-
* in repository format, meaning any workdir -> odb filters are
|
65
|
-
* applied.
|
66
|
-
*
|
67
|
-
* If `validate_index` is set to true, reads of files will hash the
|
68
|
-
* on-disk contents and ensure that the resulting object ID matches
|
69
|
-
* the repository's index. This ensures that the working directory
|
70
|
-
* is unmodified from the index contents.
|
71
|
-
*
|
72
|
-
* @param out The reader for the given working directory
|
73
|
-
* @param repo The repository containing the working directory
|
74
|
-
* @param validate_index If true, the working directory contents will
|
75
|
-
* be compared to the index contents during read to ensure that
|
76
|
-
* the working directory is unmodified.
|
77
|
-
* @return 0 on success, or an error code < 0
|
78
|
-
*/
|
79
|
-
extern int git_reader_for_workdir(
|
80
|
-
git_reader **out,
|
81
|
-
git_repository *repo,
|
82
|
-
bool validate_index);
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Read the given filename from the reader and populate the given buffer
|
86
|
-
* with the contents and the given oid with the object ID.
|
87
|
-
*
|
88
|
-
* @param out The buffer to populate with the file contents
|
89
|
-
* @param out_id The oid to populate with the object ID
|
90
|
-
* @param reader The reader to read
|
91
|
-
* @param filename The filename to read from the reader
|
92
|
-
*/
|
93
|
-
extern int git_reader_read(
|
94
|
-
git_buf *out,
|
95
|
-
git_oid *out_id,
|
96
|
-
git_filemode_t *out_filemode,
|
97
|
-
git_reader *reader,
|
98
|
-
const char *filename);
|
99
|
-
|
100
|
-
/**
|
101
|
-
* Free the given reader and any associated objects.
|
102
|
-
*
|
103
|
-
* @param reader The reader to free
|
104
|
-
*/
|
105
|
-
extern void git_reader_free(git_reader *reader);
|
106
|
-
|
107
|
-
#endif
|
data/vendor/libgit2/src/regexp.c
DELETED
@@ -1,221 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
-
*
|
4
|
-
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
-
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
-
*/
|
7
|
-
|
8
|
-
#include "regexp.h"
|
9
|
-
|
10
|
-
#if defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE)
|
11
|
-
|
12
|
-
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
|
13
|
-
{
|
14
|
-
int erroffset, cflags = 0;
|
15
|
-
const char *error;
|
16
|
-
|
17
|
-
if (flags & GIT_REGEXP_ICASE)
|
18
|
-
cflags |= PCRE_CASELESS;
|
19
|
-
|
20
|
-
if ((*r = pcre_compile(pattern, cflags, &error, &erroffset, NULL)) == NULL) {
|
21
|
-
git_error_set_str(GIT_ERROR_REGEX, error);
|
22
|
-
return GIT_EINVALIDSPEC;
|
23
|
-
}
|
24
|
-
|
25
|
-
return 0;
|
26
|
-
}
|
27
|
-
|
28
|
-
void git_regexp_dispose(git_regexp *r)
|
29
|
-
{
|
30
|
-
pcre_free(*r);
|
31
|
-
*r = NULL;
|
32
|
-
}
|
33
|
-
|
34
|
-
int git_regexp_match(const git_regexp *r, const char *string)
|
35
|
-
{
|
36
|
-
int error;
|
37
|
-
if ((error = pcre_exec(*r, NULL, string, (int) strlen(string), 0, 0, NULL, 0)) < 0)
|
38
|
-
return (error == PCRE_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
39
|
-
return 0;
|
40
|
-
}
|
41
|
-
|
42
|
-
int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, git_regmatch *matches)
|
43
|
-
{
|
44
|
-
int static_ovec[9], *ovec;
|
45
|
-
int error;
|
46
|
-
size_t i;
|
47
|
-
|
48
|
-
/* The ovec array always needs to be a mutiple of three */
|
49
|
-
if (nmatches <= ARRAY_SIZE(static_ovec) / 3)
|
50
|
-
ovec = static_ovec;
|
51
|
-
else
|
52
|
-
ovec = git__calloc(nmatches * 3, sizeof(*ovec));
|
53
|
-
GIT_ERROR_CHECK_ALLOC(ovec);
|
54
|
-
|
55
|
-
if ((error = pcre_exec(*r, NULL, string, (int) strlen(string), 0, 0, ovec, (int) nmatches * 3)) < 0)
|
56
|
-
goto out;
|
57
|
-
|
58
|
-
if (error == 0)
|
59
|
-
error = (int) nmatches;
|
60
|
-
|
61
|
-
for (i = 0; i < (unsigned int) error; i++) {
|
62
|
-
matches[i].start = (ovec[i * 2] < 0) ? -1 : ovec[i * 2];
|
63
|
-
matches[i].end = (ovec[i * 2 + 1] < 0) ? -1 : ovec[i * 2 + 1];
|
64
|
-
}
|
65
|
-
for (i = (unsigned int) error; i < nmatches; i++)
|
66
|
-
matches[i].start = matches[i].end = -1;
|
67
|
-
|
68
|
-
out:
|
69
|
-
if (nmatches > ARRAY_SIZE(static_ovec) / 3)
|
70
|
-
git__free(ovec);
|
71
|
-
if (error < 0)
|
72
|
-
return (error == PCRE_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
73
|
-
return 0;
|
74
|
-
}
|
75
|
-
|
76
|
-
#elif defined(GIT_REGEX_PCRE2)
|
77
|
-
|
78
|
-
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
|
79
|
-
{
|
80
|
-
unsigned char errmsg[1024];
|
81
|
-
PCRE2_SIZE erroff;
|
82
|
-
int error, cflags = 0;
|
83
|
-
|
84
|
-
if (flags & GIT_REGEXP_ICASE)
|
85
|
-
cflags |= PCRE2_CASELESS;
|
86
|
-
|
87
|
-
if ((*r = pcre2_compile((const unsigned char *) pattern, PCRE2_ZERO_TERMINATED,
|
88
|
-
cflags, &error, &erroff, NULL)) == NULL) {
|
89
|
-
pcre2_get_error_message(error, errmsg, sizeof(errmsg));
|
90
|
-
git_error_set_str(GIT_ERROR_REGEX, (char *) errmsg);
|
91
|
-
return GIT_EINVALIDSPEC;
|
92
|
-
}
|
93
|
-
|
94
|
-
return 0;
|
95
|
-
}
|
96
|
-
|
97
|
-
void git_regexp_dispose(git_regexp *r)
|
98
|
-
{
|
99
|
-
pcre2_code_free(*r);
|
100
|
-
*r = NULL;
|
101
|
-
}
|
102
|
-
|
103
|
-
int git_regexp_match(const git_regexp *r, const char *string)
|
104
|
-
{
|
105
|
-
pcre2_match_data *data;
|
106
|
-
int error;
|
107
|
-
|
108
|
-
data = pcre2_match_data_create(1, NULL);
|
109
|
-
GIT_ERROR_CHECK_ALLOC(data);
|
110
|
-
|
111
|
-
if ((error = pcre2_match(*r, (const unsigned char *) string, strlen(string),
|
112
|
-
0, 0, data, NULL)) < 0)
|
113
|
-
return (error == PCRE2_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
114
|
-
|
115
|
-
pcre2_match_data_free(data);
|
116
|
-
return 0;
|
117
|
-
}
|
118
|
-
|
119
|
-
int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, git_regmatch *matches)
|
120
|
-
{
|
121
|
-
pcre2_match_data *data = NULL;
|
122
|
-
PCRE2_SIZE *ovec;
|
123
|
-
int error;
|
124
|
-
size_t i;
|
125
|
-
|
126
|
-
if ((data = pcre2_match_data_create(nmatches, NULL)) == NULL) {
|
127
|
-
git_error_set_oom();
|
128
|
-
goto out;
|
129
|
-
}
|
130
|
-
|
131
|
-
if ((error = pcre2_match(*r, (const unsigned char *) string, strlen(string),
|
132
|
-
0, 0, data, NULL)) < 0)
|
133
|
-
goto out;
|
134
|
-
|
135
|
-
if (error == 0 || (unsigned int) error > nmatches)
|
136
|
-
error = nmatches;
|
137
|
-
ovec = pcre2_get_ovector_pointer(data);
|
138
|
-
|
139
|
-
for (i = 0; i < (unsigned int) error; i++) {
|
140
|
-
matches[i].start = (ovec[i * 2] == PCRE2_UNSET) ? -1 : (ssize_t) ovec[i * 2];
|
141
|
-
matches[i].end = (ovec[i * 2 + 1] == PCRE2_UNSET) ? -1 : (ssize_t) ovec[i * 2 + 1];
|
142
|
-
}
|
143
|
-
for (i = (unsigned int) error; i < nmatches; i++)
|
144
|
-
matches[i].start = matches[i].end = -1;
|
145
|
-
|
146
|
-
out:
|
147
|
-
pcre2_match_data_free(data);
|
148
|
-
if (error < 0)
|
149
|
-
return (error == PCRE2_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
150
|
-
return 0;
|
151
|
-
}
|
152
|
-
|
153
|
-
#elif defined(GIT_REGEX_REGCOMP) || defined(GIT_REGEX_REGCOMP_L)
|
154
|
-
|
155
|
-
#if defined(GIT_REGEX_REGCOMP_L)
|
156
|
-
# include <xlocale.h>
|
157
|
-
#endif
|
158
|
-
|
159
|
-
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
|
160
|
-
{
|
161
|
-
int cflags = REG_EXTENDED, error;
|
162
|
-
char errmsg[1024];
|
163
|
-
|
164
|
-
if (flags & GIT_REGEXP_ICASE)
|
165
|
-
cflags |= REG_ICASE;
|
166
|
-
|
167
|
-
# if defined(GIT_REGEX_REGCOMP)
|
168
|
-
if ((error = regcomp(r, pattern, cflags)) != 0)
|
169
|
-
# else
|
170
|
-
if ((error = regcomp_l(r, pattern, cflags, (locale_t) 0)) != 0)
|
171
|
-
# endif
|
172
|
-
{
|
173
|
-
regerror(error, r, errmsg, sizeof(errmsg));
|
174
|
-
git_error_set_str(GIT_ERROR_REGEX, errmsg);
|
175
|
-
return GIT_EINVALIDSPEC;
|
176
|
-
}
|
177
|
-
|
178
|
-
return 0;
|
179
|
-
}
|
180
|
-
|
181
|
-
void git_regexp_dispose(git_regexp *r)
|
182
|
-
{
|
183
|
-
regfree(r);
|
184
|
-
}
|
185
|
-
|
186
|
-
int git_regexp_match(const git_regexp *r, const char *string)
|
187
|
-
{
|
188
|
-
int error;
|
189
|
-
if ((error = regexec(r, string, 0, NULL, 0)) != 0)
|
190
|
-
return (error == REG_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
191
|
-
return 0;
|
192
|
-
}
|
193
|
-
|
194
|
-
int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, git_regmatch *matches)
|
195
|
-
{
|
196
|
-
regmatch_t static_m[3], *m;
|
197
|
-
int error;
|
198
|
-
size_t i;
|
199
|
-
|
200
|
-
if (nmatches <= ARRAY_SIZE(static_m))
|
201
|
-
m = static_m;
|
202
|
-
else
|
203
|
-
m = git__calloc(nmatches, sizeof(*m));
|
204
|
-
|
205
|
-
if ((error = regexec(r, string, nmatches, m, 0)) != 0)
|
206
|
-
goto out;
|
207
|
-
|
208
|
-
for (i = 0; i < nmatches; i++) {
|
209
|
-
matches[i].start = (m[i].rm_so < 0) ? -1 : m[i].rm_so;
|
210
|
-
matches[i].end = (m[i].rm_eo < 0) ? -1 : m[i].rm_eo;
|
211
|
-
}
|
212
|
-
|
213
|
-
out:
|
214
|
-
if (nmatches > ARRAY_SIZE(static_m))
|
215
|
-
git__free(m);
|
216
|
-
if (error)
|
217
|
-
return (error == REG_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
218
|
-
return 0;
|
219
|
-
}
|
220
|
-
|
221
|
-
#endif
|
data/vendor/libgit2/src/regexp.h
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
-
*
|
4
|
-
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
-
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
-
*/
|
7
|
-
|
8
|
-
#ifndef INCLUDE_regexp_h__
|
9
|
-
#define INCLUDE_regexp_h__
|
10
|
-
|
11
|
-
#include "common.h"
|
12
|
-
|
13
|
-
#if defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE)
|
14
|
-
# include "pcre.h"
|
15
|
-
typedef pcre *git_regexp;
|
16
|
-
# define GIT_REGEX_INIT NULL
|
17
|
-
#elif defined(GIT_REGEX_PCRE2)
|
18
|
-
# define PCRE2_CODE_UNIT_WIDTH 8
|
19
|
-
# include <pcre2.h>
|
20
|
-
typedef pcre2_code *git_regexp;
|
21
|
-
# define GIT_REGEX_INIT NULL
|
22
|
-
#elif defined(GIT_REGEX_REGCOMP) || defined(GIT_REGEX_REGCOMP_L)
|
23
|
-
# include <regex.h>
|
24
|
-
typedef regex_t git_regexp;
|
25
|
-
# define GIT_REGEX_INIT { 0 }
|
26
|
-
#else
|
27
|
-
# error "No regex backend"
|
28
|
-
#endif
|
29
|
-
|
30
|
-
/** Options supported by @git_regexp_compile. */
|
31
|
-
typedef enum {
|
32
|
-
/** Enable case-insensitive matching */
|
33
|
-
GIT_REGEXP_ICASE = (1 << 0)
|
34
|
-
} git_regexp_flags_t;
|
35
|
-
|
36
|
-
/** Structure containing information about regular expression matching groups */
|
37
|
-
typedef struct {
|
38
|
-
/** Start of the given match. -1 if the group didn't match anything */
|
39
|
-
ssize_t start;
|
40
|
-
/** End of the given match. -1 if the group didn't match anything */
|
41
|
-
ssize_t end;
|
42
|
-
} git_regmatch;
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Compile a regular expression. The compiled expression needs to
|
46
|
-
* be cleaned up afterwards with `git_regexp_dispose`.
|
47
|
-
*
|
48
|
-
* @param r Pointer to the storage where to initialize the regular expression.
|
49
|
-
* @param pattern The pattern that shall be compiled.
|
50
|
-
* @param flags Flags to alter how the pattern shall be handled.
|
51
|
-
* 0 for defaults, otherwise see @git_regexp_flags_t.
|
52
|
-
* @return 0 on success, otherwise a negative return value.
|
53
|
-
*/
|
54
|
-
int git_regexp_compile(git_regexp *r, const char *pattern, int flags);
|
55
|
-
|
56
|
-
/**
|
57
|
-
* Free memory associated with the regular expression
|
58
|
-
*
|
59
|
-
* @param r The regular expression structure to dispose.
|
60
|
-
*/
|
61
|
-
void git_regexp_dispose(git_regexp *r);
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Test whether a given string matches a compiled regular
|
65
|
-
* expression.
|
66
|
-
*
|
67
|
-
* @param r Compiled regular expression.
|
68
|
-
* @param string String to match against the regular expression.
|
69
|
-
* @return 0 if the string matches, a negative error code
|
70
|
-
* otherwise. GIT_ENOTFOUND if no match was found,
|
71
|
-
* GIT_EINVALIDSPEC if the regular expression matching
|
72
|
-
* was invalid.
|
73
|
-
*/
|
74
|
-
int git_regexp_match(const git_regexp *r, const char *string);
|
75
|
-
|
76
|
-
/**
|
77
|
-
* Search for matches inside of a given string.
|
78
|
-
*
|
79
|
-
* Given a regular expression with capturing groups, this
|
80
|
-
* function will populate provided @git_regmatch structures with
|
81
|
-
* offsets for each of the given matches. Non-matching groups
|
82
|
-
* will have start and end values of the respective @git_regmatch
|
83
|
-
* structure set to -1.
|
84
|
-
*
|
85
|
-
* @param r Compiled regular expression.
|
86
|
-
* @param string String to match against the regular expression.
|
87
|
-
* @param nmatches Number of @git_regmatch structures provided by
|
88
|
-
* the user.
|
89
|
-
* @param matches Pointer to an array of @git_regmatch structures.
|
90
|
-
* @return 0 if the string matches, a negative error code
|
91
|
-
* otherwise. GIT_ENOTFOUND if no match was found,
|
92
|
-
* GIT_EINVALIDSPEC if the regular expression matching
|
93
|
-
* was invalid.
|
94
|
-
*/
|
95
|
-
int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, git_regmatch *matches);
|
96
|
-
|
97
|
-
#endif
|
@@ -1,483 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
-
*
|
4
|
-
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
-
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
-
*/
|
7
|
-
|
8
|
-
#include "streams/mbedtls.h"
|
9
|
-
|
10
|
-
#ifdef GIT_MBEDTLS
|
11
|
-
|
12
|
-
#include <ctype.h>
|
13
|
-
|
14
|
-
#include "global.h"
|
15
|
-
#include "stream.h"
|
16
|
-
#include "streams/socket.h"
|
17
|
-
#include "netops.h"
|
18
|
-
#include "git2/transport.h"
|
19
|
-
#include "util.h"
|
20
|
-
|
21
|
-
#ifndef GIT_DEFAULT_CERT_LOCATION
|
22
|
-
#define GIT_DEFAULT_CERT_LOCATION NULL
|
23
|
-
#endif
|
24
|
-
|
25
|
-
/* Work around C90-conformance issues */
|
26
|
-
#if defined(_MSC_VER)
|
27
|
-
# define inline __inline
|
28
|
-
#elif defined(__GNUC__)
|
29
|
-
# define inline __inline__
|
30
|
-
#else
|
31
|
-
# define inline
|
32
|
-
#endif
|
33
|
-
|
34
|
-
#include <mbedtls/config.h>
|
35
|
-
#include <mbedtls/ssl.h>
|
36
|
-
#include <mbedtls/error.h>
|
37
|
-
#include <mbedtls/entropy.h>
|
38
|
-
#include <mbedtls/ctr_drbg.h>
|
39
|
-
|
40
|
-
#undef inline
|
41
|
-
|
42
|
-
#define GIT_SSL_DEFAULT_CIPHERS "TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256:TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256:TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384:TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-DSS-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-DSS-WITH-AES-256-GCM-SHA384:TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256:TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256:TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA:TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA:TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384:TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384:TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA:TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-DSS-WITH-AES-128-CBC-SHA256:TLS-DHE-DSS-WITH-AES-256-CBC-SHA256:TLS-DHE-DSS-WITH-AES-128-CBC-SHA:TLS-DHE-DSS-WITH-AES-256-CBC-SHA:TLS-RSA-WITH-AES-128-GCM-SHA256:TLS-RSA-WITH-AES-256-GCM-SHA384:TLS-RSA-WITH-AES-128-CBC-SHA256:TLS-RSA-WITH-AES-256-CBC-SHA256:TLS-RSA-WITH-AES-128-CBC-SHA:TLS-RSA-WITH-AES-256-CBC-SHA"
|
43
|
-
#define GIT_SSL_DEFAULT_CIPHERS_COUNT 30
|
44
|
-
|
45
|
-
static mbedtls_ssl_config *git__ssl_conf;
|
46
|
-
static int ciphers_list[GIT_SSL_DEFAULT_CIPHERS_COUNT];
|
47
|
-
static mbedtls_entropy_context *mbedtls_entropy;
|
48
|
-
|
49
|
-
/**
|
50
|
-
* This function aims to clean-up the SSL context which
|
51
|
-
* we allocated.
|
52
|
-
*/
|
53
|
-
static void shutdown_ssl(void)
|
54
|
-
{
|
55
|
-
if (git__ssl_conf) {
|
56
|
-
mbedtls_x509_crt_free(git__ssl_conf->ca_chain);
|
57
|
-
git__free(git__ssl_conf->ca_chain);
|
58
|
-
mbedtls_ctr_drbg_free(git__ssl_conf->p_rng);
|
59
|
-
git__free(git__ssl_conf->p_rng);
|
60
|
-
mbedtls_ssl_config_free(git__ssl_conf);
|
61
|
-
git__free(git__ssl_conf);
|
62
|
-
git__ssl_conf = NULL;
|
63
|
-
}
|
64
|
-
if (mbedtls_entropy) {
|
65
|
-
mbedtls_entropy_free(mbedtls_entropy);
|
66
|
-
git__free(mbedtls_entropy);
|
67
|
-
mbedtls_entropy = NULL;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
int git_mbedtls__set_cert_location(const char *path, int is_dir);
|
72
|
-
|
73
|
-
int git_mbedtls_stream_global_init(void)
|
74
|
-
{
|
75
|
-
int loaded = 0;
|
76
|
-
char *crtpath = GIT_DEFAULT_CERT_LOCATION;
|
77
|
-
struct stat statbuf;
|
78
|
-
mbedtls_ctr_drbg_context *ctr_drbg = NULL;
|
79
|
-
|
80
|
-
size_t ciphers_known = 0;
|
81
|
-
char *cipher_name = NULL;
|
82
|
-
char *cipher_string = NULL;
|
83
|
-
char *cipher_string_tmp = NULL;
|
84
|
-
|
85
|
-
git__ssl_conf = git__malloc(sizeof(mbedtls_ssl_config));
|
86
|
-
GIT_ERROR_CHECK_ALLOC(git__ssl_conf);
|
87
|
-
|
88
|
-
mbedtls_ssl_config_init(git__ssl_conf);
|
89
|
-
if (mbedtls_ssl_config_defaults(git__ssl_conf,
|
90
|
-
MBEDTLS_SSL_IS_CLIENT,
|
91
|
-
MBEDTLS_SSL_TRANSPORT_STREAM,
|
92
|
-
MBEDTLS_SSL_PRESET_DEFAULT) != 0) {
|
93
|
-
git_error_set(GIT_ERROR_SSL, "failed to initialize mbedTLS");
|
94
|
-
goto cleanup;
|
95
|
-
}
|
96
|
-
|
97
|
-
/* configure TLSv1 */
|
98
|
-
mbedtls_ssl_conf_min_version(git__ssl_conf, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MINOR_VERSION_0);
|
99
|
-
|
100
|
-
/* verify_server_cert is responsible for making the check.
|
101
|
-
* OPTIONAL because REQUIRED drops the certificate as soon as the check
|
102
|
-
* is made, so we can never see the certificate and override it. */
|
103
|
-
mbedtls_ssl_conf_authmode(git__ssl_conf, MBEDTLS_SSL_VERIFY_OPTIONAL);
|
104
|
-
|
105
|
-
/* set the list of allowed ciphersuites */
|
106
|
-
ciphers_known = 0;
|
107
|
-
cipher_string = cipher_string_tmp = git__strdup(GIT_SSL_DEFAULT_CIPHERS);
|
108
|
-
GIT_ERROR_CHECK_ALLOC(cipher_string);
|
109
|
-
|
110
|
-
while ((cipher_name = git__strtok(&cipher_string_tmp, ":")) != NULL) {
|
111
|
-
int cipherid = mbedtls_ssl_get_ciphersuite_id(cipher_name);
|
112
|
-
if (cipherid == 0) continue;
|
113
|
-
|
114
|
-
if (ciphers_known >= ARRAY_SIZE(ciphers_list)) {
|
115
|
-
git_error_set(GIT_ERROR_SSL, "out of cipher list space");
|
116
|
-
goto cleanup;
|
117
|
-
}
|
118
|
-
|
119
|
-
ciphers_list[ciphers_known++] = cipherid;
|
120
|
-
}
|
121
|
-
git__free(cipher_string);
|
122
|
-
|
123
|
-
if (!ciphers_known) {
|
124
|
-
git_error_set(GIT_ERROR_SSL, "no cipher could be enabled");
|
125
|
-
goto cleanup;
|
126
|
-
}
|
127
|
-
mbedtls_ssl_conf_ciphersuites(git__ssl_conf, ciphers_list);
|
128
|
-
|
129
|
-
/* Seeding the random number generator */
|
130
|
-
mbedtls_entropy = git__malloc(sizeof(mbedtls_entropy_context));
|
131
|
-
GIT_ERROR_CHECK_ALLOC(mbedtls_entropy);
|
132
|
-
|
133
|
-
mbedtls_entropy_init(mbedtls_entropy);
|
134
|
-
|
135
|
-
ctr_drbg = git__malloc(sizeof(mbedtls_ctr_drbg_context));
|
136
|
-
GIT_ERROR_CHECK_ALLOC(ctr_drbg);
|
137
|
-
|
138
|
-
mbedtls_ctr_drbg_init(ctr_drbg);
|
139
|
-
|
140
|
-
if (mbedtls_ctr_drbg_seed(ctr_drbg,
|
141
|
-
mbedtls_entropy_func,
|
142
|
-
mbedtls_entropy, NULL, 0) != 0) {
|
143
|
-
git_error_set(GIT_ERROR_SSL, "failed to initialize mbedTLS entropy pool");
|
144
|
-
goto cleanup;
|
145
|
-
}
|
146
|
-
|
147
|
-
mbedtls_ssl_conf_rng(git__ssl_conf, mbedtls_ctr_drbg_random, ctr_drbg);
|
148
|
-
|
149
|
-
/* load default certificates */
|
150
|
-
if (crtpath != NULL && stat(crtpath, &statbuf) == 0 && S_ISREG(statbuf.st_mode))
|
151
|
-
loaded = (git_mbedtls__set_cert_location(crtpath, 0) == 0);
|
152
|
-
if (!loaded && crtpath != NULL && stat(crtpath, &statbuf) == 0 && S_ISDIR(statbuf.st_mode))
|
153
|
-
loaded = (git_mbedtls__set_cert_location(crtpath, 1) == 0);
|
154
|
-
|
155
|
-
git__on_shutdown(shutdown_ssl);
|
156
|
-
|
157
|
-
return 0;
|
158
|
-
|
159
|
-
cleanup:
|
160
|
-
mbedtls_ctr_drbg_free(ctr_drbg);
|
161
|
-
git__free(ctr_drbg);
|
162
|
-
mbedtls_ssl_config_free(git__ssl_conf);
|
163
|
-
git__free(git__ssl_conf);
|
164
|
-
git__ssl_conf = NULL;
|
165
|
-
|
166
|
-
return -1;
|
167
|
-
}
|
168
|
-
|
169
|
-
static int bio_read(void *b, unsigned char *buf, size_t len)
|
170
|
-
{
|
171
|
-
git_stream *io = (git_stream *) b;
|
172
|
-
return (int) git_stream_read(io, buf, min(len, INT_MAX));
|
173
|
-
}
|
174
|
-
|
175
|
-
static int bio_write(void *b, const unsigned char *buf, size_t len)
|
176
|
-
{
|
177
|
-
git_stream *io = (git_stream *) b;
|
178
|
-
return (int) git_stream_write(io, (const char *)buf, min(len, INT_MAX), 0);
|
179
|
-
}
|
180
|
-
|
181
|
-
static int ssl_set_error(mbedtls_ssl_context *ssl, int error)
|
182
|
-
{
|
183
|
-
char errbuf[512];
|
184
|
-
int ret = -1;
|
185
|
-
|
186
|
-
assert(error != MBEDTLS_ERR_SSL_WANT_READ);
|
187
|
-
assert(error != MBEDTLS_ERR_SSL_WANT_WRITE);
|
188
|
-
|
189
|
-
if (error != 0)
|
190
|
-
mbedtls_strerror( error, errbuf, 512 );
|
191
|
-
|
192
|
-
switch(error) {
|
193
|
-
case 0:
|
194
|
-
git_error_set(GIT_ERROR_SSL, "SSL error: unknown error");
|
195
|
-
break;
|
196
|
-
|
197
|
-
case MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:
|
198
|
-
git_error_set(GIT_ERROR_SSL, "SSL error: %#04x [%x] - %s", error, ssl->session_negotiate->verify_result, errbuf);
|
199
|
-
ret = GIT_ECERTIFICATE;
|
200
|
-
break;
|
201
|
-
|
202
|
-
default:
|
203
|
-
git_error_set(GIT_ERROR_SSL, "SSL error: %#04x - %s", error, errbuf);
|
204
|
-
}
|
205
|
-
|
206
|
-
return ret;
|
207
|
-
}
|
208
|
-
|
209
|
-
static int ssl_teardown(mbedtls_ssl_context *ssl)
|
210
|
-
{
|
211
|
-
int ret = 0;
|
212
|
-
|
213
|
-
ret = mbedtls_ssl_close_notify(ssl);
|
214
|
-
if (ret < 0)
|
215
|
-
ret = ssl_set_error(ssl, ret);
|
216
|
-
|
217
|
-
mbedtls_ssl_free(ssl);
|
218
|
-
return ret;
|
219
|
-
}
|
220
|
-
|
221
|
-
static int verify_server_cert(mbedtls_ssl_context *ssl)
|
222
|
-
{
|
223
|
-
int ret = -1;
|
224
|
-
|
225
|
-
if ((ret = mbedtls_ssl_get_verify_result(ssl)) != 0) {
|
226
|
-
char vrfy_buf[512];
|
227
|
-
int len = mbedtls_x509_crt_verify_info(vrfy_buf, sizeof(vrfy_buf), "", ret);
|
228
|
-
if (len >= 1) vrfy_buf[len - 1] = '\0'; /* Remove trailing \n */
|
229
|
-
git_error_set(GIT_ERROR_SSL, "the SSL certificate is invalid: %#04x - %s", ret, vrfy_buf);
|
230
|
-
return GIT_ECERTIFICATE;
|
231
|
-
}
|
232
|
-
|
233
|
-
return 0;
|
234
|
-
}
|
235
|
-
|
236
|
-
typedef struct {
|
237
|
-
git_stream parent;
|
238
|
-
git_stream *io;
|
239
|
-
int owned;
|
240
|
-
bool connected;
|
241
|
-
char *host;
|
242
|
-
mbedtls_ssl_context *ssl;
|
243
|
-
git_cert_x509 cert_info;
|
244
|
-
} mbedtls_stream;
|
245
|
-
|
246
|
-
|
247
|
-
static int mbedtls_connect(git_stream *stream)
|
248
|
-
{
|
249
|
-
int ret;
|
250
|
-
mbedtls_stream *st = (mbedtls_stream *) stream;
|
251
|
-
|
252
|
-
if (st->owned && (ret = git_stream_connect(st->io)) < 0)
|
253
|
-
return ret;
|
254
|
-
|
255
|
-
st->connected = true;
|
256
|
-
|
257
|
-
mbedtls_ssl_set_hostname(st->ssl, st->host);
|
258
|
-
|
259
|
-
mbedtls_ssl_set_bio(st->ssl, st->io, bio_write, bio_read, NULL);
|
260
|
-
|
261
|
-
if ((ret = mbedtls_ssl_handshake(st->ssl)) != 0)
|
262
|
-
return ssl_set_error(st->ssl, ret);
|
263
|
-
|
264
|
-
return verify_server_cert(st->ssl);
|
265
|
-
}
|
266
|
-
|
267
|
-
static int mbedtls_certificate(git_cert **out, git_stream *stream)
|
268
|
-
{
|
269
|
-
unsigned char *encoded_cert;
|
270
|
-
mbedtls_stream *st = (mbedtls_stream *) stream;
|
271
|
-
|
272
|
-
const mbedtls_x509_crt *cert = mbedtls_ssl_get_peer_cert(st->ssl);
|
273
|
-
if (!cert) {
|
274
|
-
git_error_set(GIT_ERROR_SSL, "the server did not provide a certificate");
|
275
|
-
return -1;
|
276
|
-
}
|
277
|
-
|
278
|
-
/* Retrieve the length of the certificate first */
|
279
|
-
if (cert->raw.len == 0) {
|
280
|
-
git_error_set(GIT_ERROR_NET, "failed to retrieve certificate information");
|
281
|
-
return -1;
|
282
|
-
}
|
283
|
-
|
284
|
-
encoded_cert = git__malloc(cert->raw.len);
|
285
|
-
GIT_ERROR_CHECK_ALLOC(encoded_cert);
|
286
|
-
memcpy(encoded_cert, cert->raw.p, cert->raw.len);
|
287
|
-
|
288
|
-
st->cert_info.parent.cert_type = GIT_CERT_X509;
|
289
|
-
st->cert_info.data = encoded_cert;
|
290
|
-
st->cert_info.len = cert->raw.len;
|
291
|
-
|
292
|
-
*out = &st->cert_info.parent;
|
293
|
-
|
294
|
-
return 0;
|
295
|
-
}
|
296
|
-
|
297
|
-
static int mbedtls_set_proxy(git_stream *stream, const git_proxy_options *proxy_options)
|
298
|
-
{
|
299
|
-
mbedtls_stream *st = (mbedtls_stream *) stream;
|
300
|
-
|
301
|
-
return git_stream_set_proxy(st->io, proxy_options);
|
302
|
-
}
|
303
|
-
|
304
|
-
static ssize_t mbedtls_stream_write(git_stream *stream, const char *data, size_t len, int flags)
|
305
|
-
{
|
306
|
-
mbedtls_stream *st = (mbedtls_stream *) stream;
|
307
|
-
int written;
|
308
|
-
|
309
|
-
GIT_UNUSED(flags);
|
310
|
-
|
311
|
-
/*
|
312
|
-
* `mbedtls_ssl_write` can only represent INT_MAX bytes
|
313
|
-
* written via its return value. We thus need to clamp
|
314
|
-
* the maximum number of bytes written.
|
315
|
-
*/
|
316
|
-
len = min(len, INT_MAX);
|
317
|
-
|
318
|
-
if ((written = mbedtls_ssl_write(st->ssl, (const unsigned char *)data, len)) <= 0)
|
319
|
-
return ssl_set_error(st->ssl, written);
|
320
|
-
|
321
|
-
return written;
|
322
|
-
}
|
323
|
-
|
324
|
-
static ssize_t mbedtls_stream_read(git_stream *stream, void *data, size_t len)
|
325
|
-
{
|
326
|
-
mbedtls_stream *st = (mbedtls_stream *) stream;
|
327
|
-
int ret;
|
328
|
-
|
329
|
-
if ((ret = mbedtls_ssl_read(st->ssl, (unsigned char *)data, len)) <= 0)
|
330
|
-
ssl_set_error(st->ssl, ret);
|
331
|
-
|
332
|
-
return ret;
|
333
|
-
}
|
334
|
-
|
335
|
-
static int mbedtls_stream_close(git_stream *stream)
|
336
|
-
{
|
337
|
-
mbedtls_stream *st = (mbedtls_stream *) stream;
|
338
|
-
int ret = 0;
|
339
|
-
|
340
|
-
if (st->connected && (ret = ssl_teardown(st->ssl)) != 0)
|
341
|
-
return -1;
|
342
|
-
|
343
|
-
st->connected = false;
|
344
|
-
|
345
|
-
return st->owned ? git_stream_close(st->io) : 0;
|
346
|
-
}
|
347
|
-
|
348
|
-
static void mbedtls_stream_free(git_stream *stream)
|
349
|
-
{
|
350
|
-
mbedtls_stream *st = (mbedtls_stream *) stream;
|
351
|
-
|
352
|
-
if (st->owned)
|
353
|
-
git_stream_free(st->io);
|
354
|
-
|
355
|
-
git__free(st->host);
|
356
|
-
git__free(st->cert_info.data);
|
357
|
-
mbedtls_ssl_free(st->ssl);
|
358
|
-
git__free(st->ssl);
|
359
|
-
git__free(st);
|
360
|
-
}
|
361
|
-
|
362
|
-
static int mbedtls_stream_wrap(
|
363
|
-
git_stream **out,
|
364
|
-
git_stream *in,
|
365
|
-
const char *host,
|
366
|
-
int owned)
|
367
|
-
{
|
368
|
-
mbedtls_stream *st;
|
369
|
-
int error;
|
370
|
-
|
371
|
-
st = git__calloc(1, sizeof(mbedtls_stream));
|
372
|
-
GIT_ERROR_CHECK_ALLOC(st);
|
373
|
-
|
374
|
-
st->io = in;
|
375
|
-
st->owned = owned;
|
376
|
-
|
377
|
-
st->ssl = git__malloc(sizeof(mbedtls_ssl_context));
|
378
|
-
GIT_ERROR_CHECK_ALLOC(st->ssl);
|
379
|
-
mbedtls_ssl_init(st->ssl);
|
380
|
-
if (mbedtls_ssl_setup(st->ssl, git__ssl_conf)) {
|
381
|
-
git_error_set(GIT_ERROR_SSL, "failed to create ssl object");
|
382
|
-
error = -1;
|
383
|
-
goto out_err;
|
384
|
-
}
|
385
|
-
|
386
|
-
st->host = git__strdup(host);
|
387
|
-
GIT_ERROR_CHECK_ALLOC(st->host);
|
388
|
-
|
389
|
-
st->parent.version = GIT_STREAM_VERSION;
|
390
|
-
st->parent.encrypted = 1;
|
391
|
-
st->parent.proxy_support = git_stream_supports_proxy(st->io);
|
392
|
-
st->parent.connect = mbedtls_connect;
|
393
|
-
st->parent.certificate = mbedtls_certificate;
|
394
|
-
st->parent.set_proxy = mbedtls_set_proxy;
|
395
|
-
st->parent.read = mbedtls_stream_read;
|
396
|
-
st->parent.write = mbedtls_stream_write;
|
397
|
-
st->parent.close = mbedtls_stream_close;
|
398
|
-
st->parent.free = mbedtls_stream_free;
|
399
|
-
|
400
|
-
*out = (git_stream *) st;
|
401
|
-
return 0;
|
402
|
-
|
403
|
-
out_err:
|
404
|
-
mbedtls_ssl_free(st->ssl);
|
405
|
-
git_stream_close(st->io);
|
406
|
-
git_stream_free(st->io);
|
407
|
-
git__free(st);
|
408
|
-
|
409
|
-
return error;
|
410
|
-
}
|
411
|
-
|
412
|
-
int git_mbedtls_stream_wrap(
|
413
|
-
git_stream **out,
|
414
|
-
git_stream *in,
|
415
|
-
const char *host)
|
416
|
-
{
|
417
|
-
return mbedtls_stream_wrap(out, in, host, 0);
|
418
|
-
}
|
419
|
-
|
420
|
-
int git_mbedtls_stream_new(
|
421
|
-
git_stream **out,
|
422
|
-
const char *host,
|
423
|
-
const char *port)
|
424
|
-
{
|
425
|
-
git_stream *stream;
|
426
|
-
int error;
|
427
|
-
|
428
|
-
assert(out && host && port);
|
429
|
-
|
430
|
-
if ((error = git_socket_stream_new(&stream, host, port)) < 0)
|
431
|
-
return error;
|
432
|
-
|
433
|
-
if ((error = mbedtls_stream_wrap(out, stream, host, 1)) < 0) {
|
434
|
-
git_stream_close(stream);
|
435
|
-
git_stream_free(stream);
|
436
|
-
}
|
437
|
-
|
438
|
-
return error;
|
439
|
-
}
|
440
|
-
|
441
|
-
int git_mbedtls__set_cert_location(const char *path, int is_dir)
|
442
|
-
{
|
443
|
-
int ret = 0;
|
444
|
-
char errbuf[512];
|
445
|
-
mbedtls_x509_crt *cacert;
|
446
|
-
|
447
|
-
assert(path != NULL);
|
448
|
-
|
449
|
-
cacert = git__malloc(sizeof(mbedtls_x509_crt));
|
450
|
-
GIT_ERROR_CHECK_ALLOC(cacert);
|
451
|
-
|
452
|
-
mbedtls_x509_crt_init(cacert);
|
453
|
-
if (is_dir) {
|
454
|
-
ret = mbedtls_x509_crt_parse_path(cacert, path);
|
455
|
-
} else {
|
456
|
-
ret = mbedtls_x509_crt_parse_file(cacert, path);
|
457
|
-
}
|
458
|
-
/* mbedtls_x509_crt_parse_path returns the number of invalid certs on success */
|
459
|
-
if (ret < 0) {
|
460
|
-
mbedtls_x509_crt_free(cacert);
|
461
|
-
git__free(cacert);
|
462
|
-
mbedtls_strerror( ret, errbuf, 512 );
|
463
|
-
git_error_set(GIT_ERROR_SSL, "failed to load CA certificates: %#04x - %s", ret, errbuf);
|
464
|
-
return -1;
|
465
|
-
}
|
466
|
-
|
467
|
-
mbedtls_x509_crt_free(git__ssl_conf->ca_chain);
|
468
|
-
git__free(git__ssl_conf->ca_chain);
|
469
|
-
mbedtls_ssl_conf_ca_chain(git__ssl_conf, cacert, NULL);
|
470
|
-
|
471
|
-
return 0;
|
472
|
-
}
|
473
|
-
|
474
|
-
#else
|
475
|
-
|
476
|
-
#include "stream.h"
|
477
|
-
|
478
|
-
int git_mbedtls_stream_global_init(void)
|
479
|
-
{
|
480
|
-
return 0;
|
481
|
-
}
|
482
|
-
|
483
|
-
#endif
|