commit - 42f1746c38435ed85794eb6e852c7cb8349c2e1bc0ba36efa273593cd0a996d0
commit + c1478e141b04168ea1c07b9c2a57cb7285fa40e380d62134130e96a51808b5f1
blob - 2ee3dfdb80347c3504b81c8f0b37fc4b422ecf3e19dd10168aaffc473ef48cef
blob + c7fb6bf962cfdc8b47d61a8bbea8f51147a94a9e1cd607cd2ac57ffcbb6a5a01
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
struct gotwebd_repo *repo;
enum gotwebd_auth_config auth_config = 0;
enum gotwebd_access access = GOTWEBD_ACCESS_DENIED;
+ int repo_is_hidden = 0;
*rp = calloc(1, sizeof(**rp));
if (*rp == NULL)
repo = gotweb_get_repository(srv, repo_dir->name);
if (repo) {
+ repo_is_hidden = repo->hidden;
auth_config = repo->auth_config;
switch (auth_config) {
case GOTWEBD_AUTH_DISABLED:
break;
}
} else {
+ repo_is_hidden = srv->hide_repositories;
auth_config = srv->auth_config;
switch (auth_config) {
case GOTWEBD_AUTH_DISABLED:
goto err;
}
+ if (repo_is_hidden) {
+ error = got_error_path(repo_dir->name, GOT_ERR_NOT_GIT_REPO);
+ goto err;
+ }
+
if (srv->respect_exportok &&
faccessat(dirfd(dt), "git-daemon-export-ok", F_OK, 0) == -1) {
error = got_error_path(repo_dir->name, GOT_ERR_NOT_GIT_REPO);
blob - c54281b7e1431d559e7f0766605c4de7766ed7ac433df1d17013f79badb15b67
blob + ddb7c7b887ac519fb319476594caab11ad58e2de6068e64f853f0fb0e580e87d
--- gotwebd/gotwebd.conf.5
+++ gotwebd/gotwebd.conf.5
.It Ic disable authentication
Disable authentication, allowing any browser to view any repository
not hidden via the
+.Ic hide repositories ,
+.Ic hide repository ,
+or
.Ic respect_exportok
-directive.
+directives.
Authentication is disabled by default.
.It Ic enable authentication Oo Ic insecure Oc
Enable authentication, requiring browsers to present a login token cookie
.It Ic disable authentication
Disable authentication for this server, allowing any browser to view any
repository not hidden via the
+.Ic hide repositories ,
+.Ic hide repository ,
+or
.Ic respect_exportok
-directive.
+directives.
Authentication can also configured on a per-repository basis.
.Pp
If not specified, the global configuration context determines
.Pp
If not specified, the global configuration context determines
whether authentication is enabled.
+.It Ic hide repositories Ar on | off
+Controls whether repositories are hidden by default.
+Hidden repositories cannot be browsed via
+.Xr gotwebd 8 .
+.Pp
+By default,
+.Ic hide repositories
+is set to
+.Ar off
+and all repositories found in the
+.Ic repos_path
+will be displayed.
+.Pp
+If
+.Ic hide repositories
+is set to
+.Ar on
+then a repository will only be displayed if its repository-specific
+.Ic hide repository
+parameter is set to
+.Ar off .
+Repositories will be hidden regardless of whether authentication is
+enabled and has failed or succeeded.
.It Ic logo_url Ar url
Set a hyperlink for the logo.
Defaults to
.Pp
If not specified, the server context or global context determines
whether authentication is enabled.
+.It Ic hide repository Ar on | off
+Controls whether the repository is hidden.
+Hidden repositories cannot be browsed via
+.Xr gotwebd 8 .
+.Pp
+If not set, the server context's
+.Ic hide repositories
+parameter determines whether
+.Xr gotwebd 8
+will display the repository.
.El
.It Ic respect_exportok Ar on | off
Set whether to display the repository only if it contains the magic
blob - 0c0f16b319cec8a70a41fbde3956ee28c716b0ac9c5fe3107280b688186c7e4a
blob + 2d16de8dd022bf5683672653b1c563790f7335a4e1816394e854da294b577acb
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
#define D_SHOWDESC 1
#define D_SHOWURL 1
#define D_RESPECTEXPORTOK 0
+#define D_HIDE_REPOSITORIES 0
#define D_MAXREPODISP 25
#define D_MAXSLCOMMDISP 10
#define D_MAXCOMMITDISP 25
enum gotwebd_auth_config auth_config;
struct gotwebd_access_rule_list access_rules;
+
+ int hidden;
};
TAILQ_HEAD(gotwebd_repolist, gotwebd_repo);
int show_repo_description;
int show_repo_cloneurl;
int respect_exportok;
+ int hide_repositories;
enum gotwebd_auth_config auth_config;
struct gotwebd_access_rule_list access_rules;
blob - 5e1596b90d4107072ecdde102ce54db55e621961ba76384b89e6aa5bcf44e013
blob + 3112724f97a0b206e2fc35dcdab71fee3236b29718435f1aa29c2194ac539afb
--- gotwebd/parse.y
+++ gotwebd/parse.y
%token SHOW_SITE_OWNER SHOW_REPO_CLONEURL PORT PREFORK RESPECT_EXPORTOK
%token SERVER CHROOT CUSTOM_CSS SOCKET
%token SUMMARY_COMMITS_DISPLAY SUMMARY_TAGS_DISPLAY USER AUTHENTICATION
-%token ENABLE DISABLE INSECURE REPOSITORY PERMIT DENY
+%token ENABLE DISABLE INSECURE REPOSITORY REPOSITORIES PERMIT DENY HIDE
%token <v.string> STRING
%token <v.number> NUMBER
| RESPECT_EXPORTOK boolean {
new_srv->respect_exportok = $2;
}
+ | HIDE REPOSITORIES boolean {
+ new_srv->hide_repositories = $3;
+ }
| MAX_REPOS_DISPLAY NUMBER {
if ($2 < 0) {
yyerror("max_repos_display is too small: %lld",
conf_new_access_rule(&new_repo->access_rules,
GOTWEBD_ACCESS_DENIED, $2);
}
+ | HIDE REPOSITORY boolean {
+ new_repo->hidden = $3;
+ }
;
nl : '\n' optnl
{ "deny", DENY },
{ "disable", DISABLE },
{ "enable", ENABLE },
+ { "hide", HIDE },
{ "insecure", INSECURE },
{ "listen", LISTEN },
{ "login", GOTWEBD_LOGIN },
{ "port", PORT },
{ "prefork", PREFORK },
{ "repos_path", REPOS_PATH },
+ { "repositories", REPOSITORIES },
{ "repository", REPOSITORY },
{ "respect_exportok", RESPECT_EXPORTOK },
{ "server", SERVER },
break;
}
- /* Inherit implicit authentication config from parent scope. */
+ /* Inherit implicit authentication/hidden config from parent scope. */
TAILQ_FOREACH(srv, &env->servers, entry) {
if (srv->auth_config == 0)
srv->auth_config = env->auth_config;
TAILQ_FOREACH(repo, &srv->repos, entry) {
if (repo->auth_config == 0)
repo->auth_config = srv->auth_config;
+ if (repo->hidden == -1)
+ repo->hidden = srv->hide_repositories;
}
}
srv->show_repo_description = D_SHOWDESC;
srv->show_repo_cloneurl = D_SHOWURL;
srv->respect_exportok = D_RESPECTEXPORTOK;
+ srv->hide_repositories = D_HIDE_REPOSITORIES;
srv->max_repos_display = D_MAXREPODISP;
srv->max_commits_display = D_MAXCOMMITDISP;
if (repo == NULL)
fatal("gotwebd_new_repo");
+ repo->hidden = -1;
TAILQ_INSERT_TAIL(&server->repos, repo, entry);
return repo;
blob - ae1495129a39c474c3948c9530423f67096c121d2662165ca9b80bd3bb849422
blob + 2f0a4112e5f0fc9bf5a4ae560aeaa07eda0350beed3d96cbac1c021369273e7c
--- regress/gotsysd/Makefile
+++ regress/gotsysd/Makefile
@${UNPRIV} 'echo deny ${GOTSYSD_DEV_USER} >> $@'
@${UNPRIV} 'echo server \"VMIP\" { >> $@'
@${UNPRIV} 'echo \ \ repos_path \"/git\" >> $@'
+ @${UNPRIV} 'echo \ \ hide repositories on >> $@'
@${UNPRIV} 'echo \ \ show_repo_age off >> $@'
@${UNPRIV} 'echo \ \ show_repo_description off >> $@'
@${UNPRIV} 'echo \ \ show_repo_owner off >> $@'
@${UNPRIV} 'echo \ \ show_site_owner off >> $@'
@${UNPRIV} 'echo \ \ repository \"public\" { >> $@'
@${UNPRIV} 'echo \ \ \ \ disable authentication >> $@'
+ @${UNPRIV} 'echo \ \ \ \ hide repository off >> $@'
@${UNPRIV} 'echo \ \ } >> $@'
@${UNPRIV} 'echo \ \ repository \"gotdev\" { >> $@'
@${UNPRIV} 'echo \ \ \ \ permit ${GOTSYSD_DEV_USER} >> $@'
@${UNPRIV} 'echo \ \ \ \ deny ${GOTSYSD_TEST_USER} >> $@'
+ @${UNPRIV} 'echo \ \ \ \ hide repository off >> $@'
@${UNPRIV} 'echo \ \ } >> $@'
@${UNPRIV} 'echo \ \ repository \"gottest\" { >> $@'
@${UNPRIV} 'echo \ \ \ \ permit ${GOTSYSD_TEST_USER} >> $@'
@${UNPRIV} 'echo \ \ \ \ deny ${GOTSYSD_DEV_USER} >> $@'
+ @${UNPRIV} 'echo \ \ \ \ hide repository off >> $@'
@${UNPRIV} 'echo \ \ } >> $@'
+ @${UNPRIV} 'echo \ \ repository \"hidden\" { >> $@'
+ @${UNPRIV} 'echo \ \ \ \ permit ${GOTSYSD_TEST_USER} >> $@'
+ @${UNPRIV} 'echo \ \ \ \ deny ${GOTSYSD_DEV_USER} >> $@'
+ @${UNPRIV} 'echo \ \ } >> $@'
+ @${UNPRIV} 'echo \ \ repository \"gotsys\" { >> $@'
+ @${UNPRIV} 'echo \ \ \ \ hide repository off >> $@'
+ @${UNPRIV} 'echo \ \ } >> $@'
@${UNPRIV} 'echo } >> $@'
build_got:
VMIP="100.64.$$VMID.3"; \
GWIP="100.64.$$VMID.2"; \
${UNPRIV} "${GOTSYSD_SSH_CMD} root@$${VMIP} \
- 'rm -rf /git/gotsys.git /git/foo.git /tmp/gotsys'"; \
+ 'rm -rf /git/${GOTSYS_REPO} /git/{foo,hidden}.git /tmp/gotsys'"; \
${UNPRIV} "${GOTSYSD_SSH_CMD} root@$${VMIP} \
got init /git/${GOTSYS_REPO}"; \
+ ${UNPRIV} "${GOTSYSD_SSH_CMD} root@$${VMIP} \
+ got init /git/hidden.git"; \
${UNPRIV} "${GOTSYSD_SCP_CMD} \
${GOT_CONF} root@$${VMIP}:/git/${GOTSYS_REPO}/got.conf"; \
${UNPRIV} "${GOTSYSD_SSH_CMD} root@$${VMIP} mkdir /tmp/gotsys "; \