martin 98/01/26 10:24:40
Modified: . STATUS
htdocs/manual/mod core.html directives.html
src/main http_core.c http_core.h http_protocol.c httpd.h
src/modules/proxy proxy_ftp.c
src/modules/standard mod_autoindex.c mod_info.c mod_status.c
Log:
Server-generated pages can be server-signed now (new directive)
Revision Changes Path
1.130 +3 -4 apachen/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/apachen/STATUS,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -u -r1.129 -r1.130
--- STATUS 1998/01/26 16:46:05 1.129
+++ STATUS 1998/01/26 18:24:25 1.130
@@ -1,3 +1,5 @@
+
+
Apache 1.3 STATUS:
Release:
@@ -135,6 +137,7 @@
* more mod_mime_magic cleanup
* Add more compile time diagnosis to main's -V switch
* [Port] Fix CGI-Execution for EBCDIC hosts.
+ * Martin's [PATCH] "Signing" server generated pages
Available Patches:
@@ -142,10 +145,6 @@
* M.D.Parker's [PATCH] mod_status/1448: Status Information have version
<[EMAIL PROTECTED]>
Status: Dean +1, Martin +1, Alexei -1 (shared lib concerns)
-
- * Martin's [PATCH] "Signing" server generated pages
- <[EMAIL PROTECTED]>
- Status: Martin +1, Roy 0,
Concepts:
1.93 +27 -0 apachen/htdocs/manual/mod/core.html
Index: core.html
===================================================================
RCS file: /home/cvs/apachen/htdocs/manual/mod/core.html,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -u -r1.92 -r1.93
--- core.html 1998/01/26 16:54:02 1.92
+++ core.html 1998/01/26 18:24:26 1.93
@@ -74,6 +74,7 @@
<LI><A HREF="#servername">ServerName</A>
<LI><A HREF="#serverpath">ServerPath</A>
<LI><A HREF="#serverroot">ServerRoot</A>
+<LI><A HREF="#serversignature">ServerSignature</A>
<LI><A HREF="#servertype">ServerType</A>
<LI><A HREF="#startservers">StartServers</A>
<LI><A HREF="#threadsperchild">ThreadsPerChild</A>
@@ -1584,6 +1585,32 @@
See also <A HREF="../invoking.html">the <CODE>-d</CODE> option to
httpd</A>.<P>
See also <A HREF="../misc/security_tips.html#serverroot">the security
tips</A>
for information on how to properly set permissions on the ServerRoot.<P>
+
+<HR>
+
+<H2><A name="serversignature">ServerSignature directive</A></h2>
+<!--%plaintext <?INDEX {\tt ServerSignature} directive> -->
+<strong>Syntax:</strong> ServerSignature <em>Off | On | EMail</em><br>
+<strong>Default:</strong> <code>ServerSignature Off</code><br>
+<strong>Context:</strong> directory, .htaccess<br>
+<strong>Status:</strong> core<p>
+<strong>Compatibility:</strong> ServerSignature is only available in Apache
+1.3 and later.<p>
+
+The ServerSignature directive allows the configuration of a trailing
+footer line under server-generated documents (error messages,
+mod_proxy ftp directory listings, mod_info output, ...). The reason
+why you would want to enable such a footer line is that in a chain
+of proxies, the user often has no possibility to tell which of the
+chained servers actually produced a returned error message.<br>
+The <samp>Off</samp> setting, which is the default, suppresses the
+error line (and is therefore compatible with the behavior of
+Apache-1.2 and below). The <samp>On</samp> setting simply adds a
+line with the server version number and <A
+HREF="#servername">ServerName</A> of the serving virtual host, and
+the <samp>EMail</samp> setting additionally creates a "mailto:"
+reference to the <A HREF="#serveradmin">ServerAdmin</A> of the
+referenced document.
<HR>
1.37 +1 -0 apachen/htdocs/manual/mod/directives.html
Index: directives.html
===================================================================
RCS file: /home/cvs/apachen/htdocs/manual/mod/directives.html,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -u -r1.36 -r1.37
--- directives.html 1998/01/26 16:54:02 1.36
+++ directives.html 1998/01/26 18:24:27 1.37
@@ -180,6 +180,7 @@
<LI><A HREF="core.html#servername">ServerName</A>
<LI><A HREF="core.html#serverpath">ServerPath</A>
<LI><A HREF="core.html#serverroot">ServerRoot</A>
+<LI><A HREF="core.html#serversignature">ServerSignature</A>
<LI><A HREF="core.html#servertype">ServerType</A>
<LI><A HREF="mod_env.html#setenv">SetEnv</A>
<LI><A HREF="mod_setenvif.html#setenvif">SetEnvIf</A>
1.149 +39 -0 apachen/src/main/http_core.c
Index: http_core.c
===================================================================
RCS file: /home/cvs/apachen/src/main/http_core.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -u -r1.148 -r1.149
--- http_core.c 1998/01/26 16:46:09 1.148
+++ http_core.c 1998/01/26 18:24:31 1.149
@@ -1160,6 +1160,21 @@
return NULL;
}
+const char *set_signature_flag (cmd_parms *cmd, core_dir_config *d, char
*arg) {
+ const char *err = check_cmd_context(cmd, NOT_IN_LIMIT);
+ if (err != NULL) return err;
+
+ if (strcasecmp(arg, "On") == 0)
+ d->server_signature = srv_sig_on;
+ else if (strcasecmp(arg, "Off") == 0)
+ d->server_signature = srv_sig_off;
+ else if (strcasecmp(arg, "EMail") == 0)
+ d->server_signature = srv_sig_withmail;
+ else
+ return "ServerSignature: use one of: off | on | email";
+ return NULL;
+}
+
const char *set_send_buffer_size (cmd_parms *cmd, void *dummy, char *arg) {
int s = atoi (arg);
const char *err = check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1616,6 +1631,28 @@
return NULL;
}
+const char *psignature(const char *prefix, request_rec *r)
+{
+ char sport[20];
+ core_dir_config *conf =
+ (core_dir_config *) get_module_config(r->per_dir_config, &core_module);
+
+ if (conf->server_signature == srv_sig_off)
+ return "";
+
+ ap_snprintf(sport, sizeof sport, "%u", (unsigned) r->server->port);
+
+ if (conf->server_signature == srv_sig_withmail) {
+ return pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_BASEVERSION
+ " Server at <A HREF=\"mailto:", r->server->server_admin, "\">",
+ r->server->server_hostname, "</A> Port ", sport,
+ "</ADDRESS>\n", NULL);
+ }
+ return pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_BASEVERSION
+ " Server at ", r->server->server_hostname, "</A> Port ", sport,
+ "</ADDRESS>\n", NULL);
+}
+
/*
* Load an authorisation realm into our location configuration, applying the
* usual rules that apply to realms.
@@ -1686,6 +1723,8 @@
{ "ServerName", set_server_string_slot,
(void *)XtOffsetOf (server_rec, server_hostname), RSRC_CONF, TAKE1,
"The hostname of the server" },
+{ "ServerSignature", set_signature_flag, NULL, ACCESS_CONF|RSRC_CONF, TAKE1,
+ "En-/disable server signature (on|off|email)" },
{ "ServerRoot", set_server_root, NULL, RSRC_CONF, TAKE1, "Common directory
of server-related files (logs, confs, etc)" },
{ "ErrorLog", set_server_string_slot,
(void *)XtOffsetOf (server_rec, error_fname), RSRC_CONF, TAKE1,
1.33 +1 -0 apachen/src/main/http_core.h
Index: http_core.h
===================================================================
RCS file: /home/cvs/apachen/src/main/http_core.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -u -r1.32 -r1.33
--- http_core.h 1998/01/21 19:17:37 1.32
+++ http_core.h 1998/01/26 18:24:32 1.33
@@ -194,6 +194,7 @@
#endif
/* logging options */
+ enum { srv_sig_off, srv_sig_on, srv_sig_withmail } server_signature;
int loglevel;
/* Access control */
1.180 +1 -0 apachen/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apachen/src/main/http_protocol.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -u -r1.179 -r1.180
--- http_protocol.c 1998/01/26 16:46:10 1.179
+++ http_protocol.c 1998/01/26 18:24:33 1.180
@@ -2181,6 +2181,7 @@
"\nerror was encountered while trying to use an "
"ErrorDocument to handle the request.\n", NULL);
}
+ bputs(psignature("<HR>\n", r), fd);
bputs("</BODY></HTML>\n", fd);
}
kill_timeout(r);
1.177 +2 -0 apachen/src/main/httpd.h
Index: httpd.h
===================================================================
RCS file: /home/cvs/apachen/src/main/httpd.h,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -u -r1.176 -r1.177
--- httpd.h 1998/01/22 23:23:41 1.176
+++ httpd.h 1998/01/26 18:24:34 1.177
@@ -947,4 +947,6 @@
#define RAISE_SIGSTOP(x)
#endif
+extern const char *psignature(const char *prefix, request_rec *r);
+
#endif /* !APACHE_HTTPD_H */
1.47 +18 -4 apachen/src/modules/proxy/proxy_ftp.c
Index: proxy_ftp.c
===================================================================
RCS file: /home/cvs/apachen/src/modules/proxy/proxy_ftp.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -u -r1.46 -r1.47
--- proxy_ftp.c 1998/01/21 22:02:39 1.46
+++ proxy_ftp.c 1998/01/26 18:24:36 1.47
@@ -379,11 +379,23 @@
o += w;
}
}
- strcpy (buf, "</PRE><HR></BODY></HTML>\n");
- bputs(buf, con->client);
+ site = "</PRE><HR>\n";
+ bputs(site, con->client);
if (f2 != NULL)
- bputs(buf, f2);
- total_bytes_sent += strlen(buf);
+ bputs(site, f2);
+ total_bytes_sent += strlen(site);
+
+ site = psignature("", r);
+ bputs(site, con->client);
+ if (f2 != NULL)
+ bputs(site, f2);
+ total_bytes_sent += strlen(site);
+
+ site = "</BODY></HTML>\n";
+ bputs(site, con->client);
+ if (f2 != NULL)
+ bputs(site, f2);
+ total_bytes_sent += strlen(site);
bflush(con->client);
return total_bytes_sent;
@@ -1033,6 +1045,8 @@
if (pasvmode)
bclose(data);
bclose(f);
+
+ rflush(r); /* flush before garbage collection */
proxy_garbage_coll(r);
1.63 +4 -2 apachen/src/modules/standard/mod_autoindex.c
Index: mod_autoindex.c
===================================================================
RCS file: /home/cvs/apachen/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -u -r1.62 -r1.63
--- mod_autoindex.c 1998/01/20 18:48:42 1.62
+++ mod_autoindex.c 1998/01/26 18:24:37 1.63
@@ -1111,9 +1111,11 @@
pclosedir(r->pool, d);
if ((tmp = find_readme(autoindex_conf, r))) {
- insert_readme(name, tmp, "",
+ if (!insert_readme(name, tmp, "",
((autoindex_opts & FANCY_INDEXING) ? HRULE : NO_HRULE),
- END_MATTER, r);
+ END_MATTER, r)) {
+ rputs(psignature("<HR>\n", r), r);
+ }
}
rputs("</BODY></HTML>\n", r);
1.34 +3 -1 apachen/src/modules/standard/mod_info.c
Index: mod_info.c
===================================================================
RCS file: /home/cvs/apachen/src/modules/standard/mod_info.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -u -r1.33 -r1.34
--- mod_info.c 1998/01/07 16:46:51 1.33
+++ mod_info.c 1998/01/26 18:24:38 1.34
@@ -627,7 +627,9 @@
}
}
}
- rputs("</dl></body></html>\n", r);
+ rputs("</dl>\n", r);
+ rputs(psignature("",r), r);
+ rputs("</body></html>\n", r);
/* Done, turn off timeout, close file and return */
kill_timeout(r);
return 0;
1.71 +3 -1 apachen/src/modules/standard/mod_status.c
Index: mod_status.c
===================================================================
RCS file: /home/cvs/apachen/src/modules/standard/mod_status.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -u -r1.70 -r1.71
--- mod_status.c 1998/01/07 16:46:57 1.70
+++ mod_status.c 1998/01/26 18:24:39 1.71
@@ -637,8 +637,10 @@
#endif /* STATUS */
- if (!short_report)
+ if (!short_report) {
+ rputs(psignature("<HR>\n",r), r);
rputs("</BODY></HTML>\n", r);
+ }
kill_timeout(r);
return 0;