cvs commit: apachen/src/modules/standard mod_access.c
dgaudet 97/11/08 13:33:09 Modified:src CHANGES src/modules/standard mod_access.c Log: Fix a byte ordering problem in mod_access which prevented the old-style syntax (i.e. "a.b.c." to match a class C) from working properly. [Dean Gaudet] PR: 1248, 1328, 1384 Reviewed by: Jim Jagielski, Lars Eilebrecht Revision ChangesPath 1.496 +4 -0 apachen/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.495 retrieving revision 1.496 diff -u -r1.495 -r1.496 --- CHANGES 1997/11/08 19:19:13 1.495 +++ CHANGES 1997/11/08 21:33:07 1.496 @@ -1,5 +1,9 @@ Changes with Apache 1.3b3 + *) Fix a byte ordering problem in mod_access which prevented + the old-style syntax (i.e. "a.b.c." to match a class C) + from working properly. [Dean Gaudet] PR#1248, 1328, 1384 + *) Fix problem with USE_FLOCK_SERIALIZED_ACCEPT not working properly. Each child needs to open the lockfile instead of using the passed file-descriptor from the parent. PR#1056 1.28 +15 -3 apachen/src/modules/standard/mod_access.c Index: mod_access.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_access.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- mod_access.c 1997/10/22 20:30:11 1.27 +++ mod_access.c 1997/11/08 21:33:09 1.28 @@ -204,12 +204,14 @@ /* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */ int shift; char *t; + int octet; a->type = T_IP; /* parse components */ s = where; a->x.ip.net = 0; - shift = 0; + a->x.ip.mask = 0; + shift = 24; while (*s) { t = s; if (!isdigit(*t)) { @@ -226,11 +228,21 @@ a->type = T_FAIL; return "invalid ip address"; } - a->x.ip.net |= atoi(s) << shift; + if (shift < 0) { + return "invalid ip address, only 4 octets allowed"; + } + octet = atoi(s); + if (octet < 0 || octet > 255) { + a->type = T_FAIL; + return "each octet must be between 0 and 255 inclusive"; + } + a->x.ip.net |= octet << shift; a->x.ip.mask |= 0xFFUL << shift; - shift += 8; s = t; + shift -= 8; } + a->x.ip.net = ntohl(a->x.ip.net); + a->x.ip.mask = ntohl(a->x.ip.mask); } else { a->type = T_HOST;
cvs commit: apachen/src/modules/standard mod_access.c mod_actions.c mod_asis.c mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_digest.c mod_expires.c mod_imap.c mod_include.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c mod_speling.c mod_status.c mod_unique_id.c
dgaudet 97/10/06 22:27:46 Modified:src/main conf.h http_core.c http_log.c http_log.h http_protocol.c http_request.c rfc1413.c util_script.c src/modules/standard mod_access.c mod_actions.c mod_asis.c mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_digest.c mod_expires.c mod_imap.c mod_include.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c mod_speling.c mod_status.c mod_unique_id.c Log: Insert APLOG_NOERRNO where appropriate. Remove needless errstr buffers, can just pass it all to aplog_errno. Add __attribute__((format(printf,5,6))) to aplog_error so that we get useful -Wall warnings about bad printf lists to aplog_error. #define __attribute__(__x) to be nothing on non-__GNUC__ compilers. Clean up use of TRANS in http_log.[ch]. Revision ChangesPath 1.145 +5 -1 apachen/src/main/conf.h Index: conf.h === RCS file: /export/home/cvs/apachen/src/main/conf.h,v retrieving revision 1.144 retrieving revision 1.145 diff -u -r1.144 -r1.145 --- conf.h1997/10/06 02:56:24 1.144 +++ conf.h1997/10/07 05:27:03 1.145 @@ -837,9 +837,13 @@ #define ap_inet_addr inet_addr #endif -/* so that we can use inline on some critical functions */ +/* So that we can use inline on some critical functions, and use + * GNUC attributes (such as to get -Wall warnings for printf-like + * functions). + */ #if !defined(__GNUC__) #define ap_inline +#define __attribute__(__x) #else #define ap_inline __inline__ #endif 1.124 +6 -6 apachen/src/main/http_core.c Index: http_core.c === RCS file: /export/home/cvs/apachen/src/main/http_core.c,v retrieving revision 1.123 retrieving revision 1.124 diff -u -r1.123 -r1.124 --- http_core.c 1997/09/25 01:03:21 1.123 +++ http_core.c 1997/10/07 05:27:04 1.124 @@ -1265,7 +1265,7 @@ else cur = atol(str); else { - aplog_error(APLOG_MARK, APLOG_ERR, cmd->server, + aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, cmd->server, "Invalid parameters for %s", cmd->cmd->name); return; } @@ -1277,7 +1277,7 @@ if (geteuid()) { limit->rlim_cur = cur; if (max) - aplog_error(APLOG_MARK, APLOG_ERR, cmd->server, + aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, cmd->server, "Must be uid 0 to raise maximum %s", cmd->cmd->name); } else { @@ -1293,7 +1293,7 @@ static const char *no_set_limit (cmd_parms *cmd, core_dir_config *conf, char *arg, char *arg2) { -aplog_error(APLOG_MARK, APLOG_ERR, cmd->server, +aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, cmd->server, "%s not supported on this platform", cmd->cmd->name); return NULL; } @@ -1569,7 +1569,7 @@ if (r->proxyreq) return HTTP_FORBIDDEN; if ((r->uri[0] != '/') && strcmp(r->uri, "*")) { - aplog_error(APLOG_MARK, APLOG_ERR, r->server, + aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server, "Invalid URI in request %s", r->the_request); return BAD_REQUEST; } @@ -1631,7 +1631,7 @@ r->allowed |= (1 << M_OPTIONS); if (r->method_number == M_INVALID) { - aplog_error(APLOG_MARK, APLOG_ERR, r->server, + aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server, "Invalid method in request %s", r->the_request); return NOT_IMPLEMENTED; } @@ -1641,7 +1641,7 @@ if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) { aplog_error(APLOG_MARK, APLOG_ERR, r->server, "File does not exist: %s", r->path_info ? pstrcat(r->pool, r->filename, r->path_info, NULL) - : r->filename, r); + : r->filename); return NOT_FOUND; } if (r->method_number != M_GET) return METHOD_NOT_ALLOWED; 1.40 +15 -16apachen/src/main/http_log.c Index: http_log.c === RCS file: /export/home/cvs/apachen/src/main/http_log.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- http_log.c1997/10/06 05:21:59 1.39 +++ http_log.c1997/10/07 05:27:05 1.40 @@ -67,10 +67,14 @@ #include +typedef struct { + char*t_name; + int t_val; +} TRANS; #ifdef HAVE_SYSLOG -static TRANS facilities[] = { +static
cvs commit: apachen/src/modules/standard mod_access.c
randy 97/08/31 14:31:00 Modified:src/modules/standard mod_access.c Log: Convert log_*() to aplog_error(). Revision ChangesPath 1.24 +2 -1 apachen/src/modules/standard/mod_access.c Index: mod_access.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_access.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- mod_access.c 1997/08/18 13:12:07 1.23 +++ mod_access.c 1997/08/31 21:30:59 1.24 @@ -342,7 +342,8 @@ if (ret == FORBIDDEN && ( satisfies(r) != SATISFY_ANY || !some_auth_required(r) )) { - log_reason ("Client denied by server configuration", r->filename, r); + aplog_error(APLOG_MARK, APLOG_ERR, r->server, + "Client denied by server configuration: %s", r->filename); } return ret;
cvs commit: apachen/src/modules/standard mod_access.c mod_actions.c mod_alias.c mod_asis.c mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_auth_msql.c mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_digest.c mod_dir.c mod_dld.c mod_env.c mod_expires.c mod_headers.c mod_imap.c mod_include.c mod_info.c mod_log_agent.c mod_log_config.c mod_log_referer.c mod_mime.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c mod_setenvif.c mod_status.c mod_userdir.c mod_usertrack.c
coar97/08/18 06:12:30 Modified:src/modules/example mod_example.c src/modules/proxy mod_proxy.c src/modules/standard mod_access.c mod_actions.c mod_alias.c mod_asis.c mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_auth_msql.c mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_digest.c mod_dir.c mod_dld.c mod_env.c mod_expires.c mod_headers.c mod_imap.c mod_include.c mod_info.c mod_log_agent.c mod_log_config.c mod_log_referer.c mod_mime.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c mod_setenvif.c mod_status.c mod_userdir.c mod_usertrack.c Log: Add the post read-request phase placeholder to the structures in the standard modules. PR: 1009 Revision ChangesPath 1.14 +52 -1 apachen/src/modules/example/mod_example.c Index: mod_example.c === RCS file: /export/home/cvs/apachen/src/modules/example/mod_example.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- mod_example.c 1997/07/28 18:23:27 1.13 +++ mod_example.c 1997/08/18 13:12:05 1.14 @@ -702,6 +702,33 @@ trace_add (s, NULL, NULL, note); } +/* + * This function is called when an heavy-weight process (such as a child) is + * being run down or destroyed. As with the child-initialisation function, + * any information that needs to be recorded must be in static cells, since + * there's no configuration record. + * + * There is no return value. + */ + +/* + * All our process-death routine does is add its trace to the log. + */ +static void example_child_exit +(server_rec *s, pool *p) { + +char*note; +char*sname = s->server_hostname; + +/* + * The arbitrary text we add to our trace entry indicates for which server + * we're being called. + */ +sname = (sname != NULL) ? sname : ""; +note = pstrcat (p, "example_child_exit(", sname, ")", NULL); +trace_add (s, NULL, NULL, note); +} + /* * This function gets called to create up a per-directory configuration * record. This will be called for the "default" server environment, and for @@ -888,6 +915,29 @@ } /* + * This routine is called after the request has been read but before any other + * phases have been processed. This allows us to make decisions based upon + * the input header fields. + * + * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, no + * further modules are called for this phase. + */ +static int example_post_readreq +(request_rec *r) { + +example_config +*cfg; + +cfg = our_dconfig (r); +/* + * We don't actually *do* anything here, except note the fact that we were + * called. + */ +trace_add (r->server, r, cfg, "example_post_readreq()"); +return DECLINED; +} + +/* * This routine gives our module an opportunity to translate the URI into an * actual filename. If we don't do anything special, the server's default * rules (Alias directives and the like) will continue to be followed. @@ -1139,5 +1189,6 @@ example_logger, /* [9] logger */ example_hparser,/* [2] header parser */ example_child_init, /* process initializer */ -NULL /* process exit/cleanup */ +example_child_exit, /* process exit/cleanup */ +example_post_readreq /* ? */ }; 1.22 +2 -2 apachen/src/modules/proxy/mod_proxy.c Index: mod_proxy.c === RCS file: /export/home/cvs/apachen/src/modules/proxy/mod_proxy.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- mod_proxy.c 1997/08/01 04:58:01 1.21 +++ mod_proxy.c 1997/08/18 13:12:06 1.22 @@ -756,6 +756,6 @@ NULL,/* logger */ NULL,/* header parser */ NULL, /* child_init */ - NULL /* child_exit */ + NULL, /* child_exit */ + NULL /* post read-request */ }; - 1.23 +2 -1 apachen/src/modules/standard/mod_access.c Index: mod_access.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_access.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- mod_access.c 1997/07/30 18:41:53 1.22 +++ mod_access.c 1997/0