summaryrefslogtreecommitdiff
path: root/usr.bin/bgplg
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2016-04-05 21:57:59 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2016-04-05 21:57:59 +0000
commit08c198a9ec701745367bca4b550ce44b71640369 (patch)
treed3c71f64fc1b5efeb81e8c07e1f017d85e4a423f /usr.bin/bgplg
parent9c9a3471c3ebf497bee9fd16ac3581c335429165 (diff)
Use SERVER_NAME for bgplg's hostname (displayed on the page), this is passed
from the webserver so is more likely to be the correct name to expose, and is easier to adjust if needed. OK claudio@ florian@
Diffstat (limited to 'usr.bin/bgplg')
-rw-r--r--usr.bin/bgplg/bgplg.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/bgplg/bgplg.c b/usr.bin/bgplg/bgplg.c
index 9d1019a17c6..fa1fb361168 100644
--- a/usr.bin/bgplg/bgplg.c
+++ b/usr.bin/bgplg/bgplg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgplg.c,v 1.15 2015/12/09 17:52:24 mmcc Exp $ */
+/* $OpenBSD: bgplg.c,v 1.16 2016/04/05 21:57:58 sthen Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -245,9 +245,8 @@ lg_incl(const char *file)
int
main(void)
{
- char *query, *self, *cmd = NULL, *req;
+ char *query, *myname, *self, *cmd = NULL, *req;
char **argv = NULL;
- char myname[HOST_NAME_MAX+1];
int ret = 1, argc = 0, query_length = 0;
struct stat st;
u_int i;
@@ -256,7 +255,7 @@ main(void)
if (pledge("stdio rpath proc exec", NULL) == -1)
err(1, "pledge");
- if (gethostname(myname, sizeof(myname)) != 0)
+ if ((myname = lg_getenv("SERVER_NAME", NULL)) == NULL)
return (1);
printf("Content-Type: %s\n"