Skip to content

Commit f51f664

Browse files
committed
Revert "repo: allow administrator to own the configuration"
This reverts commit cdff2f0. This change erroneously allowed system users to own a worktree; this should only be allowed when the current user is in the Administrator group on Windows as well.
1 parent 92ffdd2 commit f51f664

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/libgit2/repository.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static int validate_ownership(const char *repo_path)
512512
bool is_safe;
513513
int error;
514514

515-
if ((error = git_fs_path_owner_is_system_or_current_user(&is_safe, repo_path)) < 0) {
515+
if ((error = git_fs_path_owner_is_current_user(&is_safe, repo_path)) < 0) {
516516
if (error == GIT_ENOTFOUND)
517517
error = 0;
518518

tests/libgit2/repo/open.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,9 @@ void test_repo_open__validates_dir_ownership(void)
484484
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
485485
git_repository_free(repo);
486486

487-
/* When the system user owns the repo config, also acceptable */
487+
/* When the system user owns the repo config, fail */
488488
git_fs_path__set_owner(GIT_FS_PATH_MOCK_OWNER_SYSTEM);
489-
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
490-
git_repository_free(repo);
489+
cl_git_fail(git_repository_open(&repo, "empty_standard_repo"));
491490

492491
/* When an unknown user owns the repo config, fail */
493492
git_fs_path__set_owner(GIT_FS_PATH_MOCK_OWNER_OTHER);

0 commit comments

Comments
 (0)