mirror of
https://github.com/skeeto/endlessh.git
synced 2024-11-29 00:13:07 +01:00
parent
b2c811ecf7
commit
df0ffbf629
19
endlessh.c
19
endlessh.c
@ -1,5 +1,5 @@
|
|||||||
#if defined(__OpenBSD__)
|
#if defined(__OpenBSD__)
|
||||||
# define _BSD_SOURCE /* for pledge(2) */
|
# define _BSD_SOURCE /* for pledge(2) and unveil(2) */
|
||||||
#else
|
#else
|
||||||
# define _XOPEN_SOURCE 600
|
# define _XOPEN_SOURCE 600
|
||||||
#endif
|
#endif
|
||||||
@ -601,13 +601,15 @@ sendline(struct client *client, int max_line_length, unsigned long *rng)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#if (defined(__OpenBSD__))
|
struct config config = CONFIG_DEFAULT;
|
||||||
if (pledge("inet stdio rpath", NULL) == -1)
|
const char *config_file = DEFAULT_CONFIG_FILE;
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
unveil(config_file, "r"); /* return ignored as the file may not exist */
|
||||||
|
if (pledge("inet stdio rpath unveil", 0) == -1)
|
||||||
die();
|
die();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct config config = CONFIG_DEFAULT;
|
|
||||||
const char *config_file = DEFAULT_CONFIG_FILE;
|
|
||||||
config_load(&config, config_file, 1);
|
config_load(&config, config_file, 1);
|
||||||
|
|
||||||
int option;
|
int option;
|
||||||
@ -624,6 +626,13 @@ main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
config_file = optarg;
|
config_file = optarg;
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
unveil(config_file, "r");
|
||||||
|
if (unveil(0, 0) == -1)
|
||||||
|
die();
|
||||||
|
#endif
|
||||||
|
|
||||||
config_load(&config, optarg, 1);
|
config_load(&config, optarg, 1);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
|
Loading…
Reference in New Issue
Block a user