summaryrefslogtreecommitdiffstats
path: root/source/web
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-03-17 12:31:43 +0000
committerAndrew Tridgell <tridge@samba.org>1998-03-17 12:31:43 +0000
commita776058900a727591bd7b69debdaa25c0e31d693 (patch)
tree8d6879eed9d3b6059469dd7a3f70c67b516e0e99 /source/web
parent4488d8932fa072bf8a3ae236ab666618051b5e83 (diff)
downloadsamba-a776058900a727591bd7b69debdaa25c0e31d693.tar.gz
samba-a776058900a727591bd7b69debdaa25c0e31d693.tar.xz
samba-a776058900a727591bd7b69debdaa25c0e31d693.zip
this isn't a big commit, it just looks like it :-)
I needed the client_name() and client_addr() functions in swat so I could tell who was connecting from where. The problem was that these functions didn't take a file descriptor parameter they just used the global "Client". So I needed to change all calls to pass a parameter ... lots of files.
Diffstat (limited to 'source/web')
-rw-r--r--source/web/cgi.c21
-rw-r--r--source/web/swat.c1
2 files changed, 22 insertions, 0 deletions
diff --git a/source/web/cgi.c b/source/web/cgi.c
index 46654b1303d..9931ca14688 100644
--- a/source/web/cgi.c
+++ b/source/web/cgi.c
@@ -665,3 +665,24 @@ char *cgi_pathinfo(void)
return r;
}
+/***************************************************************************
+return the hostname of the client
+ ***************************************************************************/
+char *cgi_remote_host(void)
+{
+ if (baseurl) {
+ return client_name(1);
+ }
+ return getenv("REMOTE_HOST");
+}
+
+/***************************************************************************
+return the hostname of the client
+ ***************************************************************************/
+char *cgi_remote_addr(void)
+{
+ if (baseurl) {
+ return client_addr(1);
+ }
+ return getenv("REMOTE_ADDR");
+}
diff --git a/source/web/swat.c b/source/web/swat.c
index a41249a9eef..7378cf682bc 100644
--- a/source/web/swat.c
+++ b/source/web/swat.c
@@ -172,6 +172,7 @@ static void show_parameters(int snum, int allparameters, int advanced, int print
static void write_config(FILE *f, BOOL show_defaults)
{
fprintf(f, "# Samba config file created using SWAT\n");
+ fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr());
fprintf(f, "# Date: %s\n\n", timestring());
lp_dump(f, show_defaults);