* In main(), when parsing form input fails, the CGI script exits without
producing any output whatsoever. Wouldn't it be better to actually
emit an error status, instead of expecting the server to do something
sane with a script that produces no output?
* In mpRead(), a check is done to insure the requested length is not
greater than the amount of data still available, and to adjust it
if necessary. However, this check is currently done _after_ reading
data from the putback buffer, in which process len is decremented by
the amount of putback data read, but mpp->offset is not correspondingly
incremented (this happens later). As a result, the check uses too
small a value for len, and so fails to stop reading soon enough if
the requested length is greater than what is available _and_ there
was any data in the putback buffer.
The fix is to move the check to the beginning of mpRead()
* Further, if a read request is satisfied _entirely_ from the putback
buffer, mpp->offset is not updated at all, resulting in a similar
problem. The solution is to update mpp->offset in the "else if (got)"
case.
* In cgiParsePostMultipartInput(), if the Content-Disposition of a part
is not "form-data", afterNextBoundary() is not called before beginning
to process the next part. As a result, parsing of the next part headers
begins with the body of the unwanted part. It is necessary in this case
to call afterNextBoundary() before continuing with the next cycle.
* In handling out-of-memory conditions in afterNextBoundary(), *outP is
set to '\0'. While this is technically legal ('\0' is "an integral
constant expression with the value 0"), it looks funny.
* In cgiCookieString(), a change was introduced in v2.02 which purports
to prevent an overrun in cases where cgiCookie is exactly equal to
the requested cookie name. In fact, the problem can also occur if
the requested name occurs with no values at the end of cgiCookie.
Further, the change from v2.02 does not fix the problem, because it
compares the _pointers_ p and n to NULL, which they will never equal,
rather than comparing the pointers they point at to NUL.
* Also in cgiCookieString(), there is a comment suggesting that the main
loop never terminates except with a return. This is not the case.
For example, it will terminate if the requested cookie is not found
and the cgiCookie string ends in a semicolon.
* Why did days[] (formerly daysOfWeek[]) and months[] become non-static?
This pollutes the namespace of programs using CGIC.
* In cgiReadEnvironment(), when reading in the contents of an uploaded
file, it is possible that a temporary file is successfully created
but then cannot be opened. In this case, no attempt is made to remove
the tempoary file.
* Further, when a form entry does _not_ include an uploaded file,
e->tfileName is set to malloc'd but uninitialized memory. It should
be set to an empty string, by setting e->tfileName[0] to zero after
the 1-byte buffer is allocated.
This changes the buildlink3.mk files to use an include guard for the
recursive include. The use of BUILDLINK_DEPTH, BUILDLINK_DEPENDS,
BUILDLINK_PACKAGES and BUILDLINK_ORDER is handled by a single new
variable BUILDLINK_TREE. Each buildlink3.mk file adds a pair of
enter/exit marker, which can be used to reconstruct the tree and
to determine first level includes. Avoiding := for large variables
(BUILDLINK_ORDER) speeds up parse time as += has linear complexity.
The include guard reduces system time by avoiding reading files over and
over again. For complex packages this reduces both %user and %sys time to
half of the former time.
and add a new helper target and script, "show-buildlink3", that outputs
a listing of the buildlink3.mk files included as well as the depth at
which they are included.
For example, "make show-buildlink3" in fonts/Xft2 displays:
zlib
fontconfig
iconv
zlib
freetype2
expat
freetype2
Xrender
renderproto
RECOMMENDED is removed. It becomes ABI_DEPENDS.
BUILDLINK_RECOMMENDED.foo becomes BUILDLINK_ABI_DEPENDS.foo.
BUILDLINK_DEPENDS.foo becomes BUILDLINK_API_DEPENDS.foo.
BUILDLINK_DEPENDS does not change.
IGNORE_RECOMMENDED (which defaulted to "no") becomes USE_ABI_DEPENDS
which defaults to "yes".
Added to obsolete.mk checking for IGNORE_RECOMMENDED.
I did not manually go through and fix any aesthetic tab/spacing issues.
I have tested the above patch on DragonFly building and packaging
subversion and pkglint and their many dependencies.
I have also tested USE_ABI_DEPENDS=no on my NetBSD workstation (where I
have used IGNORE_RECOMMENDED for a long time). I have been an active user
of IGNORE_RECOMMENDED since it was available.
As suggested, I removed the documentation sentences suggesting bumping for
"security" issues.
As discussed on tech-pkg.
I will commit to revbump, pkglint, pkg_install, createbuildlink separately.
Note that if you use wip, it will fail! I will commit to pkgsrc-wip
later (within day).
Temporary files used to accept file uploads were not closed properly. This
resulted in a file descriptor leak, which was unlikely to be serious because of
the short lifespan of CGI programs and the fact that very few forms upload many
files at once. However, on the Windows platform and possibly some others, file
locking semantics prevented file uploads from working at all with these files
not properly closed. Fixed in 2.05.
Changes 2.04:
Documentation fixes: the cgiHtmlEscape, cgiHtmlEscapeData, cgiValueEscape, and
cgiValueEscapeData routines were named incorrectly in the manual. No code
changes in version 2.04.
Changes 2.03:
Support for setting cookies has been reimplemented. The new code closely
follows the actual practice of web sites that successfully use cookies, rather
than attempting to implement the specification. The new code can successfully
set more than one cookie at a time in typical web browsers.
in the process. (More information on tech-pkg.)
Bump PKGREVISION and BUILDLINK_DEPENDS of all packages using libtool and
installing .la files.
Bump PKGREVISION (only) of all packages depending directly on the above
via a buildlink3 include.
All library names listed by *.la files no longer need to be listed
in the PLIST, e.g., instead of:
lib/libfoo.a
lib/libfoo.la
lib/libfoo.so
lib/libfoo.so.0
lib/libfoo.so.0.1
one simply needs:
lib/libfoo.la
and bsd.pkg.mk will automatically ensure that the additional library
names are listed in the installed package +CONTENTS file.
Also make LIBTOOLIZE_PLIST default to "yes".
This is the code written to accompany Thomas Boutell's book "CGI
Programming in C & Perl". It provides a library of routines for use
in CGI programming, and unlike cgilib-0.5, this library handles the
"multipart/form-data" encoding required to use the FILE input control
type as defined in the HTML specification.
NOTE: It should be aware that there were a few developer visible changes
made from Thomas Boutell's original distribution when integrating it
with the NetBSD packages environment. They are:
1) Instead of being yet another source file which is used in building
the application, the package have been converted totally into a
library format. This library is linked using "-lcgic".
2) As a result of the first item, the developer no longer writes their
entry point under the function name of cgiMain(). Instead, the
user will provide their own main(), and will need to call cgiInit()
before any other cgic function is called.