Compare commits
No commits in common. "01057061f9df3e54bd16b6d0240cd6fe40795165" and "7c4aaf95ea75d63c47819185a390b4a86ec423fd" have entirely different histories.
01057061f9
...
7c4aaf95ea
6 changed files with 13 additions and 12 deletions
|
@ -237,14 +237,14 @@ if you'd like to download the cron job.
|
||||||
### How do I remove expired pastes after some time?
|
### How do I remove expired pastes after some time?
|
||||||
|
|
||||||
You can put that in your crontab (by doing `sudo crontab -e`).
|
You can put that in your crontab (by doing `sudo crontab -e`).
|
||||||
It will delete all files in `/var/www/feuille` that are at least 7
|
It will delete all files in `/var/www/htdocs/feuille` that are at least 7
|
||||||
days old.
|
days old.
|
||||||
|
|
||||||
Don't forget to change the folder to the one **feuille**'s using and
|
Don't forget to change the folder to the one **feuille**'s using and
|
||||||
eventually `+7` to the maximum file age you'd like to use.
|
eventually `+7` to the maximum file age you'd like to use.
|
||||||
|
|
||||||
```
|
```
|
||||||
0 0 * * * find /var/www/feuille -type f -mtime +7 -exec rm {} +
|
0 0 * * * find /var/www/htdocs/feuille -type f -mtime +7 -exec rm {} +
|
||||||
```
|
```
|
||||||
|
|
||||||
See
|
See
|
||||||
|
@ -264,7 +264,7 @@ $ make cgi
|
||||||
|
|
||||||
Once it's done, you can put `./web/cgi/feuille.cgi` in your website's
|
Once it's done, you can put `./web/cgi/feuille.cgi` in your website's
|
||||||
`cgi-bin` folder (usually somewhere like
|
`cgi-bin` folder (usually somewhere like
|
||||||
`/var/www/my.paste.bin/cgi-bin`) and configure your web server
|
`/var/www/htdocs/my.paste.bin/cgi-bin`) and configure your web server
|
||||||
to execute CGI scripts.
|
to execute CGI scripts.
|
||||||
|
|
||||||
You can then create an HTML form that will send a POST request to the
|
You can then create an HTML form that will send a POST request to the
|
||||||
|
|
5
bin.c
5
bin.c
|
@ -34,7 +34,7 @@ char *generate_id(int min_length)
|
||||||
|
|
||||||
/* allocate a buffer to store the ID */
|
/* allocate a buffer to store the ID */
|
||||||
char *buffer;
|
char *buffer;
|
||||||
if ((buffer = malloc((length + 1) * sizeof(char))) == NULL)
|
if ((buffer = calloc(length + 1, sizeof(char))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* for each letter, generate a random one */
|
/* for each letter, generate a random one */
|
||||||
|
@ -43,7 +43,6 @@ char *generate_id(int min_length)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
buffer[i] = id_symbols[rand() % strlen(id_symbols)];
|
buffer[i] = id_symbols[rand() % strlen(id_symbols)];
|
||||||
buffer[i + 1] = 0;
|
|
||||||
|
|
||||||
/* collision? */
|
/* collision? */
|
||||||
if (i == length - 1 && paste_exists(buffer)) {
|
if (i == length - 1 && paste_exists(buffer)) {
|
||||||
|
@ -55,10 +54,12 @@ char *generate_id(int min_length)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = tmp;
|
buffer = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buffer[length] = 0;
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0 0 * * * find /var/www/feuille -type f -mtime +7 -exec rm {} +
|
0 0 * * * find /var/www/htdocs/feuille -type f -mtime +7 -exec rm {} +
|
||||||
|
|
|
@ -64,7 +64,7 @@ Default: \f[V]8888\f[R]
|
||||||
\f[B]-o path\f[R]
|
\f[B]-o path\f[R]
|
||||||
Sets the path where \f[B]feuille\f[R] will output the pastes (and
|
Sets the path where \f[B]feuille\f[R] will output the pastes (and
|
||||||
chroot, if possible).
|
chroot, if possible).
|
||||||
Default: \f[V]/var/www/feuille\f[R]
|
Default: \f[V]/var/www/htdocs/feuille\f[R]
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s bytes\f[R]
|
\f[B]-s bytes\f[R]
|
||||||
Sets the maximum size for every paste (in bytes).
|
Sets the maximum size for every paste (in bytes).
|
||||||
|
@ -104,7 +104,7 @@ Default: the number of threads configured on your machine.
|
||||||
.TP
|
.TP
|
||||||
\f[B]sudo feuille\f[R]
|
\f[B]sudo feuille\f[R]
|
||||||
Runs feuille in the background, chrooting into
|
Runs feuille in the background, chrooting into
|
||||||
\f[V]/var/www/feuille\f[R], dropping root privileges and spawning
|
\f[V]/var/www/htdocs/feuille\f[R], dropping root privileges and spawning
|
||||||
worker processes to accept incoming connections.
|
worker processes to accept incoming connections.
|
||||||
.TP
|
.TP
|
||||||
\f[B]feuille -p 1337\f[R]
|
\f[B]feuille -p 1337\f[R]
|
||||||
|
|
|
@ -49,7 +49,7 @@ and IPv6 addresses (won't work on OpenBSD).
|
||||||
**-o path**
|
**-o path**
|
||||||
: Sets the path where **feuille** will output the pastes (and chroot,
|
: Sets the path where **feuille** will output the pastes (and chroot,
|
||||||
if possible).
|
if possible).
|
||||||
: Default: `/var/www/feuille`
|
: Default: `/var/www/htdocs/feuille`
|
||||||
|
|
||||||
**-s bytes**
|
**-s bytes**
|
||||||
: Sets the maximum size for every paste (in bytes).
|
: Sets the maximum size for every paste (in bytes).
|
||||||
|
@ -88,7 +88,7 @@ you might not want to set this to a huge number.
|
||||||
# EXAMPLES
|
# EXAMPLES
|
||||||
|
|
||||||
**sudo feuille**
|
**sudo feuille**
|
||||||
: Runs feuille in the background, chrooting into `/var/www/feuille`,
|
: Runs feuille in the background, chrooting into `/var/www/htdocs/feuille`,
|
||||||
dropping root privileges and spawning worker processes to accept
|
dropping root privileges and spawning worker processes to accept
|
||||||
incoming connections.
|
incoming connections.
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ char *argv0;
|
||||||
Settings settings = {
|
Settings settings = {
|
||||||
.address = "0.0.0.0",
|
.address = "0.0.0.0",
|
||||||
.url = "http://localhost",
|
.url = "http://localhost",
|
||||||
.output = "/var/www/feuille",
|
.output = "/var/www/htdocs/feuille",
|
||||||
.user = "www",
|
.user = "www",
|
||||||
|
|
||||||
.id_length = 4,
|
.id_length = 4,
|
||||||
|
@ -294,7 +294,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* OpenBSD-only security measures */
|
/* OpenBSD-only security measures */
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
pledge("proc stdio rpath wpath cpath inet", "stdio rpath wpath cpath inet");
|
pledge("stdio proc inet", "stdio wpath inet");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* create a thread pool for incoming connections */
|
/* create a thread pool for incoming connections */
|
||||||
|
|
Reference in a new issue