summaryrefslogtreecommitdiff
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #6326 from libgit2/ethomson/url_parseEdward Thomson2022-11-232-84/+332
|\ | | | | URL parsing for google-compatible URLs
| * url: only allow @s in usernames for ssh urlsEdward Thomson2022-06-171-3/+10
| | | | | | | | | | | | Enforce the RFC for other protocols; Google's questionable choices about malformed SSH protocols shouldn't impact our ability to properly parse HTTPS.
| * url_parse: introduce our own url parsingEdward Thomson2022-06-172-84/+325
| | | | | | | | | | Provide our own url parser, so that we can handle Google Code's "fun" URLs that have a userinfo with an `@` in it. :cry:
* | Merge pull request #6382 from csware/fix_mem_leakEdward Thomson2022-09-191-3/+3
|\ \ | | | | | | Fix memory leak
| * | Fix memory leakSven Strickroth2022-08-141-3/+3
| | | | | | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | | Update src/util/rand.cEdward Thomson2022-09-191-1/+1
| | |
* | | fix compile on Windows with -DWIN32_LEAN_AND_MEANChristoph Cullmann2022-08-081-0/+4
|/ / | | | | | | ensure the needed wincrypt.h is included
* | Merge pull request #6191 from libgit2/ethomson/sha256_pocEdward Thomson2022-07-133-3/+69
|\ \ | | | | | | RFC: SHA256 proof of concept
| * | sha256: make sha256 an experimental optional featureEdward Thomson2022-06-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 can be built with optional, experimental sha256 support. This allows consumers to begin testing and providing feedback for our sha256 support while we continue to develop it, and allows us to make API breaking changes while we iterate on a final sha256 implementation. The results will be `git2-experimental.dll` and installed as `git2-experimental.h` to avoid confusion with a production libgit2.
| * | meta: generated `features.h` is now `git2_features.h`Edward Thomson2022-06-203-3/+67
| |/ | | | | | | | | Linux has a /usr/include/features.h, which gets confusing; update this to `git2_features.h` and move it into the `util` directory.
* | repo: allow users running with sudo to access their repositoriesEdward Thomson2022-07-122-15/+43
| | | | | | | | | | | | | | | | In the ownership checks implemented for CVE-2022-24765, we disallowed users to access their own repositories when running with `sudo`. Examine the `SUDO_UID` environment variable and allow users running with `sudo`. This matches git's behavior.
* | fs: allow ownership match if user is in admin groupEdward Thomson2022-07-072-7/+26
| | | | | | | | | | | | Allow the user ownership to match if the file is owned by the admin group and the user is in the admin group, even if the current process is not running as administrator directly.
* | fs: refactor file ownership checksEdward Thomson2022-07-072-102/+49
| | | | | | | | | | Refactor the file ownership checks so that callers can provide discrete information about the ownership expectations to a single function.
* | fs: remove mock naming from change ownership constantsEdward Thomson2022-07-072-18/+31
|/ | | | | | The file ownership concepts can reflect the actual file ownership, they are not necessarily limited to mocking the interface. Rename them so that they can be more broadly applicable.
* cmake: only use `getloadavg` where it existsEdward Thomson2022-06-131-2/+6
|
* fs_path: mock ownership checksEdward Thomson2022-04-112-0/+56
| | | | Provide a mock for file ownership for testability.
* fs_path: refactor ownership checks into current user and systemEdward Thomson2022-04-112-63/+186
| | | | | | Provide individual file ownership checks for both the current user and the system user, as well as a combined current user and system user check.
* sha256: support dynamically loaded opensslEdward Thomson2022-04-043-3/+97
|
* sha: cast nonsense for obnoxious gcc warningsEdward Thomson2022-03-231-7/+7
| | | | | gcc (mingw) warns when you cast the result of `GetProcAddress`; cast the results to `void *` before casting them to the actual result.
* sha: ensure we test both cng and cryptoapi on windowsEdward Thomson2022-03-232-0/+28
| | | | | When GIT_SHA1_WIN32 or GIT_SHA256_WIN32 is used, ensure that we test both CryptoNG ("cng") and CryptoAPI.
* sha: support Win32 for SHA256Edward Thomson2022-03-233-192/+314
| | | | | Adding SHA256 support prompted an overdue refactoring of some of the unnecessary complexity around the CNG/CryptoAPI abstraction.
* sha: support OpenSSL for SHA256Edward Thomson2022-03-234-4/+73
|
* sha: support mbedTLS for SHA256Edward Thomson2022-03-233-1/+59
|
* sha: support CommonCrypto for SHA256Edward Thomson2022-03-234-10/+84
|
* sha: add sha256 algorithmEdward Thomson2022-03-238-9/+1084
| | | | | Add support for a SHA256 hash algorithm, and add the "builtin" SHA256 hash engine (from RFC 6234).
* sha: GIT_ERROR_SHA1 is deprecated in favor of GIT_ERROR_SHAEdward Thomson2022-03-233-6/+6
| | | | The more generic GIT_ERROR_SHA allows for SHA256 errors as well as SHA1.
* sha1: refactor folder structureEdward Thomson2022-03-2317-29/+31
| | | | | Eliminate the `sha1` folder, move it down into `hash` so that future impelmentations can share common code.
* sha1: remove generic implementationEdward Thomson2022-03-234-325/+2
| | | | | | Remove the "generic" implementation; it should never be used; it only existed for a no-dependencies configuration, and our bundled sha1dc satisfies that requirement _and_ is correct.
* fs_path: exit quickly in `dirname_r` failureEdward Thomson2022-02-271-6/+4
| | | | | | When we encounter a situation where we need to exit, simply `return -1` instead of trying to set `len = -1` and then jumping to the exit handler, which would erroneously do work based on the `len` value.
* assert: add `ASSERT_WITH_CLEANUP`Edward Thomson2022-02-271-0/+16
| | | | | | Now that we safely assert and return, we may need to be in a place where we need to unlock mutexes or cleanup resources. Provide `ASSERT_WITH_CLEANUP` that permits for this behavior by taking a block.
* futils: produce improved error messagesEdward Thomson2022-02-261-1/+7
|
* futils: provide an option to read a whole file by fdEdward Thomson2022-02-262-0/+37
|
* cmake: document CMakeLists.txt hierarchyEdward Thomson2022-02-221-0/+1
|
* refactor: make util an object libraryEdward Thomson2022-02-22113-0/+25260
Instead of simply including the utility files directly, make them a cmake object library for easy reusability between other projects within libgit2. Now the top-level `src` is responsible for platform selection, while the next-level `libgit2` and `util` configurations are responsible for identifying what objects they include.