From 08c198a9ec701745367bca4b550ce44b71640369 Mon Sep 17 00:00:00 2001 From: Stuart Henderson Date: Tue, 5 Apr 2016 21:57:59 +0000 Subject: 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@ --- usr.bin/bgplg/bgplg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'usr.bin/bgplg') 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 @@ -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" -- cgit v1.2.3