Sunday, March 28, 2021

Re: cgit about-filter in chroot (httpd + slowcgi)

On 2021-03-28, Kristaps Dzonsons <kristaps@bsd.lv> wrote:
>>>> $ cat <<EOF > my-cgit-filter.c
>>>> #include <unistd.h>
>>>> int
>>>> main(void)
>>>> {
>>>> execl("/bin/lowdown", "lowdown", NULL);
>>>> return 1;
>>>> }
>>>> EOF

So essentially all this is doing is stripping off the command line
arguments.

>>>> $ cc my-cgit-filter.c -o my-cgit-filter.c -static

output file overwrites the input file here ^^

> Instead of downloading, recompiling, and installing lowdown; then
> building and installing a program that execs the downloaded lowdown; why
> don't you cut out the first step and call through to the C API installed
> with the lowdown port? There's a full example in the EXAMPLES section
> of lowdown_file(3).

Alternatively you can copy the lowdown binary from the package, along
with libc/libm/ld.so, into the chroot (which can be done from /etc/rc.local).
Then there's no need to recompile things for future lowdown updates.

No comments:

Post a Comment