rugged 0.28.4 → 0.28.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +0 -1
- data/vendor/libgit2/CMakeLists.txt +16 -36
- data/vendor/libgit2/COPYING +0 -28
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
- 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/http_parser.c +6 -11
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -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/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +7 -0
- data/vendor/libgit2/include/git2.h +0 -2
- data/vendor/libgit2/include/git2/apply.h +2 -22
- data/vendor/libgit2/include/git2/attr.h +12 -19
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +12 -44
- data/vendor/libgit2/include/git2/buffer.h +14 -20
- data/vendor/libgit2/include/git2/checkout.h +14 -46
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +1 -23
- data/vendor/libgit2/include/git2/common.h +5 -7
- data/vendor/libgit2/include/git2/config.h +12 -12
- data/vendor/libgit2/include/git2/deprecated.h +3 -243
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +14 -16
- data/vendor/libgit2/include/git2/filter.h +0 -8
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/indexer.h +4 -48
- data/vendor/libgit2/include/git2/inttypes.h +309 -0
- data/vendor/libgit2/include/git2/merge.h +10 -6
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/object.h +14 -2
- data/vendor/libgit2/include/git2/odb.h +2 -3
- data/vendor/libgit2/include/git2/odb_backend.h +4 -5
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +1 -12
- data/vendor/libgit2/include/git2/proxy.h +3 -5
- data/vendor/libgit2/include/git2/rebase.h +2 -46
- data/vendor/libgit2/include/git2/refs.h +0 -19
- data/vendor/libgit2/include/git2/remote.h +12 -35
- data/vendor/libgit2/include/git2/repository.h +2 -24
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +16 -25
- data/vendor/libgit2/include/git2/submodule.h +3 -20
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
- data/vendor/libgit2/include/git2/sys/repository.h +1 -5
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +2 -2
- data/vendor/libgit2/include/git2/tag.h +2 -11
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +340 -11
- data/vendor/libgit2/include/git2/tree.h +1 -1
- data/vendor/libgit2/include/git2/types.h +89 -4
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/libgit2.pc.in +13 -0
- data/vendor/libgit2/src/CMakeLists.txt +222 -88
- data/vendor/libgit2/src/alloc.c +14 -2
- data/vendor/libgit2/src/apply.c +30 -60
- data/vendor/libgit2/src/attr.c +64 -70
- data/vendor/libgit2/src/attr_file.c +96 -189
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +46 -44
- data/vendor/libgit2/src/attrcache.h +1 -2
- data/vendor/libgit2/src/blame.c +5 -17
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +7 -21
- data/vendor/libgit2/src/blob.c +17 -81
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +5 -29
- data/vendor/libgit2/src/buffer.c +7 -14
- data/vendor/libgit2/src/cache.c +33 -26
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +0 -5
- data/vendor/libgit2/src/checkout.c +16 -26
- data/vendor/libgit2/src/cherrypick.c +3 -9
- data/vendor/libgit2/src/clone.c +7 -29
- data/vendor/libgit2/src/clone.h +0 -4
- data/vendor/libgit2/src/commit.c +21 -69
- data/vendor/libgit2/src/commit.h +0 -6
- data/vendor/libgit2/src/commit_list.c +76 -28
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +75 -3
- data/vendor/libgit2/src/config.c +40 -31
- data/vendor/libgit2/src/config.h +6 -7
- data/vendor/libgit2/src/config_backend.h +0 -12
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +99 -69
- data/vendor/libgit2/src/config_entries.h +0 -1
- data/vendor/libgit2/src/config_file.c +380 -337
- data/vendor/libgit2/src/config_mem.c +16 -12
- data/vendor/libgit2/src/config_parse.c +29 -49
- data/vendor/libgit2/src/config_parse.h +12 -13
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +20 -21
- data/vendor/libgit2/src/diff.c +58 -43
- data/vendor/libgit2/src/diff.h +1 -2
- data/vendor/libgit2/src/diff_driver.c +38 -37
- data/vendor/libgit2/src/diff_file.c +7 -9
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +85 -135
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +1 -1
- data/vendor/libgit2/src/diff_print.c +13 -25
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +4 -4
- data/vendor/libgit2/src/errors.c +22 -12
- data/vendor/libgit2/src/features.h.in +2 -9
- data/vendor/libgit2/src/fetch.c +2 -7
- data/vendor/libgit2/src/fetchhead.c +1 -1
- data/vendor/libgit2/src/filebuf.c +10 -6
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
- data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
- data/vendor/libgit2/src/filter.c +8 -16
- data/vendor/libgit2/src/fnmatch.c +248 -0
- data/vendor/libgit2/src/fnmatch.h +48 -0
- data/vendor/libgit2/src/global.c +40 -12
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/hash.c +0 -61
- data/vendor/libgit2/src/hash.h +21 -19
- data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
- data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
- data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
- data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
- data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
- data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
- data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
- data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
- 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 +1 -1
- data/vendor/libgit2/src/idxmap.c +65 -91
- data/vendor/libgit2/src/idxmap.h +15 -151
- data/vendor/libgit2/src/ignore.c +38 -32
- data/vendor/libgit2/src/index.c +43 -66
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +70 -69
- data/vendor/libgit2/src/integer.h +4 -39
- data/vendor/libgit2/src/iterator.c +22 -27
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +44 -58
- data/vendor/libgit2/src/merge_driver.c +4 -4
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +23 -18
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/netops.c +165 -55
- data/vendor/libgit2/src/netops.h +25 -3
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/object.c +2 -2
- data/vendor/libgit2/src/object.h +0 -2
- data/vendor/libgit2/src/odb.c +23 -41
- data/vendor/libgit2/src/odb.h +2 -3
- data/vendor/libgit2/src/odb_loose.c +10 -17
- data/vendor/libgit2/src/odb_mempack.c +23 -10
- data/vendor/libgit2/src/odb_pack.c +4 -4
- data/vendor/libgit2/src/offmap.c +55 -43
- data/vendor/libgit2/src/offmap.h +24 -102
- data/vendor/libgit2/src/oid.c +1 -6
- data/vendor/libgit2/src/oidmap.c +57 -39
- data/vendor/libgit2/src/oidmap.h +19 -99
- data/vendor/libgit2/src/pack-objects.c +32 -25
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +47 -45
- data/vendor/libgit2/src/pack.h +14 -12
- data/vendor/libgit2/src/parse.c +0 -10
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +31 -124
- data/vendor/libgit2/src/path.c +6 -43
- data/vendor/libgit2/src/path.h +0 -2
- data/vendor/libgit2/src/pathspec.c +13 -13
- data/vendor/libgit2/src/pool.c +22 -26
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +1 -12
- data/vendor/libgit2/src/proxy.c +2 -7
- data/vendor/libgit2/src/push.c +5 -10
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +7 -66
- data/vendor/libgit2/src/refdb.c +0 -12
- data/vendor/libgit2/src/refdb_fs.c +165 -214
- data/vendor/libgit2/src/reflog.c +13 -11
- data/vendor/libgit2/src/refs.c +18 -24
- data/vendor/libgit2/src/refspec.c +16 -9
- data/vendor/libgit2/src/remote.c +52 -50
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +100 -115
- data/vendor/libgit2/src/repository.h +40 -49
- data/vendor/libgit2/src/revert.c +3 -8
- data/vendor/libgit2/src/revparse.c +19 -18
- data/vendor/libgit2/src/revwalk.c +30 -63
- data/vendor/libgit2/src/revwalk.h +0 -20
- data/vendor/libgit2/src/settings.c +0 -5
- data/vendor/libgit2/src/sortedcache.c +26 -12
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +65 -45
- data/vendor/libgit2/src/status.c +9 -15
- data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
- data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
- data/vendor/libgit2/src/streams/openssl.c +0 -20
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +84 -37
- data/vendor/libgit2/src/strmap.h +33 -105
- data/vendor/libgit2/src/submodule.c +70 -102
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +1 -11
- data/vendor/libgit2/src/tag.c +2 -10
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +32 -46
- data/vendor/libgit2/src/transaction.c +9 -10
- data/vendor/libgit2/src/transports/auth.c +9 -10
- data/vendor/libgit2/src/transports/auth.h +4 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/cred.c +6 -6
- data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
- data/vendor/libgit2/src/transports/git.c +16 -11
- data/vendor/libgit2/src/transports/http.c +276 -419
- data/vendor/libgit2/src/transports/http.h +1 -1
- data/vendor/libgit2/src/transports/local.c +9 -9
- data/vendor/libgit2/src/transports/smart.c +17 -17
- data/vendor/libgit2/src/transports/smart.h +2 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
- data/vendor/libgit2/src/transports/ssh.c +36 -46
- data/vendor/libgit2/src/transports/winhttp.c +207 -231
- data/vendor/libgit2/src/tree-cache.c +7 -14
- data/vendor/libgit2/src/tree.c +24 -10
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +11 -1
- data/vendor/libgit2/src/userdiff.h +1 -3
- data/vendor/libgit2/src/util.c +53 -51
- data/vendor/libgit2/src/util.h +21 -16
- data/vendor/libgit2/src/win32/map.c +5 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -12
- data/vendor/libgit2/src/win32/path_w32.h +29 -0
- data/vendor/libgit2/src/win32/posix.h +4 -1
- data/vendor/libgit2/src/win32/posix_w32.c +5 -40
- 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 +3 -7
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
- data/vendor/libgit2/src/win32/w32_stack.c +9 -4
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +0 -31
- data/vendor/libgit2/src/win32/w32_util.h +32 -6
- data/vendor/libgit2/src/worktree.c +22 -36
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
- data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
- metadata +34 -98
- 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/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/include/git2/cert.h +0 -135
- data/vendor/libgit2/include/git2/cred.h +0 -308
- data/vendor/libgit2/include/git2/sys/cred.h +0 -90
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- 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.h +0 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
- data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
- data/vendor/libgit2/src/net.c +0 -184
- data/vendor/libgit2/src/net.h +0 -36
- data/vendor/libgit2/src/regexp.c +0 -221
- data/vendor/libgit2/src/regexp.h +0 -97
- 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/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,223 +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 "git2.h"
|
|
9
|
-
#include "common.h"
|
|
10
|
-
#include "buffer.h"
|
|
11
|
-
#include "auth.h"
|
|
12
|
-
#include "auth_ntlm.h"
|
|
13
|
-
#include "git2/sys/cred.h"
|
|
14
|
-
|
|
15
|
-
#ifdef GIT_NTLM
|
|
16
|
-
|
|
17
|
-
#include "ntlm.h"
|
|
18
|
-
|
|
19
|
-
typedef struct {
|
|
20
|
-
git_http_auth_context parent;
|
|
21
|
-
ntlm_client *ntlm;
|
|
22
|
-
char *challenge;
|
|
23
|
-
bool complete;
|
|
24
|
-
} http_auth_ntlm_context;
|
|
25
|
-
|
|
26
|
-
static int ntlm_set_challenge(
|
|
27
|
-
git_http_auth_context *c,
|
|
28
|
-
const char *challenge)
|
|
29
|
-
{
|
|
30
|
-
http_auth_ntlm_context *ctx = (http_auth_ntlm_context *)c;
|
|
31
|
-
|
|
32
|
-
assert(ctx && challenge);
|
|
33
|
-
|
|
34
|
-
git__free(ctx->challenge);
|
|
35
|
-
|
|
36
|
-
ctx->challenge = git__strdup(challenge);
|
|
37
|
-
GIT_ERROR_CHECK_ALLOC(ctx->challenge);
|
|
38
|
-
|
|
39
|
-
return 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
static int ntlm_set_credentials(http_auth_ntlm_context *ctx, git_cred *_cred)
|
|
43
|
-
{
|
|
44
|
-
git_cred_userpass_plaintext *cred;
|
|
45
|
-
const char *sep, *username;
|
|
46
|
-
char *domain = NULL, *domainuser = NULL;
|
|
47
|
-
int error = 0;
|
|
48
|
-
|
|
49
|
-
assert(_cred->credtype == GIT_CREDTYPE_USERPASS_PLAINTEXT);
|
|
50
|
-
cred = (git_cred_userpass_plaintext *)_cred;
|
|
51
|
-
|
|
52
|
-
if ((sep = strchr(cred->username, '\\')) != NULL) {
|
|
53
|
-
domain = strndup(cred->username, (sep - cred->username));
|
|
54
|
-
GIT_ERROR_CHECK_ALLOC(domain);
|
|
55
|
-
|
|
56
|
-
domainuser = strdup(sep + 1);
|
|
57
|
-
GIT_ERROR_CHECK_ALLOC(domainuser);
|
|
58
|
-
|
|
59
|
-
username = domainuser;
|
|
60
|
-
} else {
|
|
61
|
-
username = cred->username;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (ntlm_client_set_credentials(ctx->ntlm,
|
|
65
|
-
username, domain, cred->password) < 0) {
|
|
66
|
-
git_error_set(GIT_ERROR_NET, "could not set credentials: %s",
|
|
67
|
-
ntlm_client_errmsg(ctx->ntlm));
|
|
68
|
-
error = -1;
|
|
69
|
-
goto done;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
done:
|
|
73
|
-
git__free(domain);
|
|
74
|
-
git__free(domainuser);
|
|
75
|
-
return error;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
static int ntlm_next_token(
|
|
79
|
-
git_buf *buf,
|
|
80
|
-
git_http_auth_context *c,
|
|
81
|
-
git_cred *cred)
|
|
82
|
-
{
|
|
83
|
-
http_auth_ntlm_context *ctx = (http_auth_ntlm_context *)c;
|
|
84
|
-
git_buf input_buf = GIT_BUF_INIT;
|
|
85
|
-
const unsigned char *msg;
|
|
86
|
-
size_t challenge_len, msg_len;
|
|
87
|
-
int error = -1;
|
|
88
|
-
|
|
89
|
-
assert(buf && ctx && ctx->ntlm);
|
|
90
|
-
|
|
91
|
-
challenge_len = ctx->challenge ? strlen(ctx->challenge) : 0;
|
|
92
|
-
|
|
93
|
-
if (ctx->complete)
|
|
94
|
-
ntlm_client_reset(ctx->ntlm);
|
|
95
|
-
|
|
96
|
-
/*
|
|
97
|
-
* Set us complete now since it's the default case; the one
|
|
98
|
-
* incomplete case (successfully created a client request)
|
|
99
|
-
* will explicitly set that it requires a second step.
|
|
100
|
-
*/
|
|
101
|
-
ctx->complete = true;
|
|
102
|
-
|
|
103
|
-
if (cred && ntlm_set_credentials(ctx, cred) != 0)
|
|
104
|
-
goto done;
|
|
105
|
-
|
|
106
|
-
if (challenge_len < 4) {
|
|
107
|
-
git_error_set(GIT_ERROR_NET, "no ntlm challenge sent from server");
|
|
108
|
-
goto done;
|
|
109
|
-
} else if (challenge_len == 4) {
|
|
110
|
-
if (memcmp(ctx->challenge, "NTLM", 4) != 0) {
|
|
111
|
-
git_error_set(GIT_ERROR_NET, "server did not request NTLM");
|
|
112
|
-
goto done;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (ntlm_client_negotiate(&msg, &msg_len, ctx->ntlm) != 0) {
|
|
116
|
-
git_error_set(GIT_ERROR_NET, "ntlm authentication failed: %s",
|
|
117
|
-
ntlm_client_errmsg(ctx->ntlm));
|
|
118
|
-
goto done;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
ctx->complete = false;
|
|
122
|
-
} else {
|
|
123
|
-
if (memcmp(ctx->challenge, "NTLM ", 5) != 0) {
|
|
124
|
-
git_error_set(GIT_ERROR_NET, "challenge from server was not NTLM");
|
|
125
|
-
goto done;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (git_buf_decode_base64(&input_buf,
|
|
129
|
-
ctx->challenge + 5, challenge_len - 5) < 0) {
|
|
130
|
-
git_error_set(GIT_ERROR_NET, "invalid NTLM challenge from server");
|
|
131
|
-
goto done;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (ntlm_client_set_challenge(ctx->ntlm,
|
|
135
|
-
(const unsigned char *)input_buf.ptr, input_buf.size) != 0) {
|
|
136
|
-
git_error_set(GIT_ERROR_NET, "ntlm challenge failed: %s",
|
|
137
|
-
ntlm_client_errmsg(ctx->ntlm));
|
|
138
|
-
goto done;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (ntlm_client_response(&msg, &msg_len, ctx->ntlm) != 0) {
|
|
142
|
-
git_error_set(GIT_ERROR_NET, "ntlm authentication failed: %s",
|
|
143
|
-
ntlm_client_errmsg(ctx->ntlm));
|
|
144
|
-
goto done;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
git_buf_puts(buf, "NTLM ");
|
|
149
|
-
git_buf_encode_base64(buf, (const char *)msg, msg_len);
|
|
150
|
-
|
|
151
|
-
if (git_buf_oom(buf))
|
|
152
|
-
goto done;
|
|
153
|
-
|
|
154
|
-
error = 0;
|
|
155
|
-
|
|
156
|
-
done:
|
|
157
|
-
git_buf_dispose(&input_buf);
|
|
158
|
-
return error;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
static int ntlm_is_complete(git_http_auth_context *c)
|
|
162
|
-
{
|
|
163
|
-
http_auth_ntlm_context *ctx = (http_auth_ntlm_context *)c;
|
|
164
|
-
|
|
165
|
-
assert(ctx);
|
|
166
|
-
return (ctx->complete == true);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
static void ntlm_context_free(git_http_auth_context *c)
|
|
170
|
-
{
|
|
171
|
-
http_auth_ntlm_context *ctx = (http_auth_ntlm_context *)c;
|
|
172
|
-
|
|
173
|
-
ntlm_client_free(ctx->ntlm);
|
|
174
|
-
git__free(ctx->challenge);
|
|
175
|
-
git__free(ctx);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
static int ntlm_init_context(
|
|
179
|
-
http_auth_ntlm_context *ctx,
|
|
180
|
-
const git_net_url *url)
|
|
181
|
-
{
|
|
182
|
-
GIT_UNUSED(url);
|
|
183
|
-
|
|
184
|
-
if ((ctx->ntlm = ntlm_client_init(NTLM_CLIENT_DEFAULTS)) == NULL) {
|
|
185
|
-
git_error_set_oom();
|
|
186
|
-
return -1;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return 0;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
int git_http_auth_ntlm(
|
|
193
|
-
git_http_auth_context **out,
|
|
194
|
-
const git_net_url *url)
|
|
195
|
-
{
|
|
196
|
-
http_auth_ntlm_context *ctx;
|
|
197
|
-
|
|
198
|
-
GIT_UNUSED(url);
|
|
199
|
-
|
|
200
|
-
*out = NULL;
|
|
201
|
-
|
|
202
|
-
ctx = git__calloc(1, sizeof(http_auth_ntlm_context));
|
|
203
|
-
GIT_ERROR_CHECK_ALLOC(ctx);
|
|
204
|
-
|
|
205
|
-
if (ntlm_init_context(ctx, url) < 0) {
|
|
206
|
-
git__free(ctx);
|
|
207
|
-
return -1;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
ctx->parent.type = GIT_AUTHTYPE_NTLM;
|
|
211
|
-
ctx->parent.credtypes = GIT_CREDTYPE_USERPASS_PLAINTEXT;
|
|
212
|
-
ctx->parent.connection_affinity = 1;
|
|
213
|
-
ctx->parent.set_challenge = ntlm_set_challenge;
|
|
214
|
-
ctx->parent.next_token = ntlm_next_token;
|
|
215
|
-
ctx->parent.is_complete = ntlm_is_complete;
|
|
216
|
-
ctx->parent.free = ntlm_context_free;
|
|
217
|
-
|
|
218
|
-
*out = (git_http_auth_context *)ctx;
|
|
219
|
-
|
|
220
|
-
return 0;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
#endif /* GIT_NTLM */
|
|
@@ -1,35 +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_transports_auth_ntlm_h__
|
|
9
|
-
#define INCLUDE_transports_auth_ntlm_h__
|
|
10
|
-
|
|
11
|
-
#include "git2.h"
|
|
12
|
-
#include "auth.h"
|
|
13
|
-
|
|
14
|
-
#ifdef GIT_NTLM
|
|
15
|
-
|
|
16
|
-
#if defined(GIT_OPENSSL)
|
|
17
|
-
# define CRYPT_OPENSSL
|
|
18
|
-
#elif defined(GIT_MBEDTLS)
|
|
19
|
-
# define CRYPT_MBEDTLS
|
|
20
|
-
#elif defined(GIT_SECURE_TRANSPORT)
|
|
21
|
-
# define CRYPT_COMMONCRYPTO
|
|
22
|
-
#endif
|
|
23
|
-
|
|
24
|
-
extern int git_http_auth_ntlm(
|
|
25
|
-
git_http_auth_context **out,
|
|
26
|
-
const git_net_url *url);
|
|
27
|
-
|
|
28
|
-
#else
|
|
29
|
-
|
|
30
|
-
#define git_http_auth_ntlm git_http_auth_dummy
|
|
31
|
-
|
|
32
|
-
#endif /* GIT_NTLM */
|
|
33
|
-
|
|
34
|
-
#endif
|
|
35
|
-
|
|
@@ -1,320 +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
|
-
* Do shell-style pattern matching for ?, \, [], and * characters.
|
|
8
|
-
* It is 8bit clean.
|
|
9
|
-
*
|
|
10
|
-
* Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
|
11
|
-
* Rich $alz is now <rsalz@bbn.com>.
|
|
12
|
-
*
|
|
13
|
-
* Modified by Wayne Davison to special-case '/' matching, to make '**'
|
|
14
|
-
* work differently than '*', and to fix the character-class code.
|
|
15
|
-
*
|
|
16
|
-
* Imported from git.git.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
#include "wildmatch.h"
|
|
20
|
-
|
|
21
|
-
#define GIT_SPACE 0x01
|
|
22
|
-
#define GIT_DIGIT 0x02
|
|
23
|
-
#define GIT_ALPHA 0x04
|
|
24
|
-
#define GIT_GLOB_SPECIAL 0x08
|
|
25
|
-
#define GIT_REGEX_SPECIAL 0x10
|
|
26
|
-
#define GIT_PATHSPEC_MAGIC 0x20
|
|
27
|
-
#define GIT_CNTRL 0x40
|
|
28
|
-
#define GIT_PUNCT 0x80
|
|
29
|
-
|
|
30
|
-
enum {
|
|
31
|
-
S = GIT_SPACE,
|
|
32
|
-
A = GIT_ALPHA,
|
|
33
|
-
D = GIT_DIGIT,
|
|
34
|
-
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
|
|
35
|
-
R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
|
|
36
|
-
P = GIT_PATHSPEC_MAGIC, /* other non-alnum, except for ] and } */
|
|
37
|
-
X = GIT_CNTRL,
|
|
38
|
-
U = GIT_PUNCT,
|
|
39
|
-
Z = GIT_CNTRL | GIT_SPACE
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
static const unsigned char sane_ctype[256] = {
|
|
43
|
-
X, X, X, X, X, X, X, X, X, Z, Z, X, X, Z, X, X, /* 0.. 15 */
|
|
44
|
-
X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 16.. 31 */
|
|
45
|
-
S, P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */
|
|
46
|
-
D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */
|
|
47
|
-
P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
|
|
48
|
-
A, A, A, A, A, A, A, A, A, A, A, G, G, U, R, P, /* 80.. 95 */
|
|
49
|
-
P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
|
|
50
|
-
A, A, A, A, A, A, A, A, A, A, A, R, R, U, P, X, /* 112..127 */
|
|
51
|
-
/* Nothing in the 128.. range */
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
|
|
55
|
-
#define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
|
|
56
|
-
|
|
57
|
-
typedef unsigned char uchar;
|
|
58
|
-
|
|
59
|
-
/* What character marks an inverted character class? */
|
|
60
|
-
#define NEGATE_CLASS '!'
|
|
61
|
-
#define NEGATE_CLASS2 '^'
|
|
62
|
-
|
|
63
|
-
#define CC_EQ(class, len, litmatch) ((len) == sizeof (litmatch)-1 \
|
|
64
|
-
&& *(class) == *(litmatch) \
|
|
65
|
-
&& strncmp((char*)class, litmatch, len) == 0)
|
|
66
|
-
|
|
67
|
-
#if defined STDC_HEADERS || !defined isascii
|
|
68
|
-
# define ISASCII(c) 1
|
|
69
|
-
#else
|
|
70
|
-
# define ISASCII(c) isascii(c)
|
|
71
|
-
#endif
|
|
72
|
-
|
|
73
|
-
#ifdef isblank
|
|
74
|
-
# define ISBLANK(c) (ISASCII(c) && isblank(c))
|
|
75
|
-
#else
|
|
76
|
-
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
|
77
|
-
#endif
|
|
78
|
-
|
|
79
|
-
#ifdef isgraph
|
|
80
|
-
# define ISGRAPH(c) (ISASCII(c) && isgraph(c))
|
|
81
|
-
#else
|
|
82
|
-
# define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c))
|
|
83
|
-
#endif
|
|
84
|
-
|
|
85
|
-
#define ISPRINT(c) (ISASCII(c) && isprint(c))
|
|
86
|
-
#define ISDIGIT(c) (ISASCII(c) && isdigit(c))
|
|
87
|
-
#define ISALNUM(c) (ISASCII(c) && isalnum(c))
|
|
88
|
-
#define ISALPHA(c) (ISASCII(c) && isalpha(c))
|
|
89
|
-
#define ISCNTRL(c) (ISASCII(c) && iscntrl(c))
|
|
90
|
-
#define ISLOWER(c) (ISASCII(c) && islower(c))
|
|
91
|
-
#define ISPUNCT(c) (ISASCII(c) && ispunct(c))
|
|
92
|
-
#define ISSPACE(c) (ISASCII(c) && isspace(c))
|
|
93
|
-
#define ISUPPER(c) (ISASCII(c) && isupper(c))
|
|
94
|
-
#define ISXDIGIT(c) (ISASCII(c) && isxdigit(c))
|
|
95
|
-
|
|
96
|
-
/* Match pattern "p" against "text" */
|
|
97
|
-
static int dowild(const uchar *p, const uchar *text, unsigned int flags)
|
|
98
|
-
{
|
|
99
|
-
uchar p_ch;
|
|
100
|
-
const uchar *pattern = p;
|
|
101
|
-
|
|
102
|
-
for ( ; (p_ch = *p) != '\0'; text++, p++) {
|
|
103
|
-
int matched, match_slash, negated;
|
|
104
|
-
uchar t_ch, prev_ch;
|
|
105
|
-
if ((t_ch = *text) == '\0' && p_ch != '*')
|
|
106
|
-
return WM_ABORT_ALL;
|
|
107
|
-
if ((flags & WM_CASEFOLD) && ISUPPER(t_ch))
|
|
108
|
-
t_ch = tolower(t_ch);
|
|
109
|
-
if ((flags & WM_CASEFOLD) && ISUPPER(p_ch))
|
|
110
|
-
p_ch = tolower(p_ch);
|
|
111
|
-
switch (p_ch) {
|
|
112
|
-
case '\\':
|
|
113
|
-
/* Literal match with following character. Note that the test
|
|
114
|
-
* in "default" handles the p[1] == '\0' failure case. */
|
|
115
|
-
p_ch = *++p;
|
|
116
|
-
/* FALLTHROUGH */
|
|
117
|
-
default:
|
|
118
|
-
if (t_ch != p_ch)
|
|
119
|
-
return WM_NOMATCH;
|
|
120
|
-
continue;
|
|
121
|
-
case '?':
|
|
122
|
-
/* Match anything but '/'. */
|
|
123
|
-
if ((flags & WM_PATHNAME) && t_ch == '/')
|
|
124
|
-
return WM_NOMATCH;
|
|
125
|
-
continue;
|
|
126
|
-
case '*':
|
|
127
|
-
if (*++p == '*') {
|
|
128
|
-
const uchar *prev_p = p - 2;
|
|
129
|
-
while (*++p == '*') {}
|
|
130
|
-
if (!(flags & WM_PATHNAME))
|
|
131
|
-
/* without WM_PATHNAME, '*' == '**' */
|
|
132
|
-
match_slash = 1;
|
|
133
|
-
else if ((prev_p < pattern || *prev_p == '/') &&
|
|
134
|
-
(*p == '\0' || *p == '/' ||
|
|
135
|
-
(p[0] == '\\' && p[1] == '/'))) {
|
|
136
|
-
/*
|
|
137
|
-
* Assuming we already match 'foo/' and are at
|
|
138
|
-
* <star star slash>, just assume it matches
|
|
139
|
-
* nothing and go ahead match the rest of the
|
|
140
|
-
* pattern with the remaining string. This
|
|
141
|
-
* helps make foo/<*><*>/bar (<> because
|
|
142
|
-
* otherwise it breaks C comment syntax) match
|
|
143
|
-
* both foo/bar and foo/a/bar.
|
|
144
|
-
*/
|
|
145
|
-
if (p[0] == '/' &&
|
|
146
|
-
dowild(p + 1, text, flags) == WM_MATCH)
|
|
147
|
-
return WM_MATCH;
|
|
148
|
-
match_slash = 1;
|
|
149
|
-
} else /* WM_PATHNAME is set */
|
|
150
|
-
match_slash = 0;
|
|
151
|
-
} else
|
|
152
|
-
/* without WM_PATHNAME, '*' == '**' */
|
|
153
|
-
match_slash = flags & WM_PATHNAME ? 0 : 1;
|
|
154
|
-
if (*p == '\0') {
|
|
155
|
-
/* Trailing "**" matches everything. Trailing "*" matches
|
|
156
|
-
* only if there are no more slash characters. */
|
|
157
|
-
if (!match_slash) {
|
|
158
|
-
if (strchr((char*)text, '/') != NULL)
|
|
159
|
-
return WM_NOMATCH;
|
|
160
|
-
}
|
|
161
|
-
return WM_MATCH;
|
|
162
|
-
} else if (!match_slash && *p == '/') {
|
|
163
|
-
/*
|
|
164
|
-
* _one_ asterisk followed by a slash
|
|
165
|
-
* with WM_PATHNAME matches the next
|
|
166
|
-
* directory
|
|
167
|
-
*/
|
|
168
|
-
const char *slash = strchr((char*)text, '/');
|
|
169
|
-
if (!slash)
|
|
170
|
-
return WM_NOMATCH;
|
|
171
|
-
text = (const uchar*)slash;
|
|
172
|
-
/* the slash is consumed by the top-level for loop */
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
while (1) {
|
|
176
|
-
if (t_ch == '\0')
|
|
177
|
-
break;
|
|
178
|
-
/*
|
|
179
|
-
* Try to advance faster when an asterisk is
|
|
180
|
-
* followed by a literal. We know in this case
|
|
181
|
-
* that the string before the literal
|
|
182
|
-
* must belong to "*".
|
|
183
|
-
* If match_slash is false, do not look past
|
|
184
|
-
* the first slash as it cannot belong to '*'.
|
|
185
|
-
*/
|
|
186
|
-
if (!is_glob_special(*p)) {
|
|
187
|
-
p_ch = *p;
|
|
188
|
-
if ((flags & WM_CASEFOLD) && ISUPPER(p_ch))
|
|
189
|
-
p_ch = tolower(p_ch);
|
|
190
|
-
while ((t_ch = *text) != '\0' &&
|
|
191
|
-
(match_slash || t_ch != '/')) {
|
|
192
|
-
if ((flags & WM_CASEFOLD) && ISUPPER(t_ch))
|
|
193
|
-
t_ch = tolower(t_ch);
|
|
194
|
-
if (t_ch == p_ch)
|
|
195
|
-
break;
|
|
196
|
-
text++;
|
|
197
|
-
}
|
|
198
|
-
if (t_ch != p_ch)
|
|
199
|
-
return WM_NOMATCH;
|
|
200
|
-
}
|
|
201
|
-
if ((matched = dowild(p, text, flags)) != WM_NOMATCH) {
|
|
202
|
-
if (!match_slash || matched != WM_ABORT_TO_STARSTAR)
|
|
203
|
-
return matched;
|
|
204
|
-
} else if (!match_slash && t_ch == '/')
|
|
205
|
-
return WM_ABORT_TO_STARSTAR;
|
|
206
|
-
t_ch = *++text;
|
|
207
|
-
}
|
|
208
|
-
return WM_ABORT_ALL;
|
|
209
|
-
case '[':
|
|
210
|
-
p_ch = *++p;
|
|
211
|
-
#ifdef NEGATE_CLASS2
|
|
212
|
-
if (p_ch == NEGATE_CLASS2)
|
|
213
|
-
p_ch = NEGATE_CLASS;
|
|
214
|
-
#endif
|
|
215
|
-
/* Assign literal 1/0 because of "matched" comparison. */
|
|
216
|
-
negated = p_ch == NEGATE_CLASS ? 1 : 0;
|
|
217
|
-
if (negated) {
|
|
218
|
-
/* Inverted character class. */
|
|
219
|
-
p_ch = *++p;
|
|
220
|
-
}
|
|
221
|
-
prev_ch = 0;
|
|
222
|
-
matched = 0;
|
|
223
|
-
do {
|
|
224
|
-
if (!p_ch)
|
|
225
|
-
return WM_ABORT_ALL;
|
|
226
|
-
if (p_ch == '\\') {
|
|
227
|
-
p_ch = *++p;
|
|
228
|
-
if (!p_ch)
|
|
229
|
-
return WM_ABORT_ALL;
|
|
230
|
-
if (t_ch == p_ch)
|
|
231
|
-
matched = 1;
|
|
232
|
-
} else if (p_ch == '-' && prev_ch && p[1] && p[1] != ']') {
|
|
233
|
-
p_ch = *++p;
|
|
234
|
-
if (p_ch == '\\') {
|
|
235
|
-
p_ch = *++p;
|
|
236
|
-
if (!p_ch)
|
|
237
|
-
return WM_ABORT_ALL;
|
|
238
|
-
}
|
|
239
|
-
if (t_ch <= p_ch && t_ch >= prev_ch)
|
|
240
|
-
matched = 1;
|
|
241
|
-
else if ((flags & WM_CASEFOLD) && ISLOWER(t_ch)) {
|
|
242
|
-
uchar t_ch_upper = toupper(t_ch);
|
|
243
|
-
if (t_ch_upper <= p_ch && t_ch_upper >= prev_ch)
|
|
244
|
-
matched = 1;
|
|
245
|
-
}
|
|
246
|
-
p_ch = 0; /* This makes "prev_ch" get set to 0. */
|
|
247
|
-
} else if (p_ch == '[' && p[1] == ':') {
|
|
248
|
-
const uchar *s;
|
|
249
|
-
int i;
|
|
250
|
-
for (s = p += 2; (p_ch = *p) && p_ch != ']'; p++) {} /*SHARED ITERATOR*/
|
|
251
|
-
if (!p_ch)
|
|
252
|
-
return WM_ABORT_ALL;
|
|
253
|
-
i = (int)(p - s - 1);
|
|
254
|
-
if (i < 0 || p[-1] != ':') {
|
|
255
|
-
/* Didn't find ":]", so treat like a normal set. */
|
|
256
|
-
p = s - 2;
|
|
257
|
-
p_ch = '[';
|
|
258
|
-
if (t_ch == p_ch)
|
|
259
|
-
matched = 1;
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
if (CC_EQ(s,i, "alnum")) {
|
|
263
|
-
if (ISALNUM(t_ch))
|
|
264
|
-
matched = 1;
|
|
265
|
-
} else if (CC_EQ(s,i, "alpha")) {
|
|
266
|
-
if (ISALPHA(t_ch))
|
|
267
|
-
matched = 1;
|
|
268
|
-
} else if (CC_EQ(s,i, "blank")) {
|
|
269
|
-
if (ISBLANK(t_ch))
|
|
270
|
-
matched = 1;
|
|
271
|
-
} else if (CC_EQ(s,i, "cntrl")) {
|
|
272
|
-
if (ISCNTRL(t_ch))
|
|
273
|
-
matched = 1;
|
|
274
|
-
} else if (CC_EQ(s,i, "digit")) {
|
|
275
|
-
if (ISDIGIT(t_ch))
|
|
276
|
-
matched = 1;
|
|
277
|
-
} else if (CC_EQ(s,i, "graph")) {
|
|
278
|
-
if (ISGRAPH(t_ch))
|
|
279
|
-
matched = 1;
|
|
280
|
-
} else if (CC_EQ(s,i, "lower")) {
|
|
281
|
-
if (ISLOWER(t_ch))
|
|
282
|
-
matched = 1;
|
|
283
|
-
} else if (CC_EQ(s,i, "print")) {
|
|
284
|
-
if (ISPRINT(t_ch))
|
|
285
|
-
matched = 1;
|
|
286
|
-
} else if (CC_EQ(s,i, "punct")) {
|
|
287
|
-
if (ISPUNCT(t_ch))
|
|
288
|
-
matched = 1;
|
|
289
|
-
} else if (CC_EQ(s,i, "space")) {
|
|
290
|
-
if (ISSPACE(t_ch))
|
|
291
|
-
matched = 1;
|
|
292
|
-
} else if (CC_EQ(s,i, "upper")) {
|
|
293
|
-
if (ISUPPER(t_ch))
|
|
294
|
-
matched = 1;
|
|
295
|
-
else if ((flags & WM_CASEFOLD) && ISLOWER(t_ch))
|
|
296
|
-
matched = 1;
|
|
297
|
-
} else if (CC_EQ(s,i, "xdigit")) {
|
|
298
|
-
if (ISXDIGIT(t_ch))
|
|
299
|
-
matched = 1;
|
|
300
|
-
} else /* malformed [:class:] string */
|
|
301
|
-
return WM_ABORT_ALL;
|
|
302
|
-
p_ch = 0; /* This makes "prev_ch" get set to 0. */
|
|
303
|
-
} else if (t_ch == p_ch)
|
|
304
|
-
matched = 1;
|
|
305
|
-
} while (prev_ch = p_ch, (p_ch = *++p) != ']');
|
|
306
|
-
if (matched == negated ||
|
|
307
|
-
((flags & WM_PATHNAME) && t_ch == '/'))
|
|
308
|
-
return WM_NOMATCH;
|
|
309
|
-
continue;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return *text ? WM_NOMATCH : WM_MATCH;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/* Match the "pattern" against the "text" string. */
|
|
317
|
-
int wildmatch(const char *pattern, const char *text, unsigned int flags)
|
|
318
|
-
{
|
|
319
|
-
return dowild((const uchar*)pattern, (const uchar*)text, flags);
|
|
320
|
-
}
|