#️⃣ cat uuidgen.c #include #include #include #include int main(int argc, char *argv[]) { char *p; uuid_t *uuid; uint32_t status; uuid = malloc(sizeof(uuid_t)); if (uuid == NULL) err(1, "malloc()"); uuid_create(uuid, &status); if (status != uuid_s_ok) err(1, "cannot create UUID"); uuid_to_string(uuid, &p, &status); if (status != uuid_s_ok) err(1, "cannot stringify a UUID"); free(uuid); fprintf(stdout, "%s\n", p); free(p); return (0); } #️⃣ cat Makefile PROG= uuidgen MAN= LDSTATIC= ${STATIC} .include #️⃣ cat /etc/httpd.conf server "creepypaste.pw" { listen on egress port 80 no log location "/.well-known/acme-challenge/*" { root "/acme" request strip 2 pass } block return 302 "https://$SERVER_NAME$REQUEST_URI" } server "creepypaste.pw" { listen on egress tls port 443 log access "access.creepypaste.pw.log" log error "error.creepypaste.pw.log" tls { certificate "/etc/ssl/creepypaste.pw.fullchain.pem" key "/etc/ssl/private/creepypaste.pw.key" } hsts { max-age 31556952 preload } tcp { nodelay backlog 10 } # max body size is 128mb connection max request body 134217728 root "/creepypaste.pw" directory index index.html location "/wpad.dat" { no log } location "/favicon.ico" { no log } location "*.php" { fastcgi socket "/run/php-fpm.sock" } location match "^/([0-9a-f\-]+).([txt|csv|jpg|png|pdf|gif|mp4]+)$" { root "paste" request rewrite "/%0" } } #️⃣ cat /etc/acme-client.conf domain creepypaste.pw { alternative names { www.creepypaste.pw } domain key "/etc/ssl/private/creepypaste.pw.key" domain full chain certificate "/etc/ssl/creepypaste.pw.fullchain.pem" sign with letsencrypt } #️⃣ cat /var/cron/tabs/root ~ * * * * /usr/sbin/acme-client creepypaste.pw && rcctl reload httpd #️⃣ cat index.html Just paste #️⃣ cat paste.php media_encoding != NULL && - (entry->media_encoding = strdup(media->media_encoding)) == NULL) { - free(entry); - return (NULL); - } RB_INSERT(mediatypes, types, entry); return (entry); @@ -1214,7 +1209,6 @@ media_delete(struct mediatypes *types, struct media_type *media) { RB_REMOVE(mediatypes, types, media); - free(media->media_encoding); free(media); } diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index 05cbb8e3550..9a6530715c7 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -53,7 +53,7 @@ #define HTTPD_LOGROOT "/logs" #define HTTPD_ACCESS_LOG "access.log" #define HTTPD_ERROR_LOG "error.log" -#define HTTPD_DEFAULT_TYPE { "bin", "application", "octet-stream", NULL } +#define HTTPD_DEFAULT_TYPE { "bin", "application", "octet-stream" } #define HTTPD_LOGVIS VIS_NL|VIS_TAB|VIS_CSTYLE #define HTTPD_TLS_CERT "/etc/ssl/server.crt" #define HTTPD_TLS_KEY "/etc/ssl/private/server.key" @@ -438,7 +438,6 @@ struct media_type { char media_name[MEDIATYPE_NAMEMAX]; char media_type[MEDIATYPE_TYPEMAX]; char media_subtype[MEDIATYPE_TYPEMAX]; - char *media_encoding; RB_ENTRY(media_type) media_entry; }; RB_HEAD(mediatypes, media_type); diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y index 203ddd1b0bb..2fc50b1a1da 100644 --- a/usr.sbin/httpd/parse.y +++ b/usr.sbin/httpd/parse.y @@ -1695,7 +1695,6 @@ load_config(const char *filename, struct httpd *x_conf) (void)strlcpy(m.media_subtype, mediatypes[i].media_subtype, sizeof(m.media_subtype)); - m.media_encoding = NULL; if (media_add(conf->sc_mediatypes, &m) == NULL) { log_warnx("failed to add default media \"%s\"", -- Kind regards, Hiltjo #️⃣ cat selfpaste.sh #!/usr/bin/env sh cd /var/www/creepypaste.pw echo "\n#️⃣ cat uuidgen.c" cat uuidgen.c echo "\n#️⃣ cat Makefile" cat Makefile echo "\n#️⃣ cat /etc/httpd.conf" sed -ne '/creepypaste/,$p' < /etc/httpd.conf echo "\n#️⃣ cat /etc/acme-client.conf" sed -ne '/creepypaste/,$p' < /etc/acme-client.conf echo "\n#️⃣ cat /var/cron/tabs/root" cat /var/cron/tabs/root | grep "creepypaste.pw" echo "\n#️⃣ cat index.html" cat index.html echo "\n#️⃣ cat paste.php" cat paste.php echo "\n#️⃣ cat httpd-encoding-patch.txt" cat httpd-encoding-patch.txt echo "\n#️⃣ cat selfpaste.sh" cat selfpaste.sh