httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@hyperreal.org>
Subject cvs commit: apachen/src/modules/standard mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_digest.c
Date Thu, 18 Sep 1997 08:12:26 GMT
dgaudet     97/09/18 01:12:25

  Modified:    src      INDENT
               src/modules/standard mod_autoindex.c mod_cern_meta.c
                        mod_cgi.c mod_digest.c
  Log:
  indent
  
  Revision  Changes    Path
  1.29      +5 -5      apachen/src/INDENT
  
  Index: INDENT
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/INDENT,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- INDENT	1997/09/18 07:59:12	1.28
  +++ INDENT	1997/09/18 08:12:20	1.29
  @@ -65,10 +65,10 @@
      mod_auth_anon.c		DONE by Dean
      mod_auth_db.c		DONE by Dean
      mod_auth_dbm.c		DONE by Dean
  -   mod_autoindex.c		RESERVED by Dean
  -   mod_cern_meta.c		RESERVED by Dean
  -   mod_cgi.c			RESERVED by Dean
  -   mod_digest.c			RESERVED by Dean
  +   mod_autoindex.c		DONE by Dean
  +   mod_cern_meta.c		DONE by Dean
  +   mod_cgi.c			DONE by Dean
  +   mod_digest.c			DONE by Dean
      mod_dir.c
      mod_dld.c
      mod_env.c
  @@ -88,7 +88,7 @@
      mod_rewrite.h
      mod_setenvif.c		DONE by Ken
      mod_speling.c		DONE by Brian
  -   mod_status.c
  +   mod_status.c			RESERVED by Dean
      mod_unique_id.c		DONE by Brian
      mod_userdir.c		DONE by Brian
      mod_usertrack.c		DONE by Brian
  
  
  
  1.48      +542 -517  apachen/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- mod_autoindex.c	1997/08/31 22:47:49	1.47
  +++ mod_autoindex.c	1997/09/18 08:12:22	1.48
  @@ -80,7 +80,7 @@
   #define FRONT_MATTER 1
   #define END_MATTER 0
   
  -#define FANCY_INDEXING 1        /* Indexing options */
  +#define FANCY_INDEXING 1	/* Indexing options */
   #define ICONS_ARE_LINKS 2
   #define SCAN_HTML_TITLES 4
   #define SUPPRESS_LAST_MOD 8
  @@ -117,10 +117,10 @@
       char *default_icon;
       int icon_width;
       int icon_height;
  -  
  +
       array_header *icon_list, *alt_list, *desc_list, *ign_list;
       array_header *hdr_list, *rdme_list, *opts_list;
  -  
  +
   } autoindex_config_rec;
   
   static char c_by_encoding, c_by_type, c_by_path;
  @@ -137,234 +137,238 @@
   static void emit_preamble(request_rec *r, char *title)
   {
       rvputs
  -        (
  -            r,
  -            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n",
  -            "<HTML>\n <HEAD>\n  <TITLE>Index of ",
  -            title,
  -            "</TITLE>\n </HEAD>\n <BODY>\n",
  -            NULL
  -        );
  +	(
  +	    r,
  +	    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n",
  +	    "<HTML>\n <HEAD>\n  <TITLE>Index of ",
  +	    title,
  +	    "</TITLE>\n </HEAD>\n <BODY>\n",
  +	    NULL
  +	);
   }
   
   static void push_item(array_header *arr, char *type, char *to, char *path,
  -    char *data)
  +		      char *data)
   {
  -    struct item *p = (struct item *)push_array(arr);
  +    struct item *p = (struct item *) push_array(arr);
  +
  +    if (!to)
  +	to = "";
  +    if (!path)
  +	path = "";
   
  -    if (!to) to = "";
  -    if (!path) path = "";
  -    
       p->type = type;
  -    p->data = data ? pstrdup(arr->pool, data): NULL;
  +    p->data = data ? pstrdup(arr->pool, data) : NULL;
       p->apply_path = pstrcat(arr->pool, path, "*", NULL);
  -    
  +
       if ((type == BY_PATH) && (!is_matchexp(to)))
  -        p->apply_to = pstrcat (arr->pool, "*", to, NULL);
  +	p->apply_to = pstrcat(arr->pool, "*", to, NULL);
       else if (to)
  -        p->apply_to = pstrdup (arr->pool, to);
  +	p->apply_to = pstrdup(arr->pool, to);
       else
  -        p->apply_to = NULL;
  +	p->apply_to = NULL;
   }
   
   static const char *add_alt(cmd_parms *cmd, void *d, char *alt, char *to)
   {
       if (cmd->info == BY_PATH)
  -        if (!strcmp(to, "**DIRECTORY**"))
  -            to = "^^DIRECTORY^^";
  +	if (!strcmp(to, "**DIRECTORY**"))
  +	    to = "^^DIRECTORY^^";
   
  -    push_item(((autoindex_config_rec *)d)->alt_list, cmd->info, to, cmd->path, alt);
  +    push_item(((autoindex_config_rec *) d)->alt_list, cmd->info, to, cmd->path, alt);
       return NULL;
   }
   
   static const char *add_icon(cmd_parms *cmd, void *d, char *icon, char *to)
   {
  -    char *iconbak = pstrdup (cmd->pool, icon);
  +    char *iconbak = pstrdup(cmd->pool, icon);
   
       if (icon[0] == '(') {
  -        char *alt = getword_nc (cmd->pool, &iconbak, ',');
  -        iconbak[strlen(iconbak) - 1] = '\0'; /* Lose closing paren */
  -        add_alt(cmd, d, &alt[1], to);
  -    }
  -    if (cmd->info == BY_PATH) 
  -        if (!strcmp(to, "**DIRECTORY**"))
  -            to = "^^DIRECTORY^^";
  +	char *alt = getword_nc(cmd->pool, &iconbak, ',');
  +	iconbak[strlen(iconbak) - 1] = '\0';	/* Lose closing paren */
  +	add_alt(cmd, d, &alt[1], to);
  +    }
  +    if (cmd->info == BY_PATH)
  +	if (!strcmp(to, "**DIRECTORY**"))
  +	    to = "^^DIRECTORY^^";
   
  -    push_item(((autoindex_config_rec *)d)->icon_list, cmd->info, to, cmd->path,
  -              iconbak);
  +    push_item(((autoindex_config_rec *) d)->icon_list, cmd->info, to, cmd->path,
  +	      iconbak);
       return NULL;
   }
   
   static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to)
   {
       push_item
  -        (
  -            ((autoindex_config_rec *) d)->desc_list,
  -            cmd->info,
  -            to,
  -            cmd->path,
  -            desc
  -        );
  +	(
  +	    ((autoindex_config_rec *) d)->desc_list,
  +	    cmd->info,
  +	    to,
  +	    cmd->path,
  +	    desc
  +	);
       return NULL;
   }
   
   static const char *add_ignore(cmd_parms *cmd, void *d, char *ext)
   {
  -    push_item(((autoindex_config_rec *)d)->ign_list, 0, ext, cmd->path, NULL);
  +    push_item(((autoindex_config_rec *) d)->ign_list, 0, ext, cmd->path, NULL);
       return NULL;
   }
   
   static const char *add_header(cmd_parms *cmd, void *d, char *name)
   {
  -    if (strchr (name, '/')) {
  -        return "HeaderName cannot contain a /";
  +    if (strchr(name, '/')) {
  +	return "HeaderName cannot contain a /";
       }
  -    push_item(((autoindex_config_rec *)d)->hdr_list, 0, NULL, cmd->path, name);
  +    push_item(((autoindex_config_rec *) d)->hdr_list, 0, NULL, cmd->path, name);
       return NULL;
   }
   
   static const char *add_readme(cmd_parms *cmd, void *d, char *name)
   {
  -    if (strchr (name, '/')) {
  -        return "ReadmeName cannot contain a /";
  +    if (strchr(name, '/')) {
  +	return "ReadmeName cannot contain a /";
       }
  -    push_item(((autoindex_config_rec *)d)->rdme_list, 0, NULL, cmd->path, name);
  +    push_item(((autoindex_config_rec *) d)->rdme_list, 0, NULL, cmd->path, name);
       return NULL;
   }
   
   
   static const char *add_opts_int(cmd_parms *cmd, void *d, int opts)
   {
  -    push_item(((autoindex_config_rec *)d)->opts_list, (char*)(long)opts, NULL,
  -              cmd->path, NULL);
  +    push_item(((autoindex_config_rec *) d)->opts_list, (char *) (long) opts, NULL,
  +	      cmd->path, NULL);
       return NULL;
   }
   
  -static const char *fancy_indexing (cmd_parms *cmd, void *d, int arg)
  +static const char *fancy_indexing(cmd_parms *cmd, void *d, int arg)
   {
  -    return add_opts_int (cmd, d, arg? FANCY_INDEXING : 0);
  +    return add_opts_int(cmd, d, arg ? FANCY_INDEXING : 0);
   }
   
  -static const char *add_opts(cmd_parms *cmd, void *d, const char *optstr) {
  +static const char *add_opts(cmd_parms *cmd, void *d, const char *optstr)
  +{
       char *w;
       int opts = 0;
       autoindex_config_rec *d_cfg = (autoindex_config_rec *) d;
   
       while (optstr[0]) {
  -        w = getword_conf(cmd->pool, &optstr);
  -        if (!strcasecmp(w, "FancyIndexing"))
  -            opts |= FANCY_INDEXING;
  -        else if (!strcasecmp(w, "IconsAreLinks"))
  -            opts |= ICONS_ARE_LINKS;
  -        else if (!strcasecmp(w, "ScanHTMLTitles"))
  -            opts |= SCAN_HTML_TITLES;
  -        else if (!strcasecmp(w, "SuppressLastModified"))
  -            opts |= SUPPRESS_LAST_MOD;
  -        else if (!strcasecmp(w, "SuppressSize"))
  -            opts |= SUPPRESS_SIZE;
  -        else if (!strcasecmp(w, "SuppressDescription"))
  -            opts |= SUPPRESS_DESC;
  -        else if (!strcasecmp(w,"SuppressHTMLPreamble"))
  -            opts |= SUPPRESS_PREAMBLE;
  -        else if (!strcasecmp(w, "None"))
  -            opts = 0;
  -        else if (! strncasecmp (w, "IconWidth", 9)) {
  -            if (strchr (w, '=') != NULL) {
  -                const char *x = pstrdup (cmd->pool, w);
  -                char *val;
  -                val = getword (cmd->pool, &x, '=');
  -                val = getword (cmd->pool, &x, '=');
  -                d_cfg->icon_width = atoi(val);
  -            }
  -            else {
  -                d_cfg->icon_width = DEFAULT_ICON_WIDTH;
  -            }
  -        }
  -        else if (! strncasecmp (w, "IconHeight", 10)) {
  -            if (strchr (w, '=') != NULL) {
  -                const char *x = pstrdup (cmd->pool, w);
  -                char *val;
  -                val = getword (cmd->pool, &x, '=');
  -                val = getword (cmd->pool, &x, '=');
  -                d_cfg->icon_height = atoi(val);
  -            }
  -            else {
  -                d_cfg->icon_height = DEFAULT_ICON_HEIGHT;
  -            }
  -        }
  -        else
  -            return "Invalid directory indexing option";
  +	w = getword_conf(cmd->pool, &optstr);
  +	if (!strcasecmp(w, "FancyIndexing"))
  +	    opts |= FANCY_INDEXING;
  +	else if (!strcasecmp(w, "IconsAreLinks"))
  +	    opts |= ICONS_ARE_LINKS;
  +	else if (!strcasecmp(w, "ScanHTMLTitles"))
  +	    opts |= SCAN_HTML_TITLES;
  +	else if (!strcasecmp(w, "SuppressLastModified"))
  +	    opts |= SUPPRESS_LAST_MOD;
  +	else if (!strcasecmp(w, "SuppressSize"))
  +	    opts |= SUPPRESS_SIZE;
  +	else if (!strcasecmp(w, "SuppressDescription"))
  +	    opts |= SUPPRESS_DESC;
  +	else if (!strcasecmp(w, "SuppressHTMLPreamble"))
  +	    opts |= SUPPRESS_PREAMBLE;
  +	else if (!strcasecmp(w, "None"))
  +	    opts = 0;
  +	else if (!strncasecmp(w, "IconWidth", 9)) {
  +	    if (strchr(w, '=') != NULL) {
  +		const char *x = pstrdup(cmd->pool, w);
  +		char *val;
  +		val = getword(cmd->pool, &x, '=');
  +		val = getword(cmd->pool, &x, '=');
  +		d_cfg->icon_width = atoi(val);
  +	    }
  +	    else {
  +		d_cfg->icon_width = DEFAULT_ICON_WIDTH;
  +	    }
  +	}
  +	else if (!strncasecmp(w, "IconHeight", 10)) {
  +	    if (strchr(w, '=') != NULL) {
  +		const char *x = pstrdup(cmd->pool, w);
  +		char *val;
  +		val = getword(cmd->pool, &x, '=');
  +		val = getword(cmd->pool, &x, '=');
  +		d_cfg->icon_height = atoi(val);
  +	    }
  +	    else {
  +		d_cfg->icon_height = DEFAULT_ICON_HEIGHT;
  +	    }
  +	}
  +	else
  +	    return "Invalid directory indexing option";
       }
       return add_opts_int(cmd, d, opts);
   }
   
   #define DIR_CMD_PERMS OR_INDEXES
   
  -static command_rec autoindex_cmds[] = {
  -{ "AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  -    "an icon URL followed by one or more filenames" },
  -{ "AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  -    "an icon URL followed by one or more MIME types" },
  -{ "AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, ITERATE2,
  -    "an icon URL followed by one or more content encodings" },
  -{ "AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  -    "alternate descriptive text followed by one or more filenames" },
  -{ "AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  -    "alternate descriptive text followed by one or more MIME types" },
  -{ "AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, ITERATE2,
  -    "alternate descriptive text followed by one or more content encodings" },
  -{ "IndexOptions", add_opts, NULL, DIR_CMD_PERMS, RAW_ARGS,
  -    "one or more index options" },
  -{ "IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, ITERATE,
  -    "one or more file extensions" },
  -{ "AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  -    "Descriptive text followed by one or more filenames" },
  -{ "HeaderName", add_header, NULL, DIR_CMD_PERMS, TAKE1, "a filename" },
  -{ "ReadmeName", add_readme, NULL, DIR_CMD_PERMS, TAKE1, "a filename" },
  -{ "FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, FLAG,
  -    "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)" },
  -{ "DefaultIcon", set_string_slot,
  -    (void*)XtOffsetOf(autoindex_config_rec, default_icon),
  -    DIR_CMD_PERMS, TAKE1, "an icon URL"},
  -{ NULL }
  +static command_rec autoindex_cmds[] =
  +{
  +    {"AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  +     "an icon URL followed by one or more filenames"},
  +    {"AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  +     "an icon URL followed by one or more MIME types"},
  +    {"AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, ITERATE2,
  +     "an icon URL followed by one or more content encodings"},
  +    {"AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  +     "alternate descriptive text followed by one or more filenames"},
  +    {"AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  +     "alternate descriptive text followed by one or more MIME types"},
  +    {"AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, ITERATE2,
  +     "alternate descriptive text followed by one or more content encodings"},
  +    {"IndexOptions", add_opts, NULL, DIR_CMD_PERMS, RAW_ARGS,
  +     "one or more index options"},
  +    {"IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, ITERATE,
  +     "one or more file extensions"},
  +    {"AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  +     "Descriptive text followed by one or more filenames"},
  +    {"HeaderName", add_header, NULL, DIR_CMD_PERMS, TAKE1, "a filename"},
  +    {"ReadmeName", add_readme, NULL, DIR_CMD_PERMS, TAKE1, "a filename"},
  +    {"FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, FLAG,
  +     "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)"},
  +    {"DefaultIcon", set_string_slot,
  +     (void *) XtOffsetOf(autoindex_config_rec, default_icon),
  +     DIR_CMD_PERMS, TAKE1, "an icon URL"},
  +    {NULL}
   };
   
  -static void *create_autoindex_config (pool *p, char *dummy)
  +static void *create_autoindex_config(pool *p, char *dummy)
   {
       autoindex_config_rec *new =
  -        (autoindex_config_rec *) pcalloc (p, sizeof(autoindex_config_rec));
  +    (autoindex_config_rec *) pcalloc(p, sizeof(autoindex_config_rec));
   
       new->icon_width = 0;
       new->icon_height = 0;
  -    new->icon_list = make_array (p, 4, sizeof (struct item));
  -    new->alt_list = make_array (p, 4, sizeof (struct item));
  -    new->desc_list = make_array (p, 4, sizeof (struct item));
  -    new->ign_list = make_array (p, 4, sizeof (struct item));
  -    new->hdr_list = make_array (p, 4, sizeof (struct item));
  -    new->rdme_list = make_array (p, 4, sizeof (struct item));
  -    new->opts_list = make_array (p, 4, sizeof (struct item));
  -    
  -    return (void *)new;
  -}
  -
  -static void *merge_autoindex_configs (pool *p, void *basev, void *addv)
  -{
  -    autoindex_config_rec *new = (autoindex_config_rec*)pcalloc (p, sizeof(autoindex_config_rec));
  -    autoindex_config_rec *base = (autoindex_config_rec *)basev;
  -    autoindex_config_rec *add = (autoindex_config_rec *)addv;
  +    new->icon_list = make_array(p, 4, sizeof(struct item));
  +    new->alt_list = make_array(p, 4, sizeof(struct item));
  +    new->desc_list = make_array(p, 4, sizeof(struct item));
  +    new->ign_list = make_array(p, 4, sizeof(struct item));
  +    new->hdr_list = make_array(p, 4, sizeof(struct item));
  +    new->rdme_list = make_array(p, 4, sizeof(struct item));
  +    new->opts_list = make_array(p, 4, sizeof(struct item));
  +
  +    return (void *) new;
  +}
  +
  +static void *merge_autoindex_configs(pool *p, void *basev, void *addv)
  +{
  +    autoindex_config_rec *new = (autoindex_config_rec *) pcalloc(p, sizeof(autoindex_config_rec));
  +    autoindex_config_rec *base = (autoindex_config_rec *) basev;
  +    autoindex_config_rec *add = (autoindex_config_rec *) addv;
   
  -    new->default_icon = add->default_icon?add->default_icon:base->default_icon;
  +    new->default_icon = add->default_icon ? add->default_icon:base->default_icon;
       new->icon_height = add->icon_height ? add->icon_height : base->icon_height;
       new->icon_width = add->icon_width ? add->icon_width : base->icon_width;
   
  -    new->alt_list = append_arrays (p, add->alt_list, base->alt_list);
  -    new->ign_list = append_arrays (p, add->ign_list, base->ign_list);
  -    new->hdr_list = append_arrays (p, add->hdr_list, base->hdr_list);
  -    new->desc_list = append_arrays (p, add->desc_list, base->desc_list);
  -    new->icon_list = append_arrays (p, add->icon_list, base->icon_list);
  -    new->rdme_list = append_arrays (p, add->rdme_list, base->rdme_list);
  -    new->opts_list = append_arrays (p, add->opts_list, base->opts_list);
  -    
  +    new->alt_list = append_arrays(p, add->alt_list, base->alt_list);
  +    new->ign_list = append_arrays(p, add->ign_list, base->ign_list);
  +    new->hdr_list = append_arrays(p, add->hdr_list, base->hdr_list);
  +    new->desc_list = append_arrays(p, add->desc_list, base->desc_list);
  +    new->icon_list = append_arrays(p, add->icon_list, base->icon_list);
  +    new->rdme_list = append_arrays(p, add->rdme_list, base->rdme_list);
  +    new->opts_list = append_arrays(p, add->opts_list, base->opts_list);
  +
       return new;
   }
   
  @@ -389,38 +393,41 @@
       char key;
   };
   
  -static char *find_item(request_rec *r, array_header *list, int path_only) {
  +static char *find_item(request_rec *r, array_header *list, int path_only)
  +{
       char *content_type = r->content_type;
       char *content_encoding = r->content_encoding;
       char *path = r->filename;
   
  -    struct item *items = (struct item *)list->elts;
  +    struct item *items = (struct item *) list->elts;
       int i;
   
       for (i = 0; i < list->nelts; ++i) {
  -        struct item *p = &items[i];
  -      
  -        /* Special cased for ^^DIRECTORY^^ and ^^BLANKICON^^ */
  -        if ((path[0] == '^') || (!strcmp_match(path, p->apply_path))) {
  -            if (!*(p->apply_to))
  -                return p->data;
  -            else if (p->type == BY_PATH || path[0] == '^') {
  -                if (!strcmp_match(path, p->apply_to))
  -                    return p->data;
  -            } else if (!path_only) {
  -                if (!content_encoding) {
  -                    if (p->type == BY_TYPE) {
  -                        if (content_type && !strcmp_match(content_type, p->apply_to))
  -                            return p->data;
  -                    }
  -                } else {
  -                    if (p->type == BY_ENCODING) {
  -                        if (!strcmp_match(content_encoding, p->apply_to))
  -                            return p->data;
  -                    }
  -                }
  -            }
  -        }
  +	struct item *p = &items[i];
  +
  +	/* Special cased for ^^DIRECTORY^^ and ^^BLANKICON^^ */
  +	if ((path[0] == '^') || (!strcmp_match(path, p->apply_path))) {
  +	    if (!*(p->apply_to))
  +		return p->data;
  +	    else if (p->type == BY_PATH || path[0] == '^') {
  +		if (!strcmp_match(path, p->apply_to))
  +		    return p->data;
  +	    }
  +	    else if (!path_only) {
  +		if (!content_encoding) {
  +		    if (p->type == BY_TYPE) {
  +			if (content_type && !strcmp_match(content_type, p->apply_to))
  +			    return p->data;
  +		    }
  +		}
  +		else {
  +		    if (p->type == BY_ENCODING) {
  +			if (!strcmp_match(content_encoding, p->apply_to))
  +			    return p->data;
  +		    }
  +		}
  +	    }
  +	}
       }
       return NULL;
   }
  @@ -431,7 +438,7 @@
   #define find_header(d,p) find_item(p,d->hdr_list,0)
   #define find_readme(d,p) find_item(p,d->rdme_list,0)
   
  -static char *find_default_icon (autoindex_config_rec *d, char *bogus_name)
  +static char *find_default_icon(autoindex_config_rec * d, char *bogus_name)
   {
       request_rec r;
   
  @@ -439,51 +446,53 @@
        * of ugliness.   Note that the fields initialized are precisely
        * those that find_item looks at...
        */
  -    
  +
       r.filename = bogus_name;
       r.content_type = r.content_encoding = NULL;
   
  -    return find_item (&r, d->icon_list, 1);
  +    return find_item(&r, d->icon_list, 1);
   }
   
  -static int ignore_entry(autoindex_config_rec *d, char *path) {
  +static int ignore_entry(autoindex_config_rec * d, char *path)
  +{
       array_header *list = d->ign_list;
  -    struct item *items = (struct item *)list->elts;
  +    struct item *items = (struct item *) list->elts;
       char *tt;
       int i;
   
       if ((tt = strrchr(path, '/')) == NULL)
  -      tt = path;
  +	tt = path;
       else {
  -      tt++;
  +	tt++;
       }
   
       for (i = 0; i < list->nelts; ++i) {
  -        struct item *p = &items[i];
  -        char *ap;
  +	struct item *p = &items[i];
  +	char *ap;
   
  -        if ((ap = strrchr(p->apply_to, '/')) == NULL)
  -          ap = p->apply_to;
  -        else
  -          ap++;
  +	if ((ap = strrchr(p->apply_to, '/')) == NULL)
  +	    ap = p->apply_to;
  +	else
  +	    ap++;
   
  -        if (!strcmp_match(path, p->apply_path) && !strcmp_match(tt, ap))
  -           return 1;
  +	if (!strcmp_match(path, p->apply_path) && !strcmp_match(tt, ap))
  +	    return 1;
       }
       return 0;
   }
   
  -static int find_opts(autoindex_config_rec *d, request_rec *r) {
  +static int find_opts(autoindex_config_rec * d, request_rec *r)
  +{
       char *path = r->filename;
       array_header *list = d->opts_list;
  -    struct item *items = (struct item *)list->elts;
  +    struct item *items = (struct item *) list->elts;
       int i;
   
       for (i = 0; i < list->nelts; ++i) {
  -        struct item *p = &items[i];
  -        
  -        if (!strcmp_match(path, p->apply_path))
  -            return (int)(long)p->type;
  +	struct item *p = &items[i];
  +
  +	if (!strcmp_match(path, p->apply_path))
  +	    return (int) (long) p->type;
       }
       return 0;
   }
  @@ -498,7 +507,7 @@
    * find it.
    */
   static int insert_readme(char *name, char *readme_fname, char *title, int hrule,
  -    int whichend, request_rec *r)
  +			 int whichend, request_rec *r)
   {
       char *fn;
       FILE *f;
  @@ -506,129 +515,138 @@
       int plaintext = 0;
       request_rec *rr;
       autoindex_config_rec *cfg =
  -        (autoindex_config_rec *) get_module_config
  -                                    (
  -                                        r->per_dir_config,
  -                                        &autoindex_module
  -                                    );
  +    (autoindex_config_rec *) get_module_config
  +    (
  +	r->per_dir_config,
  +	&autoindex_module
  +    );
       int autoindex_opts = find_opts(cfg, r);
   
       /* XXX: this is a load of crap, it needs to do a full sub_req_lookup_uri */
       fn = make_full_path(r->pool, name, readme_fname);
       fn = pstrcat(r->pool, fn, ".html", NULL);
       if (stat(fn, &finfo) == -1) {
  -        /* A brief fake multiviews search for README.html */
  -        fn[strlen(fn)-5] = '\0';
  -        if (stat(fn, &finfo) == -1)
  -            return 0;
  -        plaintext = 1;
  -        if (hrule) rputs("<HR>\n", r);
  -        rputs("<PRE>\n", r);
  +	/* A brief fake multiviews search for README.html */
  +	fn[strlen(fn) - 5] = '\0';
  +	if (stat(fn, &finfo) == -1)
  +	    return 0;
  +	plaintext = 1;
  +	if (hrule)
  +	    rputs("<HR>\n", r);
  +	rputs("<PRE>\n", r);
       }
  -    else if (hrule) rputs("<HR>\n", r);
  +    else if (hrule)
  +	rputs("<HR>\n", r);
       /* XXX: when the above is rewritten properly, this necessary security
        * check will be redundant. -djg */
  -    rr = sub_req_lookup_file (fn, r);
  +    rr = sub_req_lookup_file(fn, r);
       if (rr->status != HTTP_OK) {
  -        destroy_sub_req (rr);
  -        return 0;
  +	destroy_sub_req(rr);
  +	return 0;
       }
  -    destroy_sub_req (rr);
  +    destroy_sub_req(rr);
       if (!(f = pfopen(r->pool, fn, "r")))
  -        return 0;
  +	     return 0;
       if (
  -        (whichend == FRONT_MATTER) &&
  -        (! (autoindex_opts & SUPPRESS_PREAMBLE))
  -       ) {
  -        emit_preamble (r, title);
  +	   (whichend == FRONT_MATTER) &&
  +	   (!(autoindex_opts & SUPPRESS_PREAMBLE))
  +	) {
  +	emit_preamble(r, title);
       }
       if (!plaintext) {
  -        send_fd(f, r);
  +	send_fd(f, r);
       }
       else {
  -        char buf[IOBUFSIZE+1];
  -        int i, n, c, ch;
  -        while (!feof(f))
  -        {
  -            do n = fread(buf, sizeof(char), IOBUFSIZE, f);
  -            while (n == -1 && ferror(f) && errno == EINTR);
  -            if (n == -1 || n == 0) break;
  -            buf[n] = '\0';
  -            c = 0;
  -            while (c < n) {
  -                for (i = c; i < n; i++)
  -                    if (buf[i] == '<' || buf[i] == '>' || buf[i] == '&') break;
  -                ch = buf[i];
  -                buf[i] = '\0';
  -                rputs(&buf[c], r);
  -                if (ch == '<') rputs("&lt;", r);
  -                else if (ch == '>') rputs("&gt;", r);
  -                else if (ch == '&') rputs("&amp;", r);
  -                c = i + 1;
  -            }
  -        }
  +	char buf[IOBUFSIZE + 1];
  +	int i, n, c, ch;
  +	while (!feof(f)) {
  +	    do
  +		n = fread(buf, sizeof(char), IOBUFSIZE, f);
  +	    while (n == -1 && ferror(f) && errno == EINTR);
  +	    if (n == -1 || n == 0)
  +		break;
  +	    buf[n] = '\0';
  +	    c = 0;
  +	    while (c < n) {
  +		for (i = c; i < n; i++)
  +		    if (buf[i] == '<' || buf[i] == '>' || buf[i] == '&')
  +			break;
  +		ch = buf[i];
  +		buf[i] = '\0';
  +		rputs(&buf[c], r);
  +		if (ch == '<')
  +		    rputs("&lt;", r);
  +		else if (ch == '>')
  +		    rputs("&gt;", r);
  +		else if (ch == '&')
  +		    rputs("&amp;", r);
  +		c = i + 1;
  +	    }
  +	}
       }
       pfclose(r->pool, f);
       if (plaintext)
  -        rputs("</PRE>\n", r);
  +	rputs("</PRE>\n", r);
       return 1;
   }
   
   
  -static char *find_title(request_rec *r) {
  +static char *find_title(request_rec *r)
  +{
       char titlebuf[MAX_STRING_LEN], *find = "<TITLE>";
       FILE *thefile = NULL;
       int x, y, n, p;
   
       if (r->status != HTTP_OK) {
  -        return NULL;
  +	return NULL;
       }
       if (r->content_type
  -	&& (!strcmp(r->content_type,"text/html")
  -	    || !strcmp(r->content_type,INCLUDES_MAGIC_TYPE))
  -	&& !r->content_encoding)
  -    {
  -        if (!(thefile = pfopen(r->pool, r->filename, "r")))
  -            return NULL;
  -        n = fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile);
  -        titlebuf[n] = '\0';
  -        for (x = 0, p = 0; titlebuf[x]; x++) {
  -            if (toupper(titlebuf[x]) == find[p]) {
  -                if (!find[++p]) {
  -                    if ((p = ind(&titlebuf[++x], '<')) != -1)
  -                        titlebuf[x+p] = '\0';
  -                    /* Scan for line breaks for Tanmoy's secretary */
  -                    for (y = x; titlebuf[y]; y++)
  -                        if ((titlebuf[y] == CR) || (titlebuf[y] == LF))
  -			    if (y==x)
  +	&& (!strcmp(r->content_type, "text/html")
  +	    || !strcmp(r->content_type, INCLUDES_MAGIC_TYPE))
  +	&& !r->content_encoding) {
  +	if (!(thefile = pfopen(r->pool, r->filename, "r")))
  +	         return NULL;
  +	n = fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile);
  +	titlebuf[n] = '\0';
  +	for (x = 0, p = 0; titlebuf[x]; x++) {
  +	    if (toupper(titlebuf[x]) == find[p]) {
  +		if (!find[++p]) {
  +		    if ((p = ind(&titlebuf[++x], '<')) != -1)
  +			titlebuf[x + p] = '\0';
  +		    /* Scan for line breaks for Tanmoy's secretary */
  +		    for (y = x; titlebuf[y]; y++)
  +			if ((titlebuf[y] == CR) || (titlebuf[y] == LF))
  +			    if (y == x)
   				x++;
   			    else
   				titlebuf[y] = ' ';
  -                    pfclose (r->pool, thefile);
  -                    return pstrdup(r->pool, &titlebuf[x]);
  -                }
  -            } else p = 0;
  -        }
  -        pfclose(r->pool, thefile);
  +		    pfclose(r->pool, thefile);
  +		    return pstrdup(r->pool, &titlebuf[x]);
  +		}
  +	    }
  +	    else
  +		p = 0;
  +	}
  +	pfclose(r->pool, thefile);
       }
       return NULL;
   }
   
   static struct ent *make_autoindex_entry(char *name, int autoindex_opts,
  -					autoindex_config_rec *d,
  +					autoindex_config_rec * d,
   					request_rec *r, char keyid,
   					char direction)
   {
       struct ent *p;
   
       if ((name[0] == '.') && (!name[1]))
  -        return(NULL);
  +	return (NULL);
   
  -    if (ignore_entry(d, make_full_path (r->pool, r->filename, name)))
  -        return(NULL);
  +    if (ignore_entry(d, make_full_path(r->pool, r->filename, name)))
  +	     return (NULL);
   
  -    p = (struct ent *)pcalloc(r->pool, sizeof(struct ent));
  -    p->name = pstrdup (r->pool, name);
  +    p = (struct ent *) pcalloc(r->pool, sizeof(struct ent));
  +    p->name = pstrdup(r->pool, name);
       p->size = 0;
       p->icon = NULL;
       p->alt = NULL;
  @@ -638,69 +656,72 @@
       p->ascending = (toupper(direction) == D_ASCENDING);
   
       if (autoindex_opts & FANCY_INDEXING) {
  -        request_rec *rr = sub_req_lookup_file (name, r);
  -        
  -        if (rr->finfo.st_mode != 0) {
  -            p->lm = rr->finfo.st_mtime;
  -            if (S_ISDIR(rr->finfo.st_mode)) {
  -                if (!(p->icon = find_icon(d, rr, 1)))
  -                    p->icon = find_default_icon(d, "^^DIRECTORY^^");
  -                if (!(p->alt = find_alt(d, rr, 1)))
  -                    p->alt = "DIR";
  -                p->size = 0;
  -                p->name = pstrcat (r->pool, name, "/", NULL);
  -            }
  -            else {
  -                p->icon = find_icon(d, rr, 0);
  -                p->alt = find_alt(d, rr, 0);
  -                p->size = rr->finfo.st_size;
  -            }
  -        }
  -        
  -        p->desc = find_desc(d, rr);
  -        
  -        if ((!p->desc) && (autoindex_opts & SCAN_HTML_TITLES))
  -            p->desc = pstrdup (r->pool, find_title(rr));
  +	request_rec *rr = sub_req_lookup_file(name, r);
  +
  +	if (rr->finfo.st_mode != 0) {
  +	    p->lm = rr->finfo.st_mtime;
  +	    if (S_ISDIR(rr->finfo.st_mode)) {
  +		if (!(p->icon = find_icon(d, rr, 1)))
  +		    p->icon = find_default_icon(d, "^^DIRECTORY^^");
  +		if (!(p->alt = find_alt(d, rr, 1)))
  +		    p->alt = "DIR";
  +		p->size = 0;
  +		p->name = pstrcat(r->pool, name, "/", NULL);
  +	    }
  +	    else {
  +		p->icon = find_icon(d, rr, 0);
  +		p->alt = find_alt(d, rr, 0);
  +		p->size = rr->finfo.st_size;
  +	    }
  +	}
  +
  +	p->desc = find_desc(d, rr);
   
  -        destroy_sub_req (rr);
  +	if ((!p->desc) && (autoindex_opts & SCAN_HTML_TITLES))
  +	    p->desc = pstrdup(r->pool, find_title(rr));
  +
  +	destroy_sub_req(rr);
       }
       if (keyid == K_SIZE) {
  -	p->size_cmp = palloc (r->pool, 14);
  -	ap_snprintf (p->size_cmp, 14, "%013d", p->size);
  +	p->size_cmp = palloc(r->pool, 14);
  +	ap_snprintf(p->size_cmp, 14, "%013d", p->size);
       }
       if (keyid == K_LAST_MOD) {
   	struct tm *ts = localtime(&p->lm);
   
  -	p->lm_cmp = palloc (r->pool, 15);
  -	strftime (p->lm_cmp, 15, "%Y%m%d%H%M%S", ts);
  +	p->lm_cmp = palloc(r->pool, 15);
  +	strftime(p->lm_cmp, 15, "%Y%m%d%H%M%S", ts);
       }
  -    return(p);
  +    return (p);
   }
   
  -static char *terminate_description(autoindex_config_rec *d, char *desc,
  -    int autoindex_opts)
  +static char *terminate_description(autoindex_config_rec * d, char *desc,
  +				   int autoindex_opts)
   {
       int maxsize = 23;
       register int x;
  -    
  -    if (autoindex_opts & SUPPRESS_LAST_MOD) maxsize += 17;
  -    if (autoindex_opts & SUPPRESS_SIZE) maxsize += 7;
  +
  +    if (autoindex_opts & SUPPRESS_LAST_MOD)
  +	maxsize += 17;
  +    if (autoindex_opts & SUPPRESS_SIZE)
  +	maxsize += 7;
   
       for (x = 0; desc[x] && maxsize; x++) {
  -        if (desc[x] == '<') {
  -            while (desc[x] != '>') {
  -                if (!desc[x]) {
  -                    maxsize = 0;
  -                    break;
  -                }
  -                ++x;
  -            }
  -        }
  -        else --maxsize;
  +	if (desc[x] == '<') {
  +	    while (desc[x] != '>') {
  +		if (!desc[x]) {
  +		    maxsize = 0;
  +		    break;
  +		}
  +		++x;
  +	    }
  +	}
  +	else
  +	    --maxsize;
       }
       if (!maxsize) {
  -        desc[x-1] = '>';        /* Grump. */
  -        desc[x] = '\0';         /* Double Grump! */
  +	desc[x - 1] = '>';	/* Grump. */
  +	desc[x] = '\0';		/* Double Grump! */
       }
       return desc;
   }
  @@ -722,145 +743,147 @@
       qvalue[4] = '\0';
       reverse = ((curkey == fname) && (curdirection == D_ASCENDING));
       qvalue[3] = reverse ? D_DESCENDING : D_ASCENDING;
  -    rvputs (r, "<A HREF=\"", qvalue, "\">", anchor, "</A>", NULL);
  +    rvputs(r, "<A HREF=\"", qvalue, "\">", anchor, "</A>", NULL);
   }
   
   static void output_directories(struct ent **ar, int n,
  -			       autoindex_config_rec *d, request_rec *r,
  -			       int autoindex_opts, char keyid, char direction)
  +			       autoindex_config_rec * d, request_rec *r,
  +			     int autoindex_opts, char keyid, char direction)
   {
       int x, len;
       char *name = r->uri;
       char *tp;
  -    pool *scratch = make_sub_pool (r->pool);
  -    
  -    if (name[0] == '\0') name = "/";
  +    pool *scratch = make_sub_pool(r->pool);
  +
  +    if (name[0] == '\0')
  +	name = "/";
   
       if (autoindex_opts & FANCY_INDEXING) {
  -        rputs("<PRE>", r);
  -        if ((tp = find_default_icon(d, "^^BLANKICON^^"))) {
  -            rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
  -                   "\" ALT=\"     \"", NULL);
  -            if (d->icon_width && d->icon_height) {
  -                rprintf
  -                    (
  -                        r,
  -                        " HEIGHT=\"%d\" WIDTH=\"%d\"",
  -                        d->icon_height,
  -                        d->icon_width
  -                    );
  -            }
  -            rputs ("> ", r);
  -        }
  +	rputs("<PRE>", r);
  +	if ((tp = find_default_icon(d, "^^BLANKICON^^"))) {
  +	    rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
  +		   "\" ALT=\"     \"", NULL);
  +	    if (d->icon_width && d->icon_height) {
  +		rprintf
  +		    (
  +			r,
  +			" HEIGHT=\"%d\" WIDTH=\"%d\"",
  +			d->icon_height,
  +			d->icon_width
  +		    );
  +	    }
  +	    rputs("> ", r);
  +	}
   	emit_link(r, "Name", K_NAME, keyid, direction);
  -	rputs ("                   ", r);
  -        if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
  +	rputs("                   ", r);
  +	if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
   	    emit_link(r, "Last modified", K_LAST_MOD, keyid, direction);
  -            rputs("     ", r);
  +	    rputs("     ", r);
   	}
  -        if (!(autoindex_opts & SUPPRESS_SIZE)) {
  +	if (!(autoindex_opts & SUPPRESS_SIZE)) {
   	    emit_link(r, "Size", K_SIZE, keyid, direction);
  -            rputs("  ", r);
  +	    rputs("  ", r);
   	}
  -        if (!(autoindex_opts & SUPPRESS_DESC)) {
  +	if (!(autoindex_opts & SUPPRESS_DESC)) {
   	    emit_link(r, "Description", K_DESC, keyid, direction);
   	}
  -        rputs("\n<HR>\n", r);
  +	rputs("\n<HR>\n", r);
       }
       else {
  -        rputs("<UL>", r);
  +	rputs("<UL>", r);
       }
   
  -    for (x = 0; x<n; x++) {
  -        char *anchor = NULL, *t = NULL, *t2 = NULL;
  -        
  -        clear_pool (scratch);
  -        
  -        if ((!strcmp(ar[x]->name, "../")) || (!strcmp(ar[x]->name, ".."))) {
  -            t = make_full_path (scratch, name, "../");
  -            getparents(t);
  -            if (t[0] == '\0') t = "/";
  -            anchor = pstrcat (scratch, "<A HREF=\"",
  -                              escape_html(scratch, os_escape_path(scratch, t, 0)),
  -                              "\">", NULL);
  -            t2 = "Parent Directory</A>       ";
  -        }
  -        else {
  -            t = ar[x]->name;
  -            len = strlen(t);
  -            if (len > 23) {
  -                t2 = pstrdup(scratch, t);
  -                t2[21] = '.';
  -                t2[22] = '.';
  -                t2[23] = '\0';
  -                t2 = escape_html(scratch, t2);
  -                t2 = pstrcat(scratch, t2, "</A>", NULL);
  -            } else 
  -            {
  -                char buff[24] = "                       ";
  -                t2 = escape_html(scratch, t);
  -                buff[23-len] = '\0';
  -                t2 = pstrcat(scratch, t2, "</A>", buff, NULL);
  -            }
  -            anchor = pstrcat (scratch, "<A HREF=\"",
  -                              escape_html(scratch, os_escape_path(scratch, t, 0)),
  -                              "\">", NULL);
  -        }
  -
  -        if (autoindex_opts & FANCY_INDEXING) {
  -            if (autoindex_opts & ICONS_ARE_LINKS)
  -                rputs(anchor, r);
  -            if ((ar[x]->icon) || d->default_icon) {
  -                rvputs(r, "<IMG SRC=\"", 
  -                       escape_html(scratch, ar[x]->icon ?
  -                                   ar[x]->icon : d->default_icon),
  -                       "\" ALT=\"[", (ar[x]->alt ? ar[x]->alt : "   "),
  -                       "]\"", NULL);
  -                if (d->icon_width && d->icon_height) {
  -                    rprintf
  -                        (
  -                            r,
  -                            " HEIGHT=\"%d\" WIDTH=\"%d\"",
  -                            d->icon_height,
  -                            d->icon_width
  -                        );
  -                }
  -                rputs (">", r);
  -            }
  -            if (autoindex_opts & ICONS_ARE_LINKS) 
  -                rputs("</A>", r);
  -
  -            rvputs(r, " ", anchor, t2, NULL);
  -            if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
  -                if (ar[x]->lm != -1) {
  -                    char time_str[MAX_STRING_LEN];
  -                    struct tm *ts = localtime(&ar[x]->lm);
  -                    strftime(time_str, MAX_STRING_LEN, "%d-%b-%y %H:%M  ", ts);
  -                    rputs(time_str, r);
  -                }
  -                else {
  -                    rputs("                 ", r);
  -                }
  -            }
  -            if (!(autoindex_opts & SUPPRESS_SIZE)) {
  -                send_size(ar[x]->size, r);
  -                rputs("  ", r);
  -            }
  -            if (!(autoindex_opts & SUPPRESS_DESC)) {
  -                if (ar[x]->desc) {
  -                    rputs(terminate_description(d, ar[x]->desc, autoindex_opts), r);
  -                }
  -            }
  -        }
  -        else
  -            rvputs(r, "<LI> ", anchor, " ", t2, NULL);
  -        rputc('\n', r);
  +    for (x = 0; x < n; x++) {
  +	char *anchor = NULL, *t = NULL, *t2 = NULL;
  +
  +	clear_pool(scratch);
  +
  +	if ((!strcmp(ar[x]->name, "../")) || (!strcmp(ar[x]->name, ".."))) {
  +	    t = make_full_path(scratch, name, "../");
  +	    getparents(t);
  +	    if (t[0] == '\0')
  +		t = "/";
  +	    anchor = pstrcat(scratch, "<A HREF=\"",
  +			escape_html(scratch, os_escape_path(scratch, t, 0)),
  +			     "\">", NULL);
  +	    t2 = "Parent Directory</A>       ";
  +	}
  +	else {
  +	    t = ar[x]->name;
  +	    len = strlen(t);
  +	    if (len > 23) {
  +		t2 = pstrdup(scratch, t);
  +		t2[21] = '.';
  +		t2[22] = '.';
  +		t2[23] = '\0';
  +		t2 = escape_html(scratch, t2);
  +		t2 = pstrcat(scratch, t2, "</A>", NULL);
  +	    }
  +	    else {
  +		char buff[24] = "                       ";
  +		t2 = escape_html(scratch, t);
  +		buff[23 - len] = '\0';
  +		t2 = pstrcat(scratch, t2, "</A>", buff, NULL);
  +	    }
  +	    anchor = pstrcat(scratch, "<A HREF=\"",
  +			escape_html(scratch, os_escape_path(scratch, t, 0)),
  +			     "\">", NULL);
  +	}
  +
  +	if (autoindex_opts & FANCY_INDEXING) {
  +	    if (autoindex_opts & ICONS_ARE_LINKS)
  +		rputs(anchor, r);
  +	    if ((ar[x]->icon) || d->default_icon) {
  +		rvputs(r, "<IMG SRC=\"",
  +		       escape_html(scratch, ar[x]->icon ?
  +				   ar[x]->icon : d->default_icon),
  +		       "\" ALT=\"[", (ar[x]->alt ? ar[x]->alt : "   "),
  +		       "]\"", NULL);
  +		if (d->icon_width && d->icon_height) {
  +		    rprintf
  +			(
  +			    r,
  +			    " HEIGHT=\"%d\" WIDTH=\"%d\"",
  +			    d->icon_height,
  +			    d->icon_width
  +			);
  +		}
  +		rputs(">", r);
  +	    }
  +	    if (autoindex_opts & ICONS_ARE_LINKS)
  +		rputs("</A>", r);
  +
  +	    rvputs(r, " ", anchor, t2, NULL);
  +	    if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
  +		if (ar[x]->lm != -1) {
  +		    char time_str[MAX_STRING_LEN];
  +		    struct tm *ts = localtime(&ar[x]->lm);
  +		    strftime(time_str, MAX_STRING_LEN, "%d-%b-%y %H:%M  ", ts);
  +		    rputs(time_str, r);
  +		}
  +		else {
  +		    rputs("                 ", r);
  +		}
  +	    }
  +	    if (!(autoindex_opts & SUPPRESS_SIZE)) {
  +		send_size(ar[x]->size, r);
  +		rputs("  ", r);
  +	    }
  +	    if (!(autoindex_opts & SUPPRESS_DESC)) {
  +		if (ar[x]->desc) {
  +		    rputs(terminate_description(d, ar[x]->desc, autoindex_opts), r);
  +		}
  +	    }
  +	}
  +	else
  +	    rvputs(r, "<LI> ", anchor, " ", t2, NULL);
  +	rputc('\n', r);
       }
       if (autoindex_opts & FANCY_INDEXING) {
  -        rputs("</PRE>", r);
  +	rputs("</PRE>", r);
       }
       else {
  -        rputs("</UL>", r);
  +	rputs("</UL>", r);
       }
   }
   
  @@ -877,20 +900,20 @@
        */
       switch ((*e1)->key) {
       case K_LAST_MOD:
  -	s1 = (*e1)->lm_cmp;
  +	    s1 = (*e1)->lm_cmp;
   	s2 = (*e2)->lm_cmp;
   	break;
       case K_SIZE:
  -	s1 = (*e1)->size_cmp;
  +	    s1 = (*e1)->size_cmp;
   	s2 = (*e2)->size_cmp;
   	break;
       case K_DESC:
  -	s1 = (*e1)->desc;
  +	    s1 = (*e1)->desc;
   	s2 = (*e2)->desc;
   	break;
       case K_NAME:
  -    default:
  -	s1 = (*e1)->name;
  +	    default:
  +	    s1 = (*e1)->name;
   	s2 = (*e2)->name;
   	break;
       }
  @@ -942,13 +965,13 @@
       return result;
   }
   
  -    
  -static int index_directory(request_rec *r, autoindex_config_rec *autoindex_conf)
  +
  +static int index_directory(request_rec *r, autoindex_config_rec * autoindex_conf)
   {
       char *title_name = escape_html(r->pool, r->uri);
       char *title_endp;
       char *name = r->filename;
  -    
  +
       DIR *d;
       struct DIR_TYPE *dstruct;
       int num_ent = 0, x;
  @@ -961,34 +984,33 @@
       char direction;
   
       if (!(d = popendir(r->pool, name))) {
  -        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +	aplog_error(APLOG_MARK, APLOG_ERR, r->server,
   		    "Can't open directory for index: %s", r->filename);
  -        return HTTP_FORBIDDEN;
  +	return HTTP_FORBIDDEN;
       }
   
       r->content_type = "text/html";
  -    
  +
       send_http_header(r);
   
       if (r->header_only) {
  -        pclosedir (r->pool, d);
  -        return 0;
  +	pclosedir(r->pool, d);
  +	return 0;
       }
       hard_timeout("send directory", r);
   
       /* Spew HTML preamble */
  -    
  +
       title_endp = title_name + strlen(title_name) - 1;
   
       while (title_endp > title_name && *title_endp == '/')
  -        *title_endp-- = '\0';
  -    
  -    if (
  -        (! (tmp = find_header(autoindex_conf, r))) ||
  -        (! (insert_readme(name, tmp, title_name, NO_HRULE, FRONT_MATTER, r)))
  -       ) {
  -        emit_preamble (r, title_name);
  -        rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
  +	*title_endp-- = '\0';
  +
  +    if ((!(tmp = find_header(autoindex_conf, r)))
  +	|| (!(insert_readme(name, tmp, title_name, NO_HRULE, FRONT_MATTER, r)))
  +	) {
  +	emit_preamble(r, title_name);
  +	rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
       }
   
       /*
  @@ -1006,7 +1028,7 @@
       }
       else {
   	keyid = *qstring;
  -	getword (r->pool, &qstring, '=');
  +	getword(r->pool, &qstring, '=');
   	if (qstring != '\0') {
   	    direction = *qstring;
   	}
  @@ -1021,28 +1043,28 @@
        */
       head = NULL;
       while ((dstruct = readdir(d))) {
  -        p = make_autoindex_entry(dstruct->d_name, autoindex_opts,
  +	p = make_autoindex_entry(dstruct->d_name, autoindex_opts,
   				 autoindex_conf, r, keyid, direction);
   	if (p != NULL) {
  -            p->next = head;
  -            head = p;
  -            num_ent++;
  -        }
  +	    p->next = head;
  +	    head = p;
  +	    num_ent++;
  +	}
       }
       if (num_ent > 0) {
  -        ar = (struct ent **) palloc(r->pool, num_ent*sizeof(struct ent *));
  -        p = head;
  -        x = 0;
  -        while (p) {
  -            ar[x++] = p;
  -            p = p->next;
  -        }
  -    
  +	ar = (struct ent **) palloc(r->pool, num_ent * sizeof(struct ent *));
  +	p = head;
  +	x = 0;
  +	while (p) {
  +	    ar[x++] = p;
  +	    p = p->next;
  +	}
  +
   #ifdef ULTRIX_BRAIN_DEATH
  -        qsort((void *)ar, num_ent, sizeof(struct ent *), (int (*))dsortf);
  +	qsort((void *) ar, num_ent, sizeof(struct ent *), (int (*)) dsortf);
   #else
  -        qsort((void *)ar, num_ent, sizeof(struct ent *),
  -              (int (*)(const void *, const void *))dsortf);
  +	qsort((void *) ar, num_ent, sizeof(struct ent *),
  +	          (int (*)(const void *, const void *)) dsortf);
   #endif
       }
       output_directories(ar, num_ent, autoindex_conf, r, autoindex_opts, keyid,
  @@ -1050,13 +1072,13 @@
       pclosedir(r->pool, d);
   
       if (autoindex_opts & FANCY_INDEXING) {
  -        if ((tmp = find_readme(autoindex_conf, r)))
  -            insert_readme(name, tmp, "", HRULE, END_MATTER, r);
  +	if ((tmp = find_readme(autoindex_conf, r)))
  +	    insert_readme(name, tmp, "", HRULE, END_MATTER, r);
   	else {
   	    rputs("</UL>", r);
   	}
       }
  -    rputs ("</BODY></HTML>\n", r);
  +    rputs("</BODY></HTML>\n", r);
   
       kill_timeout(r);
       return 0;
  @@ -1064,59 +1086,62 @@
   
   /* The formal handler... */
   
  -static int handle_autoindex (request_rec *r)
  +static int handle_autoindex(request_rec *r)
   {
       autoindex_config_rec *d =
  -	(autoindex_config_rec *)get_module_config(r->per_dir_config,
  -						  &autoindex_module);
  -    int allow_opts = allow_options (r);
  +    (autoindex_config_rec *) get_module_config(r->per_dir_config,
  +					       &autoindex_module);
  +    int allow_opts = allow_options(r);
  +
  +    if (r->method_number != M_GET)
  +	return NOT_IMPLEMENTED;
   
  -    if (r->method_number != M_GET) return NOT_IMPLEMENTED;
  -    
       /* OK, nothing easy.  Trot out the heavy artillery... */
   
       if (allow_opts & OPT_INDEXES) {
  -        /* KLUDGE --- make the sub_req lookups happen in the right directory.
  -        * Fixing this in the sub_req_lookup functions themselves is difficult,
  -        * and would probably break virtual includes...
  -        */
  -
  -        if (r->filename[strlen (r->filename) - 1] != '/') {
  -            r->filename = pstrcat (r->pool, r->filename, "/", NULL);
  -        }
  -        return index_directory (r, d);
  +	/* KLUDGE --- make the sub_req lookups happen in the right directory.
  +	   * Fixing this in the sub_req_lookup functions themselves is difficult,
  +	   * and would probably break virtual includes...
  +	 */
  +
  +	if (r->filename[strlen(r->filename) - 1] != '/') {
  +	    r->filename = pstrcat(r->pool, r->filename, "/", NULL);
  +	}
  +	return index_directory(r, d);
       }
  -     else {
  -        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +    else {
  +	aplog_error(APLOG_MARK, APLOG_ERR, r->server,
   		    "Directory index forbidden by rule: %s", r->filename);
  -        return HTTP_FORBIDDEN;
  +	return HTTP_FORBIDDEN;
       }
   }
   
   
  -static handler_rec autoindex_handlers[] = {
  -{ DIR_MAGIC_TYPE, handle_autoindex },
  -{ NULL }
  +static handler_rec autoindex_handlers[] =
  +{
  +    {DIR_MAGIC_TYPE, handle_autoindex},
  +    {NULL}
   };
   
  -module MODULE_VAR_EXPORT autoindex_module = {
  -   STANDARD_MODULE_STUFF,
  -   NULL,                        /* initializer */
  -   create_autoindex_config,     /* dir config creater */
  -   merge_autoindex_configs,     /* dir merger --- default is to override */
  -   NULL,                        /* server config */
  -   NULL,                        /* merge server config */
  -   autoindex_cmds,              /* command table */
  -   autoindex_handlers,          /* handlers */
  -   NULL,                        /* filename translation */
  -   NULL,                        /* check_user_id */
  -   NULL,                        /* check auth */
  -   NULL,                        /* check access */
  -   NULL,                        /* type_checker */
  -   NULL,                        /* fixups */
  -   NULL,                        /* logger */
  -   NULL,                        /* header parser */
  -   NULL,			/* child_init */
  -   NULL,			/* child_exit */
  -   NULL				/* post read-request */
  +module MODULE_VAR_EXPORT autoindex_module =
  +{
  +    STANDARD_MODULE_STUFF,
  +    NULL,			/* initializer */
  +    create_autoindex_config,	/* dir config creater */
  +    merge_autoindex_configs,	/* dir merger --- default is to override */
  +    NULL,			/* server config */
  +    NULL,			/* merge server config */
  +    autoindex_cmds,		/* command table */
  +    autoindex_handlers,		/* handlers */
  +    NULL,			/* filename translation */
  +    NULL,			/* check_user_id */
  +    NULL,			/* check auth */
  +    NULL,			/* check access */
  +    NULL,			/* type_checker */
  +    NULL,			/* fixups */
  +    NULL,			/* logger */
  +    NULL,			/* header parser */
  +    NULL,			/* child_init */
  +    NULL,			/* child_exit */
  +    NULL			/* post read-request */
   };
  
  
  
  1.20      +89 -84    apachen/src/modules/standard/mod_cern_meta.c
  
  Index: mod_cern_meta.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/standard/mod_cern_meta.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mod_cern_meta.c	1997/08/31 22:53:12	1.19
  +++ mod_cern_meta.c	1997/09/18 08:12:22	1.20
  @@ -165,10 +165,10 @@
       char *metafiles;
   } cern_meta_dir_config;
   
  -void *create_cern_meta_dir_config (pool *p, char *dummy)
  +void *create_cern_meta_dir_config(pool *p, char *dummy)
   {
       cern_meta_dir_config *new =
  -	(cern_meta_dir_config *)palloc(p, sizeof(cern_meta_dir_config));
  +    (cern_meta_dir_config *) palloc(p, sizeof(cern_meta_dir_config));
   
       new->metadir = NULL;
       new->metasuffix = NULL;
  @@ -177,47 +177,48 @@
       return new;
   }
   
  -void *merge_cern_meta_dir_configs (pool *p, void *basev, void *addv) 
  +void *merge_cern_meta_dir_configs(pool *p, void *basev, void *addv)
   {
  -    cern_meta_dir_config *base = (cern_meta_dir_config *)basev;
  -    cern_meta_dir_config *add = (cern_meta_dir_config *)addv; 
  +    cern_meta_dir_config *base = (cern_meta_dir_config *) basev;
  +    cern_meta_dir_config *add = (cern_meta_dir_config *) addv;
       cern_meta_dir_config *new =
  -	(cern_meta_dir_config *)palloc(p, sizeof(cern_meta_dir_config));
  -    
  +    (cern_meta_dir_config *) palloc(p, sizeof(cern_meta_dir_config));
  +
       new->metadir = add->metadir ? add->metadir : base->metadir;
       new->metasuffix = add->metasuffix ? add->metasuffix : base->metasuffix;
       new->metafiles = add->metafiles;
   
       return new;
  -}   
  +}
   
  -const char *set_metadir (cmd_parms *parms, cern_meta_dir_config *dconf, char *arg)
  -{       
  +const char *set_metadir(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg)
  +{
       dconf->metadir = arg;
       return NULL;
   }
   
  -const char *set_metasuffix (cmd_parms *parms, cern_meta_dir_config *dconf, char *arg)
  -{       
  +const char *set_metasuffix(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg)
  +{
       dconf->metasuffix = arg;
       return NULL;
   }
  -  
  -const char *set_metafiles (cmd_parms *parms, cern_meta_dir_config *dconf, char *arg) 
  +
  +const char *set_metafiles(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg)
   {
       dconf->metafiles = arg;
       return NULL;
   }
   
   
  -command_rec cern_meta_cmds[] = {
  -{ "MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS, FLAG, NULL},
  -{ "MetaDir", set_metadir, NULL, DIR_CMD_PERMS, TAKE1,
  -    "the name of the directory containing meta files"},
  -{ "MetaSuffix", set_metasuffix, NULL, DIR_CMD_PERMS, TAKE1,
  -    "the filename suffix for meta files"},
  -{ NULL }
  -};  
  +command_rec cern_meta_cmds[] =
  +{
  +    {"MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS, FLAG, NULL},
  +    {"MetaDir", set_metadir, NULL, DIR_CMD_PERMS, TAKE1,
  +     "the name of the directory containing meta files"},
  +    {"MetaSuffix", set_metasuffix, NULL, DIR_CMD_PERMS, TAKE1,
  +     "the filename suffix for meta files"},
  +    {NULL}
  +};
   
   int scan_meta_file(request_rec *r, FILE *f)
   {
  @@ -225,67 +226,70 @@
       char *l;
       int p;
   
  -    while( fgets(w, MAX_STRING_LEN-1, f) != NULL ) {
  +    while (fgets(w, MAX_STRING_LEN - 1, f) != NULL) {
   
   	/* Delete terminal (CR?)LF */
  -	
  +
   	p = strlen(w);
  -	if (p > 0 && w[p-1] == '\n')
  -	{
  -	    if (p > 1 && w[p-2] == '\015') w[p-2] = '\0';
  -	    else w[p-1] = '\0';
  +	if (p > 0 && w[p - 1] == '\n') {
  +	    if (p > 1 && w[p - 2] == '\015')
  +		w[p - 2] = '\0';
  +	    else
  +		w[p - 1] = '\0';
   	}
   
  -        if (w[0] == '\0') {
  +	if (w[0] == '\0') {
   	    return OK;
   	}
  -                                   
  +
   	/* if we see a bogus header don't ignore it. Shout and scream */
  -	
  -        if (!(l = strchr(w,':'))) {
  +
  +	if (!(l = strchr(w, ':'))) {
   	    aplog_error(APLOG_MARK, APLOG_ERR, r->server,
   			"malformed header in meta file: %s", r->filename);
   	    return SERVER_ERROR;
  -        }
  +	}
  +
  +	*l++ = '\0';
  +	while (*l && isspace(*l))
  +	    ++l;
   
  -        *l++ = '\0';
  -	while (*l && isspace (*l)) ++l;
  -	
  -        if (!strcasecmp(w,"Content-type")) {
  +	if (!strcasecmp(w, "Content-type")) {
   
   	    /* Nuke trailing whitespace */
  -	    
  +
   	    char *endp = l + strlen(l) - 1;
  -	    while (endp > l && isspace(*endp)) *endp-- = '\0';
  -	    
  +	    while (endp > l && isspace(*endp))
  +		*endp-- = '\0';
  +
   	    r->content_type = pstrdup(r->pool, l);
   	}
  -        else if (!strcasecmp(w,"Status")) {
  -            sscanf(l, "%d", &r->status);
  -            r->status_line = pstrdup(r->pool, l);
  -        }
  -        else {
  +	else if (!strcasecmp(w, "Status")) {
  +	    sscanf(l, "%d", &r->status);
  +	    r->status_line = pstrdup(r->pool, l);
  +	}
  +	else {
   	    table_set(r->headers_out, w, l);
  -        }
  +	}
       }
       return OK;
   }
   
  -int add_cern_meta_data (request_rec *r)
  +int add_cern_meta_data(request_rec *r)
   {
       char *metafilename;
       char *last_slash;
       char *real_file;
       char *scrap_book;
  -    FILE *f;   
  -    cern_meta_dir_config *dconf ;
  +    FILE *f;
  +    cern_meta_dir_config *dconf;
       int rv;
       request_rec *rr;
   
  -    dconf = get_module_config(r->per_dir_config, &cern_meta_module); 
  +    dconf = get_module_config(r->per_dir_config, &cern_meta_module);
   
       if (!dconf->metafiles) {
  -        return DECLINED;
  +	return DECLINED;
       };
   
       /* if ./.web/$1.meta exists then output 'asis' */
  @@ -300,11 +304,11 @@
       };
   
       /* what directory is this file in? */
  -    scrap_book = pstrdup( r->pool, r->filename );
  +    scrap_book = pstrdup(r->pool, r->filename);
       /* skip leading slash, recovered in later processing */
       scrap_book++;
  -    last_slash = strrchr( scrap_book, '/' );
  -    if ( last_slash != NULL ) {
  +    last_slash = strrchr(scrap_book, '/');
  +    if (last_slash != NULL) {
   	/* skip over last slash */
   	real_file = last_slash;
   	real_file++;
  @@ -312,17 +316,17 @@
       }
       else {
   	/* no last slash, buh?! */
  -        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +	aplog_error(APLOG_MARK, APLOG_ERR, r->server,
   		    "internal error in mod_cern_meta", r->filename);
   	/* should really barf, but hey, let's be friends... */
   	return DECLINED;
       };
   
  -    metafilename = pstrcat(r->pool, "/", scrap_book, "/", 
  -        dconf->metadir ? dconf->metadir : DEFAULT_METADIR, 
  -        "/", real_file, 
  -        dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX, 
  -        NULL);
  +    metafilename = pstrcat(r->pool, "/", scrap_book, "/",
  +			   dconf->metadir ? dconf->metadir : DEFAULT_METADIR,
  +			   "/", real_file,
  +		 dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX,
  +			   NULL);
   
       /* XXX: it sucks to require this subrequest to complete, because this
        * means people must leave their meta files accessible to the world.
  @@ -341,36 +345,37 @@
   	if (errno == ENOENT) {
   	    return DECLINED;
   	}
  -        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  -		    "meta file permissions deny server access: %s", metafilename);
  -        return FORBIDDEN;
  +	aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +	      "meta file permissions deny server access: %s", metafilename);
  +	return FORBIDDEN;
       };
   
       /* read the headers in */
       rv = scan_meta_file(r, f);
  -    pfclose( r->pool, f );
  +    pfclose(r->pool, f);
   
       return rv;
   }
   
  -module MODULE_VAR_EXPORT cern_meta_module = {
  -   STANDARD_MODULE_STUFF,
  -   NULL,			/* initializer */
  -   create_cern_meta_dir_config,	/* dir config creater */
  -   merge_cern_meta_dir_configs,	/* dir merger --- default is to override */
  -   NULL,			/* server config */
  -   NULL,			/* merge server configs */
  -   cern_meta_cmds,		/* command table */
  -   NULL,			/* handlers */
  -   NULL,			/* filename translation */
  -   NULL,			/* check_user_id */
  -   NULL,			/* check auth */
  -   NULL,			/* check access */
  -   NULL,			/* type_checker */
  -   add_cern_meta_data,		/* fixups */
  -   NULL,			/* logger */
  -   NULL,			/* header parser */
  -   NULL,			/* child_init */
  -   NULL,			/* child_exit */
  -   NULL				/* post read-request */
  +module MODULE_VAR_EXPORT cern_meta_module =
  +{
  +    STANDARD_MODULE_STUFF,
  +    NULL,			/* initializer */
  +    create_cern_meta_dir_config,	/* dir config creater */
  +    merge_cern_meta_dir_configs,	/* dir merger --- default is to override */
  +    NULL,			/* server config */
  +    NULL,			/* merge server configs */
  +    cern_meta_cmds,		/* command table */
  +    NULL,			/* handlers */
  +    NULL,			/* filename translation */
  +    NULL,			/* check_user_id */
  +    NULL,			/* check auth */
  +    NULL,			/* check access */
  +    NULL,			/* type_checker */
  +    add_cern_meta_data,		/* fixups */
  +    NULL,			/* logger */
  +    NULL,			/* header parser */
  +    NULL,			/* child_init */
  +    NULL,			/* child_exit */
  +    NULL			/* post read-request */
   };
  
  
  
  1.56      +196 -186  apachen/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- mod_cgi.c	1997/08/31 22:59:08	1.55
  +++ mod_cgi.c	1997/09/18 08:12:23	1.56
  @@ -81,10 +81,10 @@
    * leaves a note for us.
    */
   
  -static int is_scriptaliased (request_rec *r)
  +static int is_scriptaliased(request_rec *r)
   {
  -    char *t = table_get (r->notes, "alias-forced-type");
  -    return t && (!strcmp (t, "cgi-script"));
  +    char *t = table_get(r->notes, "alias-forced-type");
  +    return t && (!strcmp(t, "cgi-script"));
   }
   
   /* Configuration stuff */
  @@ -98,10 +98,10 @@
       int bufbytes;
   } cgi_server_conf;
   
  -static void *create_cgi_config (pool *p, server_rec *s)
  +static void *create_cgi_config(pool *p, server_rec *s)
   {
  -    cgi_server_conf *c = 
  -      (cgi_server_conf *)pcalloc (p, sizeof(cgi_server_conf));
  +    cgi_server_conf *c =
  +    (cgi_server_conf *) pcalloc(p, sizeof(cgi_server_conf));
   
       c->logname = NULL;
       c->logbytes = DEFAULT_LOGBYTES;
  @@ -110,53 +110,56 @@
       return c;
   }
   
  -static void *merge_cgi_config (pool *p, void *basev, void *overridesv)
  +static void *merge_cgi_config(pool *p, void *basev, void *overridesv)
   {
  -    cgi_server_conf *base = (cgi_server_conf *)basev,
  -      *overrides = (cgi_server_conf *)overridesv;
  +    cgi_server_conf *base = (cgi_server_conf *) basev, *overrides = (cgi_server_conf *) overridesv;
   
       return overrides->logname ? overrides : base;
   }
   
  -static const char *set_scriptlog (cmd_parms *cmd, void *dummy, char *arg) {
  +static const char *set_scriptlog(cmd_parms *cmd, void *dummy, char *arg)
  +{
       server_rec *s = cmd->server;
  -    cgi_server_conf *conf = 
  -      (cgi_server_conf *)get_module_config(s->module_config, &cgi_module);
  +    cgi_server_conf *conf =
  +    (cgi_server_conf *) get_module_config(s->module_config, &cgi_module);
   
       conf->logname = arg;
       return NULL;
   }
   
  -static const char *set_scriptlog_length (cmd_parms *cmd, void *dummy, char *arg) {
  +static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, char *arg)
  +{
       server_rec *s = cmd->server;
  -    cgi_server_conf *conf = 
  -      (cgi_server_conf *)get_module_config(s->module_config, &cgi_module);
  +    cgi_server_conf *conf =
  +    (cgi_server_conf *) get_module_config(s->module_config, &cgi_module);
   
  -    conf->logbytes = atol (arg);
  +    conf->logbytes = atol(arg);
       return NULL;
   }
   
  -static const char *set_scriptlog_buffer (cmd_parms *cmd, void *dummy, char *arg) {
  +static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, char *arg)
  +{
       server_rec *s = cmd->server;
  -    cgi_server_conf *conf = 
  -      (cgi_server_conf *)get_module_config(s->module_config, &cgi_module);
  +    cgi_server_conf *conf =
  +    (cgi_server_conf *) get_module_config(s->module_config, &cgi_module);
   
  -    conf->bufbytes = atoi (arg);
  +    conf->bufbytes = atoi(arg);
       return NULL;
   }
   
  -static command_rec cgi_cmds[] = {
  -{ "ScriptLog", set_scriptlog, NULL, RSRC_CONF, TAKE1,
  -  "the name of a log for script debugging info"},
  -{ "ScriptLogLength", set_scriptlog_length, NULL, RSRC_CONF, TAKE1,
  -  "the maximum length (in bytes) of the script debug log"},
  -{ "ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, TAKE1,
  -  "the maximum size (in bytes) to record of a POST request"},
  -{ NULL}
  +static command_rec cgi_cmds[] =
  +{
  +    {"ScriptLog", set_scriptlog, NULL, RSRC_CONF, TAKE1,
  +     "the name of a log for script debugging info"},
  +    {"ScriptLogLength", set_scriptlog_length, NULL, RSRC_CONF, TAKE1,
  +     "the maximum length (in bytes) of the script debug log"},
  +    {"ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, TAKE1,
  +     "the maximum size (in bytes) to record of a POST request"},
  +    {NULL}
   };
   
  -static int log_scripterror (request_rec *r, cgi_server_conf *conf, int ret,
  -			    char *error)
  +static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret,
  +			   char *error)
   {
       FILE *f;
   
  @@ -164,10 +167,10 @@
   
       if (!conf->logname ||
   	((stat(server_root_relative(r->pool, conf->logname), &r->finfo) == 0)
  -	&& (r->finfo.st_size > conf->logbytes)) ||
  -	((f = pfopen(r->pool, server_root_relative(r->pool, conf->logname),
  -		     "a")) == NULL)) {
  -      return ret;
  +	 &&   (r->finfo.st_size > conf->logbytes)) ||
  +         ((f = pfopen(r->pool, server_root_relative(r->pool, conf->logname),
  +		      "a")) == NULL)) {
  +	return ret;
       }
   
       /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */
  @@ -182,26 +185,26 @@
       return ret;
   }
   
  -static int log_script (request_rec *r, cgi_server_conf *conf, int ret,
  -		       char *dbuf, char *sbuf, BUFF *script_in, BUFF *script_err)
  +static int log_script(request_rec *r, cgi_server_conf * conf, int ret,
  +		  char *dbuf, char *sbuf, BUFF *script_in, BUFF *script_err)
   {
       table *hdrs_arr = r->headers_in;
  -    table_entry *hdrs = (table_entry *)hdrs_arr->elts;
  +    table_entry *hdrs = (table_entry *) hdrs_arr->elts;
       char argsbuffer[HUGE_STRING_LEN];
       FILE *f;
       int i;
   
       if (!conf->logname ||
   	((stat(server_root_relative(r->pool, conf->logname), &r->finfo) == 0)
  -	&& (r->finfo.st_size > conf->logbytes)) ||
  -	((f = pfopen(r->pool, server_root_relative(r->pool, conf->logname),
  -		     "a")) == NULL)) {
  -      /* Soak up script output */
  -      while (bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
  -	continue;
  -      while (bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
  -	continue;
  -      return ret;
  +	 &&   (r->finfo.st_size > conf->logbytes)) ||
  +         ((f = pfopen(r->pool, server_root_relative(r->pool, conf->logname),
  +		      "a")) == NULL)) {
  +	/* Soak up script output */
  +	while (bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
  +	    continue;
  +	while (bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
  +	    continue;
  +	return ret;
       }
   
       /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */
  @@ -212,40 +215,42 @@
   
       fputs("%request\n", f);
       for (i = 0; i < hdrs_arr->nelts; ++i) {
  -      if (!hdrs[i].key) continue;
  -      fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val);
  +	if (!hdrs[i].key)
  +	    continue;
  +	fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val);
       }
       if ((r->method_number == M_POST || r->method_number == M_PUT)
   	&& *dbuf) {
  -      fprintf(f, "\n%s\n", dbuf);
  +	fprintf(f, "\n%s\n", dbuf);
       }
   
       fputs("%response\n", f);
       hdrs_arr = r->err_headers_out;
  -    hdrs = (table_entry *)hdrs_arr->elts;
  +    hdrs = (table_entry *) hdrs_arr->elts;
   
       for (i = 0; i < hdrs_arr->nelts; ++i) {
  -      if (!hdrs[i].key) continue;
  -      fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val);
  +	if (!hdrs[i].key)
  +	    continue;
  +	fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val);
       }
   
       if (sbuf && *sbuf)
  -      fprintf(f, "%s\n", sbuf);
  +	fprintf(f, "%s\n", sbuf);
   
       if (bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) {
  -      fputs("%stdout\n", f);
  -      fputs(argsbuffer, f);
  -      while (bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
  +	fputs("%stdout\n", f);
   	fputs(argsbuffer, f);
  -      fputs("\n", f);
  +	while (bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
  +	    fputs(argsbuffer, f);
  +	fputs("\n", f);
       }
   
       if (bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
  -      fputs("%stderr\n", f);
  -      fputs(argsbuffer, f);
  -      while (bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
  +	fputs("%stderr\n", f);
   	fputs(argsbuffer, f);
  -      fputs("\n", f);
  +	while (bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
  +	    fputs(argsbuffer, f);
  +	fputs("\n", f);
       }
   
       bclose(script_in);
  @@ -268,54 +273,55 @@
       char *argv0;
   };
   
  -static int cgi_child (void *child_stuff)
  +static int cgi_child(void *child_stuff)
   {
  -    struct cgi_child_stuff *cld = (struct cgi_child_stuff *)child_stuff;
  +    struct cgi_child_stuff *cld = (struct cgi_child_stuff *) child_stuff;
       request_rec *r = cld->r;
       char *argv0 = cld->argv0;
       int child_pid;
   
  -#ifdef DEBUG_CGI    
  +#ifdef DEBUG_CGI
   #ifdef __EMX__
       /* Under OS/2 need to use device con. */
  -    FILE *dbg = fopen ("con", "w");
  -#else    
  -    FILE *dbg = fopen ("/dev/tty", "w");
  -#endif    
  +    FILE *dbg = fopen("con", "w");
  +#else
  +    FILE *dbg = fopen("/dev/tty", "w");
  +#endif
       int i;
   #endif
  -    
  +
       char **env;
   #ifndef WIN32
       char err_string[HUGE_STRING_LEN];
   #endif
  -    
  -#ifdef DEBUG_CGI    
  -    fprintf (dbg, "Attempting to exec %s as %sCGI child (argv0 = %s)\n",
  +
  +#ifdef DEBUG_CGI
  +    fprintf(dbg, "Attempting to exec %s as %sCGI child (argv0 = %s)\n",
   	    r->filename, nph ? "NPH " : "", argv0);
  -#endif    
  +#endif
  +
  +    add_cgi_vars(r);
  +    env = create_environment(r->pool, r->subprocess_env);
   
  -    add_cgi_vars (r);
  -    env = create_environment (r->pool, r->subprocess_env);
  -    
  -#ifdef DEBUG_CGI    
  -    fprintf (dbg, "Environment: \n");
  -    for (i = 0; env[i]; ++i) fprintf (dbg, "'%s'\n", env[i]);
  +#ifdef DEBUG_CGI
  +    fprintf(dbg, "Environment: \n");
  +    for (i = 0; env[i]; ++i)
  +	fprintf(dbg, "'%s'\n", env[i]);
   #endif
  -    
  -    chdir_file (r->filename);
  +
  +    chdir_file(r->filename);
       if (!cld->debug)
  -      error_log2stderr (r->server);
  +	error_log2stderr(r->server);
   
       /* Transumute outselves into the script.
        * NB only ISINDEX scripts get decoded arguments.
        */
  -    
  +
       cleanup_for_exec();
  -    
  +
       child_pid = call_exec(r, argv0, env, 0);
   #ifdef WIN32
  -    return(child_pid);
  +    return (child_pid);
   #else
   
       /* Uh oh.  Still here.  Where's the kaboom?  There was supposed to be an
  @@ -328,65 +334,66 @@
        * was tied to in cleanup_for_exec().  It's only available on stderr
        * now, so that's what we use).
        */
  -    
  +
       ap_snprintf(err_string, sizeof(err_string),
  -	    "exec of %s failed, reason: %s (errno = %d)\n", 
  -            r->filename, strerror(errno), errno);
  +		"exec of %s failed, reason: %s (errno = %d)\n",
  +		r->filename, strerror(errno), errno);
       write(STDERR_FILENO, err_string, strlen(err_string));
       exit(0);
       /* NOT REACHED */
  -    return(0);
  +    return (0);
   #endif
   }
   
  -static int cgi_handler (request_rec *r)
  +static int cgi_handler(request_rec *r)
   {
       int retval, nph, dbpos = 0;
       char *argv0, *dbuf = NULL;
       BUFF *script_out, *script_in, *script_err;
       char argsbuffer[HUGE_STRING_LEN];
  -    int is_included = !strcmp (r->protocol, "INCLUDED");
  +    int is_included = !strcmp(r->protocol, "INCLUDED");
       void *sconf = r->server->module_config;
       cgi_server_conf *conf =
  -	(cgi_server_conf *)get_module_config(sconf, &cgi_module);
  +    (cgi_server_conf *) get_module_config(sconf, &cgi_module);
   
       struct cgi_child_stuff cld;
       pid_t child_pid;
   
       if (r->method_number == M_OPTIONS) {
  -        /* 99 out of 100 CGI scripts, this is all they support */
  -        r->allowed |= (1 << M_GET);
  -        r->allowed |= (1 << M_POST);
  +	/* 99 out of 100 CGI scripts, this is all they support */
  +	r->allowed |= (1 << M_GET);
  +	r->allowed |= (1 << M_POST);
   	return DECLINED;
       }
   
  -    if((argv0 = strrchr(r->filename,'/')) != NULL)
  -        argv0++;
  -    else argv0 = r->filename;
  +    if ((argv0 = strrchr(r->filename, '/')) != NULL)
  +	argv0++;
  +    else
  +	argv0 = r->filename;
   
  -    nph = !(strncmp(argv0,"nph-",4));
  +    nph = !(strncmp(argv0, "nph-", 4));
   
  -    if (!(allow_options (r) & OPT_EXECCGI) && !is_scriptaliased (r))
  +    if (!(allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r))
   	return log_scripterror(r, conf, FORBIDDEN,
   			       "Options ExecCGI is off in this directory");
       if (nph && is_included)
   	return log_scripterror(r, conf, FORBIDDEN,
   			       "attempt to include NPH CGI script");
  -    
  +
       if (S_ISDIR(r->finfo.st_mode))
   	return log_scripterror(r, conf, FORBIDDEN,
   			       "attempt to invoke directory as script");
   #if defined(__EMX__) || defined(WIN32)
       /* Allow for cgi files without the .EXE extension on them under OS/2 */
       if (r->finfo.st_mode == 0) {
  -        struct stat statbuf;
  +	struct stat statbuf;
   
  -        r->filename = pstrcat (r->pool, r->filename, ".EXE", NULL);
  +	r->filename = pstrcat(r->pool, r->filename, ".EXE", NULL);
   
  -        if ((stat(r->filename, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) {
  -            return log_scripterror(r, conf, NOT_FOUND,
  -                                   "script not found or unable to stat");
  -        }
  +	if ((stat(r->filename, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) {
  +	    return log_scripterror(r, conf, NOT_FOUND,
  +				   "script not found or unable to stat");
  +	}
       }
   #else
       if (r->finfo.st_mode == 0)
  @@ -394,18 +401,20 @@
   			       "script not found or unable to stat");
   #endif
       if (!suexec_enabled) {
  -        if (!can_exec(&r->finfo))
  -            return log_scripterror(r, conf, FORBIDDEN,
  -                                   "file permissions deny server execution");
  +	if (!can_exec(&r->finfo))
  +	    return log_scripterror(r, conf, FORBIDDEN,
  +				   "file permissions deny server execution");
       }
   
       if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR)))
   	return retval;
   
  -    add_common_vars (r);
  -    cld.argv0 = argv0; cld.r = r; cld.nph = nph;
  +    add_common_vars(r);
  +    cld.argv0 = argv0;
  +    cld.r = r;
  +    cld.nph = nph;
       cld.debug = conf->logname ? 1 : 0;
  -    
  +
       /*
        * we spawn out of r->main if it's there so that we can avoid
        * waiting for free_proc_chain to cleanup in the middle of an
  @@ -413,12 +422,12 @@
        */
       if (!(child_pid =
   	  spawn_child_err_buff(r->main ? r->main->pool : r->pool, cgi_child,
  -			       (void *)&cld,
  +			            (void *) &cld,
   			       kill_after_timeout,
   			       &script_out, &script_in, &script_err))) {
  -        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +	aplog_error(APLOG_MARK, APLOG_ERR, r->server,
   		    "couldn't spawn child process: %s", r->filename);
  -        return SERVER_ERROR;
  +	return SERVER_ERROR;
       }
   
       /* Transfer any put/post args, CERN style...
  @@ -429,76 +438,75 @@
        * on every invocation by chasing the real client data with a
        * spurious newline).
        */
  -    
  -     if (should_client_block(r)) {
  -        void (*handler)(int);
  +
  +    if (should_client_block(r)) {
  +	void (*handler) (int);
   	int dbsize, len_read;
   
   	if (conf->logname) {
  -	    dbuf = pcalloc(r->pool, conf->bufbytes+1);
  +	    dbuf = pcalloc(r->pool, conf->bufbytes + 1);
   	    dbpos = 0;
   	}
   
  -        hard_timeout ("copy script args", r);
  +	hard_timeout("copy script args", r);
   #ifdef SIGPIPE
  -        handler = signal (SIGPIPE, SIG_IGN);
  +	handler = signal(SIGPIPE, SIG_IGN);
   #endif
  -    
  +
   	while ((len_read =
  -                get_client_block(r, argsbuffer, HUGE_STRING_LEN)) > 0)
  -	{
  +		get_client_block(r, argsbuffer, HUGE_STRING_LEN)) > 0) {
   	    if (conf->logname) {
   		if ((dbpos + len_read) > conf->bufbytes) {
   		    dbsize = conf->bufbytes - dbpos;
   		}
  -                else {
  -                    dbsize = len_read;
  -                }
  -                memcpy(dbuf + dbpos, argsbuffer, dbsize);
  +		else {
  +		    dbsize = len_read;
  +		}
  +		memcpy(dbuf + dbpos, argsbuffer, dbsize);
   		dbpos += dbsize;
   	    }
   	    reset_timeout(r);
  -	    if (bwrite(script_out, argsbuffer, len_read)
  -	            < len_read) {
  -	        /* silly script stopped reading, soak up remaining message */
  -	        while (get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0)
  -	            ; /* dump it */
  -	        break;
  +	    if (bwrite(script_out, argsbuffer, len_read) < len_read) {
  +		/* silly script stopped reading, soak up remaining message */
  +		while (get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) {
  +		    /* dump it */
  +		}
  +		break;
   	    }
   	}
   
  -	bflush (script_out);
  -	signal (SIGPIPE, handler);
  -	
  -	kill_timeout (r);
  +	bflush(script_out);
  +	signal(SIGPIPE, handler);
  +
  +	kill_timeout(r);
       }
  -    
  +
       bclose(script_out);
  -    
  +
       /* Handle script return... */
       if (script_in && !nph) {
  -        char *location, sbuf[MAX_STRING_LEN];
  +	char *location, sbuf[MAX_STRING_LEN];
   	int ret;
  -      
  -        if ((ret = scan_script_header_err_buff(r, script_in, sbuf)))
  +
  +	if ((ret = scan_script_header_err_buff(r, script_in, sbuf)))
   	    return log_script(r, conf, ret, dbuf, sbuf, script_in, script_err);
  -	
  -	location = table_get (r->headers_out, "Location");
   
  -        if (location && location[0] == '/' && r->status == 200) {
  -	  
  +	location = table_get(r->headers_out, "Location");
  +
  +	if (location && location[0] == '/' && r->status == 200) {
  +
   	    /* Soak up all the script output */
  -	    hard_timeout ("read from script", r);
  +	    hard_timeout("read from script", r);
   	    while (bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
  -	        continue;
  +		continue;
   	    while (bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
  -	        continue;
  -	    kill_timeout (r);
  +		continue;
  +	    kill_timeout(r);
   
   
  -	   /* This redirect needs to be a GET no matter what the original
  -	    * method was.
  -	    */
  +	    /* This redirect needs to be a GET no matter what the original
  +	     * method was.
  +	     */
   	    r->method = pstrdup(r->pool, "GET");
   	    r->method_number = M_GET;
   
  @@ -508,24 +516,24 @@
   	     */
   	    table_unset(r->headers_in, "Content-Length");
   
  -	    internal_redirect_handler (location, r);
  +	    internal_redirect_handler(location, r);
   	    return OK;
  -        }
  +	}
   	else if (location && r->status == 200) {
   	    /* XX Note that if a script wants to produce its own Redirect
   	     * body, it now has to explicitly *say* "Status: 302"
   	     */
   	    return REDIRECT;
   	}
  -	
  +
   	send_http_header(r);
   	if (!r->header_only)
   	    send_fb(script_in, r);
   	bclose(script_in);
   
   	soft_timeout("soaking script stderr", r);
  -	while(bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
  -	      continue;
  +	while (bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
  +	    continue;
   	kill_timeout(r);
   	bclose(script_err);
       }
  @@ -533,37 +541,39 @@
       if (script_in && nph) {
   	send_fb(script_in, r);
   #if !defined(__EMX__) && !defined(WIN32)
  -	waitpid(child_pid, (int*)0, 0);
  +	waitpid(child_pid, (int *) 0, 0);
   #endif
  -    }    
  +    }
   
       return OK;			/* NOT r->status, even if it has changed. */
   }
   
  -static handler_rec cgi_handlers[] = {
  -{ CGI_MAGIC_TYPE, cgi_handler },
  -{ "cgi-script", cgi_handler },
  -{ NULL }
  +static handler_rec cgi_handlers[] =
  +{
  +    {CGI_MAGIC_TYPE, cgi_handler},
  +    {"cgi-script", cgi_handler},
  +    {NULL}
   };
   
  -module MODULE_VAR_EXPORT cgi_module = {
  -   STANDARD_MODULE_STUFF,
  -   NULL,			/* initializer */
  -   NULL,			/* dir config creater */
  -   NULL,			/* dir merger --- default is to override */
  -   create_cgi_config,		/* server config */
  -   merge_cgi_config,	       	/* merge server config */
  -   cgi_cmds,			/* command table */
  -   cgi_handlers,		/* handlers */
  -   NULL,			/* filename translation */ 
  -   NULL,			/* check_user_id */
  -   NULL,			/* check auth */
  -   NULL,			/* check access */
  -   NULL,			/* type_checker */
  -   NULL,			/* fixups */
  -   NULL,			/* logger */
  -   NULL,			/* header parser */
  -   NULL,			/* child_init */
  -   NULL,			/* child_exit */
  -   NULL				/* post read-request */
  +module MODULE_VAR_EXPORT cgi_module =
  +{
  +    STANDARD_MODULE_STUFF,
  +    NULL,			/* initializer */
  +    NULL,			/* dir config creater */
  +    NULL,			/* dir merger --- default is to override */
  +    create_cgi_config,		/* server config */
  +    merge_cgi_config,		/* merge server config */
  +    cgi_cmds,			/* command table */
  +    cgi_handlers,		/* handlers */
  +    NULL,			/* filename translation */
  +    NULL,			/* check_user_id */
  +    NULL,			/* check auth */
  +    NULL,			/* check access */
  +    NULL,			/* type_checker */
  +    NULL,			/* fixups */
  +    NULL,			/* logger */
  +    NULL,			/* header parser */
  +    NULL,			/* child_init */
  +    NULL,			/* child_exit */
  +    NULL			/* post read-request */
   };
  
  
  
  1.23      +102 -95   apachen/src/modules/standard/mod_digest.c
  
  Index: mod_digest.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/standard/mod_digest.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mod_digest.c	1997/09/02 16:12:15	1.22
  +++ mod_digest.c	1997/09/18 08:12:23	1.23
  @@ -77,48 +77,50 @@
       char *digest;
   } digest_header_rec;
   
  -void *create_digest_dir_config (pool *p, char *d)
  +void *create_digest_dir_config(pool *p, char *d)
   {
  -    return pcalloc (p, sizeof(digest_config_rec));
  +    return pcalloc(p, sizeof(digest_config_rec));
   }
   
  -const char *set_digest_slot (cmd_parms *cmd, void *offset, char *f, char *t)
  +const char *set_digest_slot(cmd_parms *cmd, void *offset, char *f, char *t)
   {
       if (t && strcmp(t, "standard"))
  -	return pstrcat(cmd->pool, "Invalid auth file type: ",  t, NULL);
  +	return pstrcat(cmd->pool, "Invalid auth file type: ", t, NULL);
   
       return set_string_slot(cmd, offset, f);
   }
   
  -command_rec digest_cmds[] = {
  -{ "AuthDigestFile", set_digest_slot,
  -  (void*)XtOffsetOf(digest_config_rec,pwfile), OR_AUTHCFG, TAKE12, NULL },
  -{ NULL }
  +command_rec digest_cmds[] =
  +{
  +    {"AuthDigestFile", set_digest_slot,
  +  (void *) XtOffsetOf(digest_config_rec, pwfile), OR_AUTHCFG, TAKE12, NULL},
  +    {NULL}
   };
   
   module MODULE_VAR_EXPORT digest_module;
   
  -char *get_hash (request_rec *r, char *user, char *auth_pwfile)
  +char *get_hash(request_rec *r, char *user, char *auth_pwfile)
   {
       FILE *f;
       char l[MAX_STRING_LEN];
       const char *rpw;
       char *w, *x;
   
  -    if (!(f=pfopen(r->pool, auth_pwfile, "r"))) {
  -        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +    if (!(f = pfopen(r->pool, auth_pwfile, "r"))) {
  +	aplog_error(APLOG_MARK, APLOG_ERR, r->server,
   		    "Could not open password file: %s", auth_pwfile);
   	return NULL;
       }
  -    while(!(cfg_getline(l,MAX_STRING_LEN,f))) {
  -        if((l[0] == '#') || (!l[0])) continue;
  +    while (!(cfg_getline(l, MAX_STRING_LEN, f))) {
  +	if ((l[0] == '#') || (!l[0]))
  +	    continue;
   	rpw = l;
  -        w = getword(r->pool, &rpw, ':');
  +	w = getword(r->pool, &rpw, ':');
   	x = getword(r->pool, &rpw, ':');
   
  -        if(x && w && !strcmp(user,w) && !strcmp(auth_name(r), x)) {
  +	if (x && w && !strcmp(user, w) && !strcmp(auth_name(r), x)) {
   	    pfclose(r->pool, f);
  -            return pstrdup (r->pool, rpw);
  +	    return pstrdup(r->pool, rpw);
   	}
       }
       pfclose(r->pool, f);
  @@ -127,7 +129,7 @@
   
   /* Parse the Authorization header, if it exists */
   
  -int get_digest_rec (request_rec *r, digest_header_rec *response)
  +int get_digest_rec(request_rec *r, digest_header_rec * response)
   {
       const char *auth_line = table_get(r->headers_in, "Authorization");
       int l;
  @@ -137,13 +139,13 @@
       if (!(t = auth_type(r)) || strcasecmp(t, "Digest"))
   	return DECLINED;
   
  -    if (!auth_name (r)) {
  +    if (!auth_name(r)) {
   	aplog_error(APLOG_MARK, APLOG_ERR, r->server, "need AuthName: %s", r->uri);
   	return SERVER_ERROR;
       }
   
       if (!auth_line) {
  -	note_digest_auth_failure (r);
  +	note_digest_auth_failure(r);
   	return AUTH_REQUIRED;
       }
   
  @@ -157,8 +159,8 @@
   
       l = strlen(auth_line);
   
  -    key = palloc(r->pool,l);
  -    value = palloc(r->pool,l);
  +    key = palloc(r->pool, l);
  +    value = palloc(r->pool, l);
   
       /* There's probably a better way to do this, but for the time being... */
   
  @@ -169,8 +171,8 @@
   
       while (s != D_EXIT) {
   	switch (s) {
  -	case D_STRING:
  -	    if (auth_line[0] == '\"') {
  +	    case D_STRING:
  +		if (auth_line[0] == '\"') {
   		s = D_VALUE;
   	    }
   	    else {
  @@ -180,8 +182,8 @@
   	    auth_line++;
   	    break;
   
  -	case D_VALUE:
  -	    if (isalnum(auth_line[0])) {
  +	    case D_VALUE:
  +		if (isalnum(auth_line[0])) {
   		value[vv] = auth_line[0];
   		vv++;
   	    }
  @@ -201,15 +203,15 @@
   		    response->requested_uri = pstrdup(r->pool, value);
   		else if (!strcasecmp(key, "response"))
   		    response->digest = pstrdup(r->pool, value);
  -		
  +
   		vv = 0;
   		s = D_KEY;
   	    }
   	    auth_line++;
   	    break;
   
  -	case D_KEY:
  -	    if (isalnum(auth_line[0])) {
  +	    case D_KEY:
  +		if (isalnum(auth_line[0])) {
   		key[vk] = auth_line[0];
   		vk++;
   	    }
  @@ -228,7 +230,7 @@
   
       if (!response->username || !response->realm || !response->nonce ||
   	!response->requested_uri || !response->digest) {
  -	note_digest_auth_failure (r);
  +	note_digest_auth_failure(r);
   	return AUTH_REQUIRED;
       }
   
  @@ -240,13 +242,14 @@
   
   /* The actual MD5 code... whee */
   
  -char *find_digest(request_rec *r, digest_header_rec *h, char *a1) {
  -  return ap_md5(r->pool,
  -	        (unsigned char *)pstrcat(r->pool, a1, ":", h->nonce, ":", 
  -			  ap_md5(r->pool,
  -			         (unsigned char *)pstrcat(r->pool,r->method,":",
  -						       h->requested_uri,NULL)),
  -				      NULL));
  +char *find_digest(request_rec *r, digest_header_rec * h, char *a1)
  +{
  +    return ap_md5(r->pool,
  +		  (unsigned char *)pstrcat(r->pool, a1, ":", h->nonce, ":",
  +					   ap_md5(r->pool,
  +		           (unsigned char *)pstrcat(r->pool, r->method, ":",
  +						    h->requested_uri, NULL)),
  +					   NULL));
   }
   
   /* These functions return 0 if client is OK, and proper error status
  @@ -263,44 +266,46 @@
    * basic authentication...
    */
   
  -int authenticate_digest_user (request_rec *r)
  +int authenticate_digest_user(request_rec *r)
   {
       digest_config_rec *sec =
  -      (digest_config_rec *)get_module_config (r->per_dir_config,
  -					      &digest_module);
  -    digest_header_rec *response = pcalloc (r->pool, sizeof(digest_header_rec));
  +    (digest_config_rec *) get_module_config(r->per_dir_config,
  +					    &digest_module);
  +    digest_header_rec *response = pcalloc(r->pool, sizeof(digest_header_rec));
       conn_rec *c = r->connection;
       char *a1;
       char errstr[MAX_STRING_LEN];
       int res;
  -    
  -    if ((res = get_digest_rec (r, response))) return res;
  -    
  -    if(!sec->pwfile) 
  -        return DECLINED;
  -	
  +
  +    if ((res = get_digest_rec(r, response)))
  +	return res;
  +
  +    if (!sec->pwfile)
  +	return DECLINED;
  +
       if (!(a1 = get_hash(r, c->user, sec->pwfile))) {
  -        ap_snprintf(errstr, sizeof(errstr), "user %s not found", c->user);
  +	ap_snprintf(errstr, sizeof(errstr), "user %s not found", c->user);
   	aplog_error(APLOG_MARK, APLOG_ERR, r->server, "%s: %s", errstr, r->uri);
   	note_digest_auth_failure(r);
   	return AUTH_REQUIRED;
       }
       /* anyone know where the prototype for crypt is? */
       if (strcmp(response->digest, find_digest(r, response, a1))) {
  -        ap_snprintf(errstr, sizeof(errstr), "user %s: password mismatch", c->user);
  +	ap_snprintf(errstr, sizeof(errstr), "user %s: password mismatch", c->user);
   	aplog_error(APLOG_MARK, APLOG_ERR, r->server, "%s: %s", errstr, r->uri);
  -	note_digest_auth_failure (r);
  +	note_digest_auth_failure(r);
   	return AUTH_REQUIRED;
       }
       return OK;
   }
  -    
  +
   /* Checking ID */
  -    
  -int digest_check_auth (request_rec *r) {
  +
  +int digest_check_auth(request_rec *r)
  +{
       char *user = r->connection->user;
       int m = r->method_number;
  -    int method_restricted = 0;    
  +    int method_restricted = 0;
       register int x;
       const char *t;
       char *w;
  @@ -308,62 +313,64 @@
       require_line *reqs;
   
       if (!(t = auth_type(r)) || strcasecmp(t, "Digest"))
  -      return DECLINED;
  +	return DECLINED;
   
  -    reqs_arr = requires (r);
  +    reqs_arr = requires(r);
       /* If there is no "requires" directive, 
        * then any user will do.
        */
       if (!reqs_arr)
  -        return OK;
  -    reqs = (require_line *)reqs_arr->elts;
  +	return OK;
  +    reqs = (require_line *) reqs_arr->elts;
  +
  +    for (x = 0; x < reqs_arr->nelts; x++) {
   
  -    for(x=0; x < reqs_arr->nelts; x++) {
  -      
  -	if (! (reqs[x].method_mask & (1 << m))) continue;
  -	
  -        method_restricted = 1;
  +	if (!(reqs[x].method_mask & (1 << m)))
  +	    continue;
  +
  +	method_restricted = 1;
   
   	t = reqs[x].requirement;
  -        w = getword(r->pool, &t, ' ');
  -        if(!strcmp(w,"valid-user"))
  -            return OK;
  -        else if(!strcmp(w,"user")) {
  -            while(t[0]) {
  -                w = getword_conf (r->pool, &t);
  -                if(!strcmp(user,w))
  -                    return OK;
  -            }
  -	  }
  +	w = getword(r->pool, &t, ' ');
  +	if (!strcmp(w, "valid-user"))
  +	    return OK;
  +	else if (!strcmp(w, "user")) {
  +	    while (t[0]) {
  +		w = getword_conf(r->pool, &t);
  +		if (!strcmp(user, w))
  +		    return OK;
  +	    }
  +	}
   	else
  -	  return DECLINED;
  +	    return DECLINED;
       }
  -    
  +
       if (!method_restricted)
  -      return OK;
  +	return OK;
   
       note_digest_auth_failure(r);
       return AUTH_REQUIRED;
   }
   
  -module MODULE_VAR_EXPORT digest_module = {
  -   STANDARD_MODULE_STUFF,
  -   NULL,			/* initializer */
  -   create_digest_dir_config,	/* dir config creater */
  -   NULL,			/* dir merger --- default is to override */
  -   NULL,			/* server config */
  -   NULL,			/* merge server config */
  -   digest_cmds,			/* command table */
  -   NULL,			/* handlers */
  -   NULL,			/* filename translation */
  -   authenticate_digest_user,	/* check_user_id */
  -   digest_check_auth,		/* check auth */
  -   NULL,			/* check access */
  -   NULL,			/* type_checker */
  -   NULL,			/* fixups */
  -   NULL,			/* logger */
  -   NULL,			/* header parser */
  -   NULL,			/* child_init */
  -   NULL,			/* child_exit */
  -   NULL				/* post read-request */
  +module MODULE_VAR_EXPORT digest_module =
  +{
  +    STANDARD_MODULE_STUFF,
  +    NULL,			/* initializer */
  +    create_digest_dir_config,	/* dir config creater */
  +    NULL,			/* dir merger --- default is to override */
  +    NULL,			/* server config */
  +    NULL,			/* merge server config */
  +    digest_cmds,		/* command table */
  +    NULL,			/* handlers */
  +    NULL,			/* filename translation */
  +    authenticate_digest_user,	/* check_user_id */
  +    digest_check_auth,		/* check auth */
  +    NULL,			/* check access */
  +    NULL,			/* type_checker */
  +    NULL,			/* fixups */
  +    NULL,			/* logger */
  +    NULL,			/* header parser */
  +    NULL,			/* child_init */
  +    NULL,			/* child_exit */
  +    NULL			/* post read-request */
   };
  
  
  

Mime
View raw message