diff options
| author | Junio C Hamano <gitster@pobox.com> | 2014-03-14 14:27:02 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2014-03-14 14:27:03 -0700 |
| commit | d552f8df1b2749b58e386dff98027c64f35cdbd1 (patch) | |
| tree | 36dedb20c44f081e8d50a3459b520c861d52c51c /archive.c | |
| parent | c89eb9870e474b0717d6e11f0ddb8b73cef520af (diff) | |
| parent | 7671b63211712e5163ed46d4c93d0b75680c886c (diff) | |
| download | git-d552f8df1b2749b58e386dff98027c64f35cdbd1.tar.gz | |
Merge branch 'sg/archive-restrict-remote'
Allow loosening remote "git archive" invocation security check that
refuses to serve tree-ish not at the tip of any ref.
* sg/archive-restrict-remote:
add uploadarchive.allowUnreachable option
docs: clarify remote restrictions for git-upload-archive
Diffstat (limited to 'archive.c')
| -rw-r--r-- | archive.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -17,6 +17,7 @@ static char const * const archive_usage[] = { static const struct archiver **archivers; static int nr_archivers; static int alloc_archivers; +static int remote_allow_unreachable; void register_archiver(struct archiver *ar) { @@ -257,7 +258,7 @@ static void parse_treeish_arg(const char **argv, unsigned char sha1[20]; /* Remotes are only allowed to fetch actual refs */ - if (remote) { + if (remote && !remote_allow_unreachable) { char *ref = NULL; const char *colon = strchr(name, ':'); int refnamelen = colon ? colon - name : strlen(name); @@ -401,6 +402,14 @@ static int parse_archive_args(int argc, const char **argv, return argc; } +static int git_default_archive_config(const char *var, const char *value, + void *cb) +{ + if (!strcmp(var, "uploadarchive.allowunreachable")) + remote_allow_unreachable = git_config_bool(var, value); + return git_default_config(var, value, cb); +} + int write_archive(int argc, const char **argv, const char *prefix, int setup_prefix, const char *name_hint, int remote) { @@ -411,7 +420,7 @@ int write_archive(int argc, const char **argv, const char *prefix, if (setup_prefix && prefix == NULL) prefix = setup_git_directory_gently(&nongit); - git_config(git_default_config, NULL); + git_config(git_default_archive_config, NULL); init_tar_archiver(); init_zip_archiver(); |
