1
0
Fork 0
Commit Graph

23 Commits

Author SHA1 Message Date
Zachary Lee Andrews 6206c24b7e
Update menu.c: Fix JPEG detection.
The existing JPEG detection logic is too restrictive because it checks for the file header "FF D8 FF E0", which only matches JFIF-type JPEG images... Meanwhile EXIF JPEG images are more common these days.

For reference:
FF D8 = JPEG SOI (Start of Image) header
FF-D8-FF-E0 = JFIF
FF-D8-FF-E1 = EXIF
FF-D8-FF-E2 = CIFF
FF-D8-FF-E8 = SPIFF

As you can see checking for the SOI and then FF matches all extent types of JPEG images. \o/
2024-02-27 12:23:16 -05:00
fosslinux d7c297ae5f
Merge pull request #108 from augfab/fix/106
Fix part of issue #106 (option -d)
2024-02-27 11:16:32 +00:00
fosslinux 1a089816fa
Merge pull request #103 from omar-polo/missing-die-fixes
fix call to die with NULL as an argument forgot in #100
2024-02-27 11:15:15 +00:00
fosslinux a00fa5330d Fix URI inserting aribitary scripts
Fixes #118
Fixes #117

Encodes characters using html percent encoding.

I hope this is correct, I'm pretty sure it is, but can't be certain
right now.
2024-02-27 22:12:52 +11:00
Augustin Fabre 9e7885f00f
Stop sending log messages to client when in debug mode
inetd(8) sends the contents of stdout AND stderr to the client. This means that
configuring syslog(3) with LOG_PERROR (print messages to stderr) is a bad idea.
2022-05-29 14:27:32 +02:00
Omar Polo 9f2767fde7 fix call to die with NULL as an argument forgot in #100 2022-01-22 18:44:55 +01:00
Omar Polo f35631e8e2 fix all call to die() with NULL as an argument
This fixes all the calls to die so they pass a proper string and not
NULL.  die blindly pass its arguments to log_fatal, which in turns
relays on vprintf or such.  At least on OpenBSD, giving NULL instead
of a string for %s yields a log entry in syslog:

Jan 21 09:35:22 venera gophernicus: vfprintf %s NULL in "Error: %s %s\^M "

As a side effect, now some errors from pledge and unveil are slightly
more clear.
2022-01-21 09:43:32 +01:00
Augustin Fabre f2ae5e80fc Really check success of getcwd(3)
`getcwd(3)' returns a NULL pointer when it fails, and a pointer to the buffer
when it succeeds. The array of characters (allocated on the stack) is not NULL,
so it cannot be used to check if `getcwd(3)' succeeded. Use the pointer
returned by `getcwd(3)' to check success.
2021-04-07 18:57:27 +02:00
fosslinux 7a02ffd8ec Allow document roots specified with relative paths
Closes #71

Implements this issue by transforming all relative paths into absolute
paths.
2020-12-28 11:03:33 +11:00
Augustin Fabre 9c0b6a66a4
Rework logging logic
This commit fixes issue #42 [0].

Debug level messages are masked unless option `-d' (debug) is used. In this
case, all messages are also printed to stderr.

syslog.h is included in the base POSIX only since issue 6 (POSIX:2001) [1].

`LOG_UPTO' is an extension, not defined by POSIX; an implementation is provided
here for platforms where it is missing.

This code is inspired by OpenBSD's httpd(8) logging functions [2].

[0] https://github.com/gophernicus/gophernicus/issues/42
[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/setlogmask.html
[2] https://cvsweb.openbsd.org/src/usr.sbin/httpd/log.c?rev=1.14&content-type=text/x-cvsweb-markup
2020-10-12 20:21:06 +02:00
Augustin Fabre c5910d5340
Replace spurious tabs in menu with dashes (#81) 2020-08-13 23:46:20 +02:00
fosslinux f09e85be22
Fix prototype mismatch 2020-06-09 09:38:57 +10:00
Augustin Fabre 647d9c762d
Declare function prototypes explicitly
This make it easier to manage separate compilation units (static functions and
global variables, local type definitions, etc.)

The generated header file `functions.h' caused a circular dependency problem;
it wasn't updated automatically when changes were made to the sources (e.g.
new function definition). The sources can't be in the dependency list of
`functions.h' in the Makefile, because `functions.h' is in the dependency list
of each source file. GNU make is able to ignore the circular dependency but not
BSD make.

At any rate, keeping the prototype list up-to-date is easy, because the
compiler will complain if a function is used in a compilation unit but defined
in an other one.

It also makes static analysis easier out of the box.
2020-06-08 13:10:06 +10:00
fosslinux c1c7ffe721
Tabs->spaces borked userlist on most clients 2020-04-30 20:19:44 +10:00
fosslinux ca3b8a8ce4
Sort the ~ selector by date modified
When a gopherer comes in contact with a user listing, the current
order is pretty much useless (by UID). It makes much more sense
to sort by the date modified.

Closes #62
2020-04-28 15:46:49 +10:00
Augustin Fabre 326c15c474
Remove trailing whitespace 2020-04-23 21:18:23 +02:00
Augustin Fabre 5acd7854cc
Fix memory leak in gophermap parsing
FILE pointer `fp' was not closed when the gophermap parsing returned
early.
2020-04-04 12:40:15 +02:00
Augustin Fabre d03d9b0930
Disable HTTP response to HTTP GET/POST requests (#66) 2020-03-31 22:38:18 +02:00
fosslinux 7b58f85a7f
Make description in die() appears everywhere
Before it only appeared in syslog. Make the error more obvious to
the admin, so that it appears on the page as well, and helps with
debugging.

Closes #32.

Yes, I am still alive, have just been busy.
2020-03-29 19:47:17 +11:00
fosslinux 37ac8823b0
Spaces to Tabs as per consensus in #56 2020-02-05 19:19:42 +11:00
Yargo 87362cd316 Filetypes2 (#57)
Re-do filetypes system.

By hb9nks.
2020-01-20 22:36:02 +00:00
fosslinux 2f13c16681
src/bin2c.c should not be executable 2020-01-17 11:07:42 +11:00
Emil Engler 8949d78794
refactor: New hierarchy and refactored Makefile 2020-01-11 20:41:11 +01:00