OpenBSD CVS

CVS log for src/usr.bin/mandoc/cgi.c


[BACK] Up to [local] / src / usr.bin / mandoc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.120 / (download) - annotate - [select for diffs], Mon Dec 26 19:16:02 2022 UTC (16 months, 3 weeks ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.119: +2 -2 lines
Diff to previous 1.119 (colored)

spelling fixes; from paul tagliamonte
amendments to his diff are noted on tech

Revision 1.119 / (download) - annotate - [select for diffs], Wed Jul 6 17:19:57 2022 UTC (22 months, 1 week ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.118: +7 -5 lines
Diff to previous 1.118 (colored)

For accessibility, label the last two widgets in the search form.
Patch from Anna Vyalkova <cyber at sysrq dot in>, significantly tweaked by me.

Revision 1.118 / (download) - annotate - [select for diffs], Wed Jul 6 16:02:52 2022 UTC (22 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.117: +4 -4 lines
Diff to previous 1.117 (colored)

https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/ says:
"Start names with a capital letter;
it helps some screen readers speak them with appropriate inflection."
Anna Vyalkova already did that correctly when sending patches,
but i ruined it when committing, so fix it now.

Revision 1.117 / (download) - annotate - [select for diffs], Tue Jul 5 14:03:35 2022 UTC (22 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.116: +43 -31 lines
Diff to previous 1.116 (colored)

Somehow, the content of header.html ended up
before and outside the <header> element.
Fix this by moving it into the <header> element where it belongs.
While here, also wrap footer.html in a <footer> element.

Revision 1.116 / (download) - annotate - [select for diffs], Mon Jul 4 16:20:09 2022 UTC (22 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.115: +33 -16 lines
Diff to previous 1.115 (colored)

Improve accessibility of man.cgi(8) in various respects,
in particular adding <header>, <main>, and <nav> elements
and role and aria-label attributes in several places.
Patch from Anna Vyalkova <cyber at sysrq dot in>,
minimally tweaked by me.

Revision 1.115 / (download) - annotate - [select for diffs], Sun Oct 24 21:24:16 2021 UTC (2 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.114: +2 -2 lines
Diff to previous 1.114 (colored)

For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert

Revision 1.114 / (download) - annotate - [select for diffs], Thu Aug 19 15:21:32 2021 UTC (2 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.113: +25 -9 lines
Diff to previous 1.113 (colored)

fix the section number in the <title> element for preformatted pages;
minibug reported by Ian <Ropers at gmail dot com> on misc@

Revision 1.113 / (download) - annotate - [select for diffs], Sat May 1 16:11:17 2021 UTC (3 years ago) by visa
Branch: MAIN
Changes since 1.112: +4 -4 lines
Diff to previous 1.112 (colored)

Retire OpenBSD/sgi.

OK deraadt@

Revision 1.112 / (download) - annotate - [select for diffs], Wed Apr 28 14:29:50 2021 UTC (3 years ago) by jsg
Branch: MAIN
Changes since 1.111: +3 -2 lines
Diff to previous 1.111 (colored)

recognise riscv64 as a valid arch in mandoc

ok jmc@ deraadt@

Revision 1.111 / (download) - annotate - [select for diffs], Mon Jun 29 19:16:59 2020 UTC (3 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.110: +6 -5 lines
Diff to previous 1.110 (colored)

Support the "powerpc64" architecture name.
The first file using it in .Dt was just committed by kettenis@.

Revision 1.110 / (download) - annotate - [select for diffs], Fri Apr 3 11:34:19 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.109: +6 -4 lines
Diff to previous 1.109 (colored)

Remove some stray argument names from function prototypes,
for consistency with the dominant style used in mandoc.
No functional change.
Patch from Martin Vahlensieck <academicsolutions dot ch>.

Revision 1.109 / (download) - annotate - [select for diffs], Fri Jan 10 15:20:49 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +3 -2 lines
Diff to previous 1.108 (colored)

autocapitalize=none; also from Tim Baumgard

Revision 1.108 / (download) - annotate - [select for diffs], Fri Jan 10 12:53:50 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +2 -2 lines
Diff to previous 1.107 (colored)

Switch off the useless and annoying "autocomplete" feature;
issue reported by Tim Baumgard <at bmgrd dot com>.
landry@ and florian@ agree with the general direction.

Revision 1.107 / (download) - annotate - [select for diffs], Sun Nov 10 22:18:01 2019 UTC (4 years, 6 months ago) by bentley
Branch: MAIN
Changes since 1.106: +3 -1 lines
Diff to previous 1.106 (colored)

Add a Content-Security-Policy HTTP header that allows only CSS.

This ensures that in a modern browser that understands the header,
mandoc rendering bugs cannot possibly be interpreted as JavaScript.

ok schwarze@

Revision 1.106 / (download) - annotate - [select for diffs], Tue Oct 1 17:54:04 2019 UTC (4 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.105: +11 -8 lines
Diff to previous 1.105 (colored)

For invalid queries and for valid queries returning no result,
return the appropriate 40x status code rather than 200.
Improvement suggested and diff tested
by John Gardner <gardnerjohng at gmail dot com>.

Revision 1.105 / (download) - annotate - [select for diffs], Wed Jul 10 12:48:08 2019 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +1 -2 lines
Diff to previous 1.104 (colored)

in man.cgi(8), disable -O toc by default; requested by deraadt@

Revision 1.104 / (download) - annotate - [select for diffs], Wed Mar 6 12:32:10 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.103: +2 -2 lines
Diff to previous 1.103 (colored)

drop redundant '0' flag from "%02.2X" format string;
found by a compiler warning from gcc 4.9.2 on Linux

Revision 1.103 / (download) - annotate - [select for diffs], Thu Jan 31 23:00:18 2019 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +2 -2 lines
Diff to previous 1.102 (colored)

Relax overzealous PATH_INFO validation.
URIs like https://man.openbsd.org/OpenBSD-2.2/cat1/cat.0
are still required to work because they result from apropos searches for
old releases (up to 5.0) which used to install preformatted manual pages.
Regression reported by jj@.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Dec 30 00:48:47 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +9 -21 lines
Diff to previous 1.101 (colored)

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results.  Move the public results to the
parsing result struct roff_meta, which is already public.  Move the
rest of struct roff_man to the parser-internal header roff_int.h.

Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.

This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.

Revision 1.101 / (download) - annotate - [select for diffs], Fri Dec 14 01:17:46 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback.  It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.

Revision 1.100 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:14 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +2 -1 lines
Diff to previous 1.99 (colored)

Cleanup, no functional change:
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.

Revision 1.99 / (download) - annotate - [select for diffs], Fri Oct 19 21:10:00 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +41 -47 lines
Diff to previous 1.98 (colored)

Rewrite parse_path_info() to be four lines shorter, simplify ownership
of allocated strings, do not write to the input string, and improve
diagnostic output.

The confusing error message "invalid arch" as a reaction to mistyping
the release name was noticed by tb@, who likes the new code and message.

Revision 1.98 / (download) - annotate - [select for diffs], Tue Oct 2 19:40:05 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.97: +3 -2 lines
Diff to previous 1.97 (colored)

enable the equivalent of -O toc in man.cgi(8)

Revision 1.97 / (download) - annotate - [select for diffs], Mon Oct 1 08:05:25 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +33 -5 lines
Diff to previous 1.96 (colored)

Add missing URI encoding when writing HTTP redirects,
fixing a bug reported by <jungleboogie0 at gmail dot com> on bugs@.
While here, fully validate the arch name
such that we do not have to URI encode that one.

Revision 1.96 / (download) - annotate - [select for diffs], Tue May 29 20:32:41 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +6 -8 lines
Diff to previous 1.95 (colored)

Remove redundant value= attributes from option elements,
and use type=search rather than type=text for the input element
because it tends to better support autocompletion.
Both suggested by John Gardner <gardnerjohng at gmail dot com>.

Revision 1.95 / (download) - annotate - [select for diffs], Fri May 18 14:22:24 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.94: +3 -1 lines
Diff to previous 1.94 (colored)

In a nutshell, all mobile browsers are broken.
By default, no matter the physical screen size, they use a fixed
viewport width of about 1000px, then scale down the rendered page
to make that huge viewport fit on the physical screen.
That results in poor rendering for bad websites which assume a
large fixed-size viewport (typically requiring zooming in to be able
to actually read any text), but in atrocious rendering for good
websites that make no assumption about the screen size (unreadably
small text in the top left corner, most of the screen empty).

A standard way to disable that insane behaviour and just render
normally on the actual physical screen size does not exist.
The closest thing is the CSS3 Device Adaptation Module Level 1
https://drafts.csswg.org/css-device-adapt/
but https://caniuse.com/#feat=css-deviceadaptation tells me
that basically no browser implements it, not even on mobile.

The next closest thing is the HTML meta viewport element - even though
the problem has nothing to do with HTML and is purely a CSS issue.
Standardization is not even planned for that one:
* HTML 5.2 mentions it in passing without specifying it:
https://www.w3.org/TR/html/document-metadata.html#the-meta-element
* The Web Hypertext Application Technology Working Group
provides very incomplete information:
https://wiki.whatwg.org/wiki/MetaExtensions
* CSS3 Device Adaptation Module Level 1 already wants to deprecate it,
explaining mostly how to migrate *away* from it to some castle in
the sky that no browser implements:
https://drafts.csswg.org/css-device-adapt/#viewport-meta

While i strongly believe in sticking to well-established standards,
in the absence of standards and with atrocious behaviour being
universal, there appears to be no alternative to using whatever
works.  The meta viewport element appears to be the only way to
make real-world mobile browsers decently render any HTML page that
does not have a fixed-width layout of 1000px.  So use it, grudgingly.

Originally suggested by xcv at dr dot com.
Direction supported by espie@.

Revision 1.94 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:27 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-Wopenbsd and -Wnetbsd to check conventions for the base system of
a specific operating system.  Mark operating system specific messages
with "(OpenBSD)" at the end.

Please use just "-Tlint" to check base system manuals (defaulting
to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the
manuals of portable software projects you maintain that are not
part of OpenBSD base, to avoid bogus recommendations about base
system conventions that do not apply.

Issue originally reported by semarie@, solution using
an idea from tedu@, discussed with jmc@ and jca@.

Revision 1.93 / (download) - annotate - [select for diffs], Tue Jun 20 17:24:09 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +5 -5 lines
Diff to previous 1.92 (colored)

KNF: remove parentheses from switch case labels; no binary change

Revision 1.92 / (download) - annotate - [select for diffs], Wed Apr 19 00:59:32 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.91: +3 -2 lines
Diff to previous 1.91 (colored)

More thoroughly reject direct access to unintended files, such that
URIs like http://man.openbsd.org/OpenBSD-current/mandoc.db and
http://man.openbsd.org/OpenBSD-current/man1/ do not cause display
of garbage.

Revision 1.91 / (download) - annotate - [select for diffs], Sat Mar 18 16:48:07 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.90: +12 -11 lines
Diff to previous 1.90 (colored)

Simplify: write HTTP 303 redirects with relative locations.
Suggested by bentley@.

Delete the HTTP_HOST configuration variable that is now obsolete.

Revision 1.90 / (download) - annotate - [select for diffs], Sat Mar 18 16:18:45 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +3 -2 lines
Diff to previous 1.89 (colored)

Bugfix: use SCRIPT_NAME for .Xr hyperlinks.
Patch from <andreas at AndreasVoegele dot com>.

Revision 1.89 / (download) - annotate - [select for diffs], Wed Mar 15 13:49:26 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +7 -4 lines
Diff to previous 1.88 (colored)

In URIs in apropos(1) result tables,
only write the manpath if it does not match the default.

Revision 1.88 / (download) - annotate - [select for diffs], Wed Mar 15 13:18:48 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +49 -34 lines
Diff to previous 1.87 (colored)

Mention the manual page name and section in the HTML page <title>.
Based on a patch from <Anton dot Lindqvist at gmail dot com>,
but simplified and also covering apropos(1) search results.

Revision 1.87 / (download) - annotate - [select for diffs], Wed Mar 15 10:17:08 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +25 -3 lines
Diff to previous 1.86 (colored)

It's annoying that people keep writing URIs including redundant parts
like "/OpenBSD-current/manN/".  To discourage that, let man.cgi(8)
redirect search form results to nice, concise URIs.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Feb 22 16:16:35 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +15 -1 lines
Diff to previous 1.85 (colored)

Pledge man.cgi(8).
Based on a more complicated patch from semarie@.
Sebastien and tb@ both agree with the simplification.

Revision 1.85 / (download) - annotate - [select for diffs], Wed Jan 25 03:19:56 2017 UTC (7 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.84: +2 -2 lines
Diff to previous 1.84 (colored)

+arm64

Revision 1.84 / (download) - annotate - [select for diffs], Wed Jan 25 02:14:41 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +3 -1 lines
Diff to previous 1.83 (colored)

Improve HTML formatting of .Bl -tag.

In particular, when using the style sheet, put the body on the same
line as the head for short heads, or on the next line for long
heads, in a way that preserves both correct indentation and correct
vertical spacing with and without -compact, and with one or more
heads per body (hi, Zaphod) - eight use cases so far - and with and
without -tag, and with and without -offset, 32 use cases grand total.

Using many ideas from zhuk@, from <David dot Dahlberg at fkie dot
fraunhofer dot de>, and from Benny Lofgren <bl dash lists at lofgren
dot biz>, and a few of my own.

This is an excellent demonstration that CSS is an extremely hostile
language, much more trapful and much harder to use than, say, C.
When matthew@ reported this in July 2014 (!), it was already a known
issue, and i no longer remember for how long.  My first serious
attempt at fixing it (in November 2015) failed miserably.  I'd love
to see simplifications of both the generated HTML code and of the
style sheet, but without breaking any of the 32 use cases, please.

Revision 1.83 / (download) - annotate - [select for diffs], Sat Jan 21 01:20:29 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +9 -14 lines
Diff to previous 1.82 (colored)

clean up the remaining class attributes

Revision 1.82 / (download) - annotate - [select for diffs], Thu Jan 19 13:55:49 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +27 -27 lines
Diff to previous 1.81 (colored)

Adjust indentation of the HTML output to the conventions established
by html.c.  No semantic change.

Revision 1.81 / (download) - annotate - [select for diffs], Thu Jan 19 13:34:59 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +5 -10 lines
Diff to previous 1.80 (colored)

Start cleanup: trim useless HTML comments and <div> elements
on the <html> and <body> levels.

Revision 1.80 / (download) - annotate - [select for diffs], Sun Sep 11 23:59:02 2016 UTC (7 years, 8 months ago) by bentley
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

Use the proper HTML escape for double quote ("): &quot; not &quote;.

ok schwarze@

Revision 1.79 / (download) - annotate - [select for diffs], Sat Sep 3 21:24:35 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +4 -4 lines
Diff to previous 1.78 (colored)

move zaurus down to the discontinued architectures

Revision 1.78 / (download) - annotate - [select for diffs], Thu Sep 1 15:07:19 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +4 -4 lines
Diff to previous 1.77 (colored)

move "sparc" down to discontinued architectures

Revision 1.77 / (download) - annotate - [select for diffs], Thu Aug 18 00:44:37 2016 UTC (7 years, 9 months ago) by jsg
Branch: MAIN
Changes since 1.76: +2 -1 lines
Diff to previous 1.76 (colored)

fix an fd leak
ok schwarze@

Revision 1.76 / (download) - annotate - [select for diffs], Wed Aug 10 18:39:04 2016 UTC (7 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +6 -5 lines
Diff to previous 1.75 (colored)

move armish and hppa64 down in the dropdown box; reminded by jmc@

Revision 1.75 / (download) - annotate - [select for diffs], Sun Jul 31 23:35:26 2016 UTC (7 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +3 -2 lines
Diff to previous 1.74 (colored)

Some base system pages, for example perl(1), contain non-ASCII
characters in their source code, so switch on charset autodetection
in the same way as in man(1) itself.
Issue reported by Pavan Maddamsetti at gmail dot com on bugs@.

Revision 1.74 / (download) - annotate - [select for diffs], Mon Jul 11 22:46:57 2016 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.73: +42 -17 lines
Diff to previous 1.73 (colored)

Make all components of the URI individually optional,
independent of each other, as in:
http://man.openbsd.org[/manpath][/mansec][/arch]/name[.sec]
The restrictions in the past kept confusing people.
Triggered by a question from RafaelNeves at gmail dot com.

Revision 1.73 / (download) - annotate - [select for diffs], Sun Jul 10 10:03:15 2016 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +4 -12 lines
Diff to previous 1.72 (colored)

Simplify the code and the server setup by deleting the pseudo-manpath
"mandoc" that was used for man.cgi(8) documentation and by assuming
that the apropos(1) and man.cgi(8) manuals are simply installed in
the default manpath.  Even though man.cgi(8) is not installed by
default when installing OpenBSD, it is easy to copy it into the
default manpath used for man.cgi(8).

Idea found when considering a question asked by wrant dot com.

Revision 1.72 / (download) - annotate - [select for diffs], Sat Jul 9 19:44:52 2016 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

Do not treat PATH_INFO as a complete path if it doesn't contain
a manpath.  For example, this makes http://man.openbsd.org/mandoc
work as expected.
Bug reported by tb@, reminded by Svyatoslav Mishyn.

Revision 1.71 / (download) - annotate - [select for diffs], Sat May 28 13:40:44 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +9 -28 lines
Diff to previous 1.70 (colored)

Simplify search form: minus two visible control elements, minus
one table, minus twenty lines of code, no loss of functionality.
No idea why i didn't do this earlier...

Revision 1.70 / (download) - annotate - [select for diffs], Fri Apr 29 10:45:06 2016 UTC (8 years ago) by schwarze
Branch: MAIN
Changes since 1.69: +18 -9 lines
Diff to previous 1.69 (colored)

Only focus on the query input box when no manual page is displayed,
that is, for the index page, for the noresult page, and for the
result of an apropos(1) query with more than one page.
As noted by bentley@, when a manual page is displayed, it is more
important that people can quickly use the space bar for paging and
Ctrl-F for searching.

Revision 1.69 / (download) - annotate - [select for diffs], Thu Apr 28 17:59:00 2016 UTC (8 years ago) by schwarze
Branch: MAIN
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

Set the "autofocus" attribute on the query text box.
Patch from Fabian dot Raetz at gmail dot com.

Revision 1.68 / (download) - annotate - [select for diffs], Fri Apr 15 21:14:03 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.67: +16 -16 lines
Diff to previous 1.67 (colored)

Rename five static functions to make the classification of functions
as parsers, page generators, and result generators more obvious.
No functional change.

Revision 1.67 / (download) - annotate - [select for diffs], Fri Apr 15 16:42:39 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.66: +19 -23 lines
Diff to previous 1.66 (colored)

prefer warn[x](3) over fprintf(3) where appropriate

Revision 1.66 / (download) - annotate - [select for diffs], Fri Apr 15 15:13:02 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.65: +14 -18 lines
Diff to previous 1.65 (colored)

Fix parsing of PATH_INFO if both a section directory and an
architecture subdirectory are specified.  Issue reported by tb@.

Revision 1.65 / (download) - annotate - [select for diffs], Fri Apr 15 01:33:48 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.64: +97 -97 lines
Diff to previous 1.64 (colored)

Make HTML tags lower case for better stylistic agreement with what
html.c does.

Revision 1.64 / (download) - annotate - [select for diffs], Fri Apr 15 00:51:39 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.63: +10 -10 lines
Diff to previous 1.63 (colored)

In the architectures dropdown, move aviion, ia64, solbourne, and vax
down to the currently unsupported entries.

Revision 1.63 / (download) - annotate - [select for diffs], Fri Apr 15 00:36:18 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.62: +4 -3 lines
Diff to previous 1.62 (colored)

If PATH_INFO contains a complete and correct path to a manual page
file, for example "/OpenBSD-5.9/man2/pledge.2", no database query
is needed and the file is delivered directly.

But even in this case, let's parse the PATH_INFO and fill the query
structure such that the search form at the top of the result page
gets pre-filled with useful values.

Revision 1.62 / (download) - annotate - [select for diffs], Fri Apr 15 00:12:50 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.61: +24 -21 lines
Diff to previous 1.61 (colored)

omit list of other results one there is only one match

Revision 1.61 / (download) - annotate - [select for diffs], Thu Apr 14 23:48:06 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.60: +3 -7 lines
Diff to previous 1.60 (colored)

for .Xr links, use short PATH_INFO style URIs

Revision 1.60 / (download) - annotate - [select for diffs], Thu Apr 14 20:38:50 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.59: +5 -2 lines
Diff to previous 1.59 (colored)

do not rewrite short URIs

Revision 1.59 / (download) - annotate - [select for diffs], Wed Apr 13 12:58:13 2016 UTC (8 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.58: +15 -13 lines
Diff to previous 1.58 (colored)

Give manuals in purely numerical sections priority over manuals of
the same name in sections with an alphabetical suffix; same logic
as in main.c rev. 1.171.

Revision 1.58 / (download) - annotate - [select for diffs], Fri Mar 18 13:21:07 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +16 -24 lines
Diff to previous 1.57 (colored)

Make the SCRIPT_NAME logic simpler, safer, and make it actually work;
in part based on ideas by bentley@.
While here, improve the documentation.

Revision 1.57 / (download) - annotate - [select for diffs], Thu Mar 17 22:06:30 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +3 -2 lines
Diff to previous 1.56 (colored)

make man(1) mode the default rather than apropos(1) mode

Revision 1.56 / (download) - annotate - [select for diffs], Thu Mar 17 21:22:43 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +69 -9 lines
Diff to previous 1.55 (colored)

support short URIs for man.openbsd.org

Revision 1.55 / (download) - annotate - [select for diffs], Fri Dec 25 20:16:19 2015 UTC (8 years, 4 months ago) by bentley
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.54: +3 -56 lines
Diff to previous 1.54 (colored)

Don't retain the search query in the resulting manual links.
Clean, simple URLs are best.

ok schwarze@

Revision 1.54 / (download) - annotate - [select for diffs], Sat Nov 7 17:58:52 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +23 -12 lines
Diff to previous 1.53 (colored)

Modernization, no functional change intended:
Use the POSIX function getline(3) rather than the slightly
dangerous BSD function fgetln(3).

Revision 1.53 / (download) - annotate - [select for diffs], Thu Nov 5 20:55:46 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +20 -2 lines
Diff to previous 1.52 (colored)

Use include files "header.html" and "footer.html" rather than a
compiled-in string.  This is not a security risk, we read the file
manpath.conf from the same directory, anyway.  No error handling
is needed; even if the files are absent, that's not an error.

This is more flexible without causing complication of the code or
the user interface.  It helps the upcoming revamp of the online
manual pages on man.NetBSD.org.

Based on an idea by Jean-Yves Migeon <jeanyves dot migeon at free dot fr>,
but implemented in a much simpler way.

Revision 1.52 / (download) - annotate - [select for diffs], Thu Nov 5 17:47:53 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +3 -5 lines
Diff to previous 1.51 (colored)

simplify: use one stylesheet rather than two; from bentley@

Revision 1.51 / (download) - annotate - [select for diffs], Thu Oct 22 22:05:42 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +5 -2 lines
Diff to previous 1.50 (colored)

use the new function man_validate() here, too

Revision 1.50 / (download) - annotate - [select for diffs], Tue Oct 20 02:00:49 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +5 -3 lines
Diff to previous 1.49 (colored)

In order to become able to generate syntax tree nodes on the roff(7)
level, validation must be separated from parsing and rewinding.
This first big step moves calling of the mdoc(7) post_*() functions
out of the parser loop into their own mdoc_validate() pass, while
using a new mdoc_state() module to make syntax tree state handling
available to both the parser loop and the validation pass.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Oct 13 22:57:49 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +6 -8 lines
Diff to previous 1.48 (colored)

Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table.
* Make the character table static in the chars.c module:
There is no need to pass a pointer around, we most certainly
never want to use two different character tables concurrently.
* No need to keep the characters in a separate file chars.in;
that merely encourages downstream porters to mess with them.
* Sort the characters to agree with the mandoc_chars(7) manual page.
* Specify Unicode codepoints in hex, not decimal (that's the detail
that originally triggered this patch).
No functional change, minus 100 LOC, and i don't see a performance change.

Revision 1.48 / (download) - annotate - [select for diffs], Tue Oct 6 18:30:43 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +19 -19 lines
Diff to previous 1.47 (colored)

modernize style: "return" is not a function; ok cmp(1)

Revision 1.47 / (download) - annotate - [select for diffs], Sat Apr 18 16:34:03 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.46: +7 -7 lines
Diff to previous 1.46 (colored)

Profit from the unified struct roff_man and reduce the number of
arguments of mparse_result() by one.  No functional change.
Written on the ICE Bruxelles-Koeln on the way back from p2k15.

Revision 1.46 / (download) - annotate - [select for diffs], Sat Apr 18 16:04:40 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (colored)

Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

Revision 1.45 / (download) - annotate - [select for diffs], Fri Mar 27 21:17:16 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.44: +8 -7 lines
Diff to previous 1.44 (colored)

Actually use the new man.conf(5) "output" directive.
Additional functionality, yet minus 45 lines of code.

Revision 1.44 / (download) - annotate - [select for diffs], Fri Mar 27 17:36:56 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.43: +4 -4 lines
Diff to previous 1.43 (colored)

Parse the new man.conf(5) "output" directive.
The next step will be to actually use the parsed data.

Revision 1.43 / (download) - annotate - [select for diffs], Tue Feb 10 08:05:07 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.42: +12 -12 lines
Diff to previous 1.42 (colored)

trim trailing white space, no code change;
from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux

Revision 1.42 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:06 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +3 -11 lines
Diff to previous 1.41 (colored)

Fatal errors no longer exist.
If a file can be opened, mandoc will produce some output;
at worst, the output may be almost empty.
Simplifies error handling and frees a message type for future use.

Revision 1.41 / (download) - annotate - [select for diffs], Wed Nov 26 00:57:32 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +6 -13 lines
Diff to previous 1.40 (colored)

Make the code sipler and more robust by always assigning a value
to q.manpath and dropping the (incomplete) later NULL checks.

Revision 1.40 / (download) - annotate - [select for diffs], Tue Nov 11 19:03:10 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +2 -1 lines
Diff to previous 1.39 (colored)

In man(1) mode without -a, stop searching after the first manual tree
that contained at least one match in order to not prefer mdoc(1) from
ports over mdoc(7).  As a bonus, this results in a speedup.

Revision 1.39 / (download) - annotate - [select for diffs], Tue Oct 28 17:35:42 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +7 -3 lines
Diff to previous 1.38 (colored)

Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones.
This requires mchars_spec2cp() to report unknown names again.
Fortunately, that doesn't require changing the calling code because
according to groff, invalid character escapes should not produce
output anyway, and now that we warn about them, that's fine.

Revision 1.38 / (download) - annotate - [select for diffs], Tue Oct 7 18:20:42 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

be a bit more patient, 1s is sometimes insufficient for legitimate queries

Revision 1.37 / (download) - annotate - [select for diffs], Tue Oct 7 18:17:05 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +3 -6 lines
Diff to previous 1.36 (colored)

Switch HTML output to polyglot HTML5; have only one single -Thml mode.
Replace hard-coded widths and alignments with a minimal embedded stylesheet.
Do not use <p> because it cannot appear inside block macros.
Remove the "summary" attribute because it is not HTML5.

Written by kristaps@ some months ago, finished during EuroBSDCon.

Revision 1.36 / (download) - annotate - [select for diffs], Sun Sep 14 19:44:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +33 -34 lines
Diff to previous 1.35 (colored)

Support backslash-escaping of white space in the query expression,
to be more similar to apropos(1) called from the shell.
Missing feature reported by Marcus MERIGHI <mcmer dash openbsd at
tor dot at> on misc@.

Revision 1.35 / (download) - annotate - [select for diffs], Wed Aug 27 00:06:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +4 -4 lines
Diff to previous 1.34 (colored)

Add an implementation of man(1) into the /usr/bin/mandoc binary and
provide a unified set of command line options for mandoc(1), man(1),
apropos(1), and whatis(1), each option doing the same for all four.
Not adding any completely new options, only extending exiting ones
from one tool to the others.  New options are:
* apropos & whatis -acfkw  (in the past, these were man(1) only)
* apropos & whatis -a -IOTW  (in the past, mandoc(1) only)
* mandoc -ac  (in the past, man(1) only)
* man -IOTW  (in the past, mandoc(1) only)

Before we can decide whether or not we want to replace src/usr.bin/man
with this implementation, considerable bugfixing, testing, and
performance measurements are needed, which i'd rather do in the tree
than outside.  Note that these bugs only affect the new man(1) mode,
existing mandoc(1), apropos(1), and whatis(1) is fine.

The new functionality in mandoc(1), apropos(1), and whatis(1)
is fully enabled.  To play with the new man(1), you can try:
# mv /usr/bin/man /usr/bin/oman
# ln -s /usr/bin/mandoc /usr/bin/man

Positive feedback about the general direction from sthen@ and jmc@,
and deraadt@ is not against it.

Revision 1.34 / (download) - annotate - [select for diffs], Tue Aug 26 11:13:58 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +7 -7 lines
Diff to previous 1.33 (colored)

Unify console and CGI section titles, bringing them closer to groff,
is an attempt to reduce confusion for users switching between media
and between different operating systems.

Not using the groff title for section 4 is intentional,
it is just too awful ("Kernel Interfaces Manual"), and
the difference from sections 2 and 9 would be too hard to see.

Positive feedback from at least deraadt@ millert@ bluhm@ jca@.
Previously also agreed with the general direction: jmc@ Nick@.
The title for 3p was polished by bluhm@.
The existing mismatches were originally noticed by jsg@.

Revision 1.33 / (download) - annotate - [select for diffs], Thu Aug 21 16:03:50 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +18 -1 lines
Diff to previous 1.32 (colored)

limit CGI process execution time to make REDoS attacks less effective;
attack surface pointed out by Sebastien Marie

Revision 1.32 / (download) - annotate - [select for diffs], Fri Aug 8 17:17:42 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (colored)

mansearch.h uses uint64_t, so it needs stdint.h; found on Linux

Revision 1.31 / (download) - annotate - [select for diffs], Fri Jul 25 21:05:38 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.30: +9 -35 lines
Diff to previous 1.30 (colored)

Choosing the right encoding is a tricky business...

Printing query strings for URIs *always* needs URI-encoding, and when
embedding the URI into an HTML document, it needs replacement of
the "&" separators by "&amp;" *in addition to that*, not instead.
Delete the function html_primtquery(), it was completely wrong.

You can see the badness by entering "mandoc &sec=2" into the query input
box before this patch and click "Submit".  You come to the right page at
first (...man.cgi?query=mandoc+%26sec%3D2&apropos=0&sec=0&...), but now
the link to mandoc(1) is wrong: ...mandoc.1?query=mandoc &amp;sec=2&amp;...
Clicking on that, the "&sec=2" disappears from the query input box and
suddenly you have the first dropdown set to "2 - System Calls".  Oops.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Jul 25 20:08:49 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +13 -8 lines
Diff to previous 1.29 (colored)

Sort the URI keys for .Xr links in the same order used by the search form,
and leave out the manpath when it is the default.
For building the HTML formatter options, do not use a static buffer.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Jul 25 19:36:02 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored)

oops, we must not try to validate a manpath we don't have;
fixing an oversight introduced in rev. 1.17

Revision 1.28 / (download) - annotate - [select for diffs], Fri Jul 25 18:19:33 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.27: +19 -17 lines
Diff to previous 1.27 (colored)

We cannot easily control the order of the QUERY_STRING keys generated
by the search form, it's just the order of the fields in the form.
Actually, that's not too bad; the generated URI resembles the
generating form.

To minimize confusion for people looking at URIs, give the keys
in the same order when generating URIs for search listings and
search redirections, the latter being used instead of search
listings that would have only one single entry.  Also, if the
manpath is the default, remove it form the generated URIs.

Revision 1.27 / (download) - annotate - [select for diffs], Fri Jul 25 17:51:33 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +3 -2 lines
Diff to previous 1.26 (colored)

In generated .Xr links, avoid double encoding of ampersands
and avoid empty arch= keys.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Jul 25 17:33:51 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +12 -12 lines
Diff to previous 1.25 (colored)

Even though this is not XHTML yet, remove some gratuitious violations
of XHTML syntax.  Also add some cosmetic newlines to the HTML code.

Revision 1.25 / (download) - annotate - [select for diffs], Fri Jul 25 16:55:40 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +17 -13 lines
Diff to previous 1.24 (colored)

The names of all other struct query memebers match the corresponding
QUERY_STRING keys, so rename "expr" to "query".
Also add some missing function prototypes.
No functional change.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jul 25 16:43:05 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +20 -15 lines
Diff to previous 1.23 (colored)

clean up pg_show() to not modify a string returned from getenv(3)

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jul 25 16:06:19 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.22: +104 -49 lines
Diff to previous 1.22 (colored)

Rewrite http_parse() completely:
1. Make sure the last occurrence of each key is used, even if
it is empty, in which case it resets the value to the default.
2. When there is an HTTP encoding error, skip the affected
key-value pair only, but not all subsequent key-value pairs.
3. Do not modify a string returned from getenv(3).
4. Do not assume the NULL pointer is all null bits.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jul 24 20:30:38 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +1 -12 lines
Diff to previous 1.21 (colored)

Sort result pages first by section number, then by name.
By moving the sort from cgi.c to mansearch.c, we get two advantages:
Easier access to the data needed for sorting, in particular the section
number, and the apropos(1) command line utility profits as well.

Feature requested by deraadt@.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jul 24 08:25:45 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +26 -2 lines
Diff to previous 1.20 (colored)

Provide a dropdown entry "All Architectures" and make it the default.
Still, amd64 remains the default in the following sense:
If a man(1) mode search returns more than one page of the same name,
prefer amd64 over other architectures for immediate display.
ok deraadt@ daniel@

Revision 1.20 / (download) - annotate - [select for diffs], Tue Jul 22 18:14:05 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +42 -2 lines
Diff to previous 1.19 (colored)

Security fix to prevent XSS attacks:
Restrict the character set of strings passed into html_alloc(),
in particular architecture names that come from the QUERY_STRING,
but also SCRIPT_NAME and manpath.conf content for additional safety,
and bail out safely on violations.
Issue reported by Sebastien Marie <semarie-openbsd at latrappe dot fr>.

Revision 1.19 / (download) - annotate - [select for diffs], Mon Jul 21 22:32:55 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +10 -6 lines
Diff to previous 1.18 (colored)

fix a minibug reported by kristaps@:
preserve manpath and arch in .Xr links

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jul 21 15:44:22 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

Kristaps points out that the current HTTP/1.1 draft standard (RFC
2616) requires the Location: response-header field to be an absolute
URI (14.30), and only the most recent proposed standard (RFC 7231),
which is barely a month old, allows a relative Location: (7.1.2).
While most modern browsers appear to support relative Location:
headers, some may not, and it's maybe a bit early to rely on relative
Location: headers.

I'm not going back to the HTTP_HOST or SERVER_NAME CGI variables,
though.  While some CGI programs certainly require those, in which
case both the CGI programmer and the web server admin have to be
very careful to keep the system secure and reliable, man.cgi(8)
does not really need them.  We always know at compile time which
domain we are running for, and for man.cgi(8), security and reliability
are definitely much more important than flexibility.  So make HTTP_HOST
a compile-time definition for now.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Jul 19 13:15:07 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +34 -5 lines
Diff to previous 1.16 (colored)

Security fix:
Validate the manpath up front and report a Bad Request if it is not
listed in manpath.conf, such that clients can't probe which directories
exist on the server.  In case of configuration errors, consistently
report Internal Server Error without disclosing any further information.

Partially based on a patch from Sebastien Marie <semarie-openbsd at
latrappe dot fr>, but avoiding a couple of issues with that patch
and approaching the issue in a somewhat more rigorous way.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jul 19 11:35:09 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +29 -2 lines
Diff to previous 1.15 (colored)

Security fix:
Validate the name of the file to show before opening it.
Only allow relative filenames starting with "man" or "cat"
and containing neither "/.." nor "../".

While here, correct the condition discarding an initial "./".

Vulnerability found by Sebastien Marie <semarie-openbsd at latrappe dot fr>.
Many thanks for sending a patch; however, i did not use it but made the
checks even stricter.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Jul 18 19:02:07 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +3 -7 lines
Diff to previous 1.14 (colored)

Do not use the HTTP_HOST CGI variable,
just make the HTTP redirect Location: relative.
Less user input is good, it reduces the attack surface.
Besides, this removes one global variable and 4 lines of code.

Patch from Sebastien Marie <semarie-openbsd at latrappe dot fr>.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Jul 18 14:46:20 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +13 -3 lines
Diff to previous 1.13 (colored)

When the MAN_DIR/manpath.conf configuration file does not exist or is empty,
log the problem, hand the pg_error_internal() error page to the client,
and exit(3) in a controlled way instead of stumbling on and segfaulting
later.

Patch from Sebastien Marie <semarie-openbsd at latrappe dot fr>,
messages tweaked by me.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jul 13 15:38:06 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +16 -5 lines
Diff to previous 1.12 (colored)

Compatibility hack for the old "manpath=OpenBSD<blank>" query parameter format;
unfortunate, more than 400 links needing this are scattered all around
the www.openbsd.org website, and CVSweb needs this as well.

Revision 1.12 / (download) - annotate - [select for diffs], Sun Jul 13 12:55:24 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +22 -23 lines
Diff to previous 1.11 (colored)

Make the calltree a bit easier to understand by giving the
functions that call resp_begin_html() names starting with "pg_"
and those called after resp_begin_html() names with "resp_".
No functional change, purely renaming functions.

Revision 1.11 / (download) - annotate - [select for diffs], Sun Jul 13 12:44:57 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +3 -1 lines
Diff to previous 1.10 (colored)

make source vs. formatted guessing a bit more robust

Revision 1.10 / (download) - annotate - [select for diffs], Sun Jul 13 12:31:00 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +47 -21 lines
Diff to previous 1.9 (colored)

By popular demand, bring man.cgi default mode closer to what man(1) does:
Even when there are multiple pages with the same name in different
sections, show one of them, using the same priorities as in the
default man.conf(5) file.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Jul 13 09:58:52 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +5 -5 lines
Diff to previous 1.8 (colored)

Install the manuals of the web interface below the same directory
as manpath.conf, such that we do not need to mix our own documentation
into the documentation we are serving, which may not even be possible
if the latter is updated automatically.

Based on an idea by beck@.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jul 12 23:40:44 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +97 -28 lines
Diff to previous 1.7 (colored)

Polish the search form using feedback from beck@ and others,
in particular introduce a section dropdown and an architecture dropdown.

Revision 1.7 / (download) - annotate - [select for diffs], Sat Jul 12 18:05:50 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +8 -18 lines
Diff to previous 1.6 (colored)

No need for run-time configuration, add minimal compile-time
configuration facilities, just two paths and two HTML strings.
Show the title on all pages, not just the index page.

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jul 12 17:18:13 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +27 -100 lines
Diff to previous 1.5 (colored)

Simplify: Delete 74 lines of code including one enum type, one
global lookup table, two functions, two function arguments, one
struct member, one local variable, and the "search/" and "show/"
part of the URIs, all without losing functionality.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Jul 12 16:13:36 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +35 -38 lines
Diff to previous 1.4 (colored)

Start fixing issues that beck@ helped find:

Distinguish between man(1) and apropos(1) mode by adding back the classical
QUERY_STRING variable "apropos=".  Change the default back to "apropos=0".
Control it by adding a HTML <SELECT> element for it.

Rename the "expr=" QUERY_STRING variable back to its classical name "query=",
i don't see how the new name is better than the classical one.

While here, drop the concept of a "legacy mode".  Simply continue to
support the features, and use what we consider best.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jul 12 01:52:57 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.3: +9 -8 lines
Diff to previous 1.3 (colored)

fix the two links on the start page

Revision 1.3 / (download) - annotate - [select for diffs], Fri Jul 11 22:16:11 2014 UTC (9 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.2: +9 -7 lines
Diff to previous 1.2 (colored)

make http decode linear time.  also remove a redundant null check.
ok schwarze

Revision 1.2 / (download) - annotate - [select for diffs], Fri Jul 11 22:14:39 2014 UTC (9 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.1: +10 -9 lines
Diff to previous 1.1 (colored)

http headers must end lines with CRLF. ok schwarze

Revision 1.1 / (download) - annotate - [select for diffs], Fri Jul 11 15:37:22 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN

Bring in man.cgi(8) to maintain it in our tree together with mandoc.
It will not be enabled in the build nor installed by default.

A comment in the Makefile lists the three simple steps
needed to build, install, and run it on the two machines
worldwide that are going to run it.

deraadt@ agrees with having the code in the tree.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.