💾 Archived View for gemini.rmf-dev.com › repo › Vaati › Vgmi › files › a00aaa44e6defc72749a9fd28e66d… captured on 2023-11-14 at 08:24:50. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

Go Back

0 /* See LICENSE file for copyright and license details. */

1 #ifndef _SANDBOX_H_

2 #define _SANDBOX_H_

3

4 #include <stddef.h>

5

6 int sandbox_init();

7 int sandbox_close();

8

9 #ifndef NO_SANDBOX

10

11 #ifndef DISABLE_XDG

12 #if defined(__FreeBSD__) || defined(__OpenBSD__) || \

13 defined(__linux__) || defined(sun)

14 int xdg_request(const char*);

15 #ifndef SB_IGNORE

16 #define xdg_open(x) xdg_request(x)

17 #endif

18 #endif

19 #endif

20

21 #ifndef xdg_open

22 int xdg_open(const char*);

23 #endif

24

25 #ifdef __FreeBSD__

26

27 #define SANDBOX_FREEBSD

28

29 extern int config_folder;

30 #include <netdb.h>

31 #include <fcntl.h>

32 #include <stdio.h>

33 int sandbox_getaddrinfo(const char *hostname, const char *servname,

34 const struct addrinfo *hints, struct addrinfo **res);

35 int sandbox_connect(int s, const struct sockaddr *name, socklen_t namelen);

36 int make_readonly(FILE* f);

37 int makefd_readonly(int fd);

38 int make_writeonly(FILE* f);

39 int makefd_writeonly(int fd);

40 int makefd_writeseek(int fd);

41 #ifndef SB_IGNORE

42 #define getaddrinfo(a, b, c, d) sandbox_getaddrinfo(a, b, c, d)

43 #define connect(a, b, c) sandbox_connect(a, b, c)

44 #endif

45

46 #endif // freebsd

47

48 #ifdef sun

49

50 #define SANDBOX_SUN

51

52 #define SBC unsigned int

53 extern SBC WR_BOOKMARKS;

54 extern SBC WR_KNOWNHOSTS;

55 extern SBC WR_KNOWNHOST_ADD;

56 extern SBC WR_DOWNLOAD;

57 extern SBC WR_CERTIFICATE;

58 extern SBC WR_END;

59 extern SBC RD_CERTIFICATE;

60

61 int sandbox_savebookmarks();

62 struct gmi_tab;

63 int sandbox_download(struct gmi_tab* tab, const char* path);

64 int sandbox_dl_length(size_t length);

65 int sandbox_cert_create(char* host, char* error, int errlen);

66 extern int wr_pair[2];

67 extern int rd_pair[2];

68

69 #ifndef SB_IGNORE

70 #define gmi_savebookmarks() sandbox_savebookmarks()

71 #define cert_create(X, Y, Z) sandbox_cert_create(X, Y, Z)

72 #endif

73

74 #endif // sun

75

76 #else // no sandbox

77 int xdg_open(char*);

78 #endif

79

80 #include <signal.h>

81 void sigsys_handler(int signo, siginfo_t *info, void *unused);

82

83 #endif

84