Blame


1 35e1f40a 2021-03-14 op /*
2 0ec5e323 2024-02-03 op * Copyright (c) 2021, 2024 Omar Polo <op@omarpolo.com>
3 35e1f40a 2021-03-14 op *
4 35e1f40a 2021-03-14 op * Permission to use, copy, modify, and distribute this software for any
5 35e1f40a 2021-03-14 op * purpose with or without fee is hereby granted, provided that the above
6 35e1f40a 2021-03-14 op * copyright notice and this permission notice appear in all copies.
7 35e1f40a 2021-03-14 op *
8 35e1f40a 2021-03-14 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 35e1f40a 2021-03-14 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 35e1f40a 2021-03-14 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 35e1f40a 2021-03-14 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 35e1f40a 2021-03-14 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 35e1f40a 2021-03-14 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 35e1f40a 2021-03-14 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 35e1f40a 2021-03-14 op */
16 35e1f40a 2021-03-14 op
17 740f578b 2021-03-15 op /*
18 eb2ed626 2021-10-07 op * Handles config and runtime files
19 740f578b 2021-03-15 op */
20 786e6deb 2021-07-21 op
21 786e6deb 2021-07-21 op #include "compat.h"
22 35e1f40a 2021-03-14 op
23 6cd6a9e1 2021-03-20 op #include <sys/stat.h>
24 65124267 2021-08-13 op #include <sys/types.h>
25 6cd6a9e1 2021-03-20 op
26 65124267 2021-08-13 op #include <dirent.h>
27 35e1f40a 2021-03-14 op #include <errno.h>
28 35e1f40a 2021-03-14 op #include <limits.h>
29 eb2ed626 2021-10-07 op #include <libgen.h>
30 35e1f40a 2021-03-14 op #include <stdio.h>
31 35e1f40a 2021-03-14 op #include <stdlib.h>
32 35e1f40a 2021-03-14 op #include <string.h>
33 35e1f40a 2021-03-14 op #include <unistd.h>
34 4913b479 2021-07-12 op
35 5a824be4 2021-07-13 op #include "pages.h"
36 f63b8f73 2022-04-24 op #include "parser.h"
37 c1d27b0e 2024-06-14 op #include "telescope.h"
38 eb9cbcba 2022-01-03 op #include "session.h"
39 9d65b1d9 2022-01-11 op #include "utils.h"
40 35e1f40a 2021-03-14 op
41 f63b8f73 2022-04-24 op #include "fs.h"
42 f63b8f73 2022-04-24 op
43 f63b8f73 2022-04-24 op #ifndef nitems
44 f63b8f73 2022-04-24 op #define nitems(x) (sizeof(x) / sizeof(x[0]))
45 f63b8f73 2022-04-24 op #endif
46 f63b8f73 2022-04-24 op
47 5cbe1763 2021-08-13 op static int select_non_dot(const struct dirent *);
48 5cbe1763 2021-08-13 op static int select_non_dotdot(const struct dirent *);
49 eb2ed626 2021-10-07 op static size_t join_path(char*, const char*, const char*, size_t);
50 eb2ed626 2021-10-07 op static void getenv_default(char*, const char*, const char*, size_t);
51 eb2ed626 2021-10-07 op static void mkdirs(const char*, mode_t);
52 6c8ddace 2022-01-03 op static void init_paths(void);
53 35e1f40a 2021-03-14 op
54 f88fbabc 2021-11-27 op /*
55 f88fbabc 2021-11-27 op * Where to store user data. These are all equal to ~/.telescope if
56 f88fbabc 2021-11-27 op * it exists.
57 f88fbabc 2021-11-27 op */
58 fb3d08c1 2021-10-07 op char config_path_base[PATH_MAX];
59 fb3d08c1 2021-10-07 op char data_path_base[PATH_MAX];
60 fb3d08c1 2021-10-07 op char cache_path_base[PATH_MAX];
61 eb2ed626 2021-10-07 op
62 4cf6ba13 2022-02-11 op char ctlsock_path[PATH_MAX];
63 eb2ed626 2021-10-07 op char config_path[PATH_MAX];
64 fb3d08c1 2021-10-07 op char lockfile_path[PATH_MAX];
65 fb3d08c1 2021-10-07 op char bookmark_file[PATH_MAX];
66 fb3d08c1 2021-10-07 op char known_hosts_file[PATH_MAX], known_hosts_tmp[PATH_MAX];
67 fb3d08c1 2021-10-07 op char crashed_file[PATH_MAX];
68 de6a6a40 2022-04-24 op char session_file[PATH_MAX], session_file_tmp[PATH_MAX];
69 de6a6a40 2022-04-24 op char history_file[PATH_MAX], history_file_tmp[PATH_MAX];
70 f0e62b85 2024-02-15 op char cert_dir[PATH_MAX], cert_dir_tmp[PATH_MAX];
71 d35e18b3 2024-02-04 op char certs_file[PATH_MAX], certs_file_tmp[PATH_MAX];
72 26e95b82 2024-01-16 op
73 26e95b82 2024-01-16 op char cwd[PATH_MAX];
74 740f578b 2021-03-15 op
75 f63b8f73 2022-04-24 op static int
76 f63b8f73 2022-04-24 op select_non_dot(const struct dirent *d)
77 fb4dc49f 2021-08-13 op {
78 f63b8f73 2022-04-24 op return strcmp(d->d_name, ".");
79 f63b8f73 2022-04-24 op }
80 fb4dc49f 2021-08-13 op
81 f63b8f73 2022-04-24 op static int
82 f63b8f73 2022-04-24 op select_non_dotdot(const struct dirent *d)
83 f63b8f73 2022-04-24 op {
84 f63b8f73 2022-04-24 op return strcmp(d->d_name, ".") && strcmp(d->d_name, "..");
85 fb4dc49f 2021-08-13 op }
86 fb4dc49f 2021-08-13 op
87 fb4dc49f 2021-08-13 op static void
88 f63b8f73 2022-04-24 op send_dir(struct tab *tab, const char *path)
89 35e1f40a 2021-03-14 op {
90 c1d27b0e 2024-06-14 op struct buffer *buffer = &tab->buffer;
91 f63b8f73 2022-04-24 op struct dirent **names;
92 f63b8f73 2022-04-24 op int (*selector)(const struct dirent *) = select_non_dot;
93 f63b8f73 2022-04-24 op int i, len;
94 35e1f40a 2021-03-14 op
95 f63b8f73 2022-04-24 op #if notyet
96 f63b8f73 2022-04-24 op /*
97 f63b8f73 2022-04-24 op * need something to fake a redirect
98 f63b8f73 2022-04-24 op */
99 35e1f40a 2021-03-14 op
100 f63b8f73 2022-04-24 op if (!has_suffix(path, "/")) {
101 3d89457c 2024-06-18 thomas.ad xasprintf(&s, "%s/", path);
102 f63b8f73 2022-04-24 op send_hdr(peerid, 30, s);
103 f63b8f73 2022-04-24 op free(s);
104 f63b8f73 2022-04-24 op return;
105 56e7efb4 2021-07-21 op }
106 f63b8f73 2022-04-24 op #endif
107 56e7efb4 2021-07-21 op
108 f63b8f73 2022-04-24 op if (!strcmp(path, "/"))
109 f63b8f73 2022-04-24 op selector = select_non_dotdot;
110 f63b8f73 2022-04-24 op
111 f63b8f73 2022-04-24 op if ((len = scandir(path, &names, selector, alphasort)) == -1) {
112 f63b8f73 2022-04-24 op load_page_from_str(tab, "# failure reading the directory\n");
113 a2728733 2021-07-18 op return;
114 35e1f40a 2021-03-14 op }
115 a2728733 2021-07-18 op
116 c1d27b0e 2024-06-14 op parser_init(buffer, &gemtext_parser);
117 c1d27b0e 2024-06-14 op parser_parsef(buffer, "# Index of %s\n\n", path);
118 56e7efb4 2021-07-21 op
119 f63b8f73 2022-04-24 op for (i = 0; i < len; ++i) {
120 f63b8f73 2022-04-24 op const char *sufx = "";
121 fb4dc49f 2021-08-13 op
122 f63b8f73 2022-04-24 op if (names[i]->d_type == DT_DIR)
123 f63b8f73 2022-04-24 op sufx = "/";
124 f63b8f73 2022-04-24 op
125 c1d27b0e 2024-06-14 op parser_parsef(buffer, "=> %s%s\n", names[i]->d_name, sufx);
126 f63b8f73 2022-04-24 op }
127 f63b8f73 2022-04-24 op
128 f63b8f73 2022-04-24 op parser_free(tab);
129 f63b8f73 2022-04-24 op free(names);
130 fb4dc49f 2021-08-13 op }
131 fb4dc49f 2021-08-13 op
132 f63b8f73 2022-04-24 op static int
133 f63b8f73 2022-04-24 op is_dir(FILE *fp)
134 24a68158 2021-08-13 op {
135 f63b8f73 2022-04-24 op struct stat sb;
136 24a68158 2021-08-13 op
137 f63b8f73 2022-04-24 op if (fstat(fileno(fp), &sb) == -1)
138 f63b8f73 2022-04-24 op return 0;
139 24a68158 2021-08-13 op
140 f63b8f73 2022-04-24 op return S_ISDIR(sb.st_mode);
141 24a68158 2021-08-13 op }
142 24a68158 2021-08-13 op
143 fd1c80ce 2024-06-14 op static const struct parser *
144 65124267 2021-08-13 op file_type(const char *path)
145 fb4dc49f 2021-08-13 op {
146 21268f10 2022-04-24 op const struct mapping {
147 fd1c80ce 2024-06-14 op const char *ext;
148 fd1c80ce 2024-06-14 op const struct parser *parser;
149 fb4dc49f 2021-08-13 op } ms[] = {
150 c1d27b0e 2024-06-14 op {"diff", &textpatch_parser},
151 c1d27b0e 2024-06-14 op {"gemini", &gemtext_parser},
152 c1d27b0e 2024-06-14 op {"gmi", &gemtext_parser},
153 c1d27b0e 2024-06-14 op {"markdown", &textplain_parser},
154 c1d27b0e 2024-06-14 op {"md", &textplain_parser},
155 c1d27b0e 2024-06-14 op {"patch", &gemtext_parser},
156 fb4dc49f 2021-08-13 op {NULL, NULL},
157 65124267 2021-08-13 op }, *m;
158 21268f10 2022-04-24 op const char *dot;
159 65124267 2021-08-13 op
160 65124267 2021-08-13 op if ((dot = strrchr(path, '.')) == NULL)
161 c1d27b0e 2024-06-14 op return &textplain_parser;
162 65124267 2021-08-13 op
163 65124267 2021-08-13 op dot++;
164 65124267 2021-08-13 op
165 65124267 2021-08-13 op for (m = ms; m->ext != NULL; ++m)
166 65124267 2021-08-13 op if (!strcmp(m->ext, dot))
167 c1d27b0e 2024-06-14 op return m->parser;
168 65124267 2021-08-13 op
169 c1d27b0e 2024-06-14 op return &textplain_parser;
170 5cbe1763 2021-08-13 op }
171 5cbe1763 2021-08-13 op
172 f63b8f73 2022-04-24 op void
173 f63b8f73 2022-04-24 op fs_load_url(struct tab *tab, const char *url)
174 5cbe1763 2021-08-13 op {
175 fd1c80ce 2024-06-14 op const char *bpath = "bookmarks.gmi", *fallback = "# Not found\n";
176 fd1c80ce 2024-06-14 op const struct parser *parser = &gemtext_parser;
177 fd1c80ce 2024-06-14 op char path[PATH_MAX];
178 fd1c80ce 2024-06-14 op FILE *fp = NULL;
179 fd1c80ce 2024-06-14 op size_t i;
180 fd1c80ce 2024-06-14 op char buf[BUFSIZ];
181 f63b8f73 2022-04-24 op struct page {
182 f63b8f73 2022-04-24 op const char *name;
183 f63b8f73 2022-04-24 op const char *path;
184 f63b8f73 2022-04-24 op const uint8_t *data;
185 f63b8f73 2022-04-24 op } pages[] = {
186 47eaa0e0 2024-06-09 op {"about", NULL, about_about},
187 47eaa0e0 2024-06-09 op {"blank", NULL, about_blank},
188 47eaa0e0 2024-06-09 op {"bookmarks", bpath, bookmarks},
189 47eaa0e0 2024-06-09 op {"crash", NULL, about_crash},
190 47eaa0e0 2024-06-09 op {"help", NULL, about_help},
191 47eaa0e0 2024-06-09 op {"license", NULL, about_license},
192 47eaa0e0 2024-06-09 op {"new", NULL, about_new},
193 f63b8f73 2022-04-24 op }, *page = NULL;
194 65124267 2021-08-13 op
195 f63b8f73 2022-04-24 op if (!strncmp(url, "about:", 6)) {
196 f63b8f73 2022-04-24 op url += 6;
197 65124267 2021-08-13 op
198 f63b8f73 2022-04-24 op for (i = 0; page == NULL && i < nitems(pages); ++i) {
199 f63b8f73 2022-04-24 op if (!strcmp(url, pages[i].name))
200 f63b8f73 2022-04-24 op page = &pages[i];
201 f63b8f73 2022-04-24 op }
202 5d43215b 2021-08-13 op
203 f63b8f73 2022-04-24 op if (page == NULL)
204 f63b8f73 2022-04-24 op goto done;
205 5cbe1763 2021-08-13 op
206 f63b8f73 2022-04-24 op strlcpy(path, data_path_base, sizeof(path));
207 f63b8f73 2022-04-24 op strlcat(path, "/", sizeof(path));
208 f63b8f73 2022-04-24 op if (page->path != NULL)
209 f63b8f73 2022-04-24 op strlcat(path, page->path, sizeof(path));
210 f63b8f73 2022-04-24 op else {
211 f63b8f73 2022-04-24 op strlcat(path, "page/about_", sizeof(path));
212 f63b8f73 2022-04-24 op strlcat(path, page->name, sizeof(path));
213 f63b8f73 2022-04-24 op strlcat(path, ".gmi", sizeof(path));
214 f63b8f73 2022-04-24 op }
215 65124267 2021-08-13 op
216 f63b8f73 2022-04-24 op fallback = page->data;
217 f63b8f73 2022-04-24 op } else if (!strncmp(url, "file://", 7)) {
218 f63b8f73 2022-04-24 op url += 7;
219 f63b8f73 2022-04-24 op strlcpy(path, url, sizeof(path));
220 c1d27b0e 2024-06-14 op parser = file_type(url);
221 f63b8f73 2022-04-24 op } else
222 f63b8f73 2022-04-24 op goto done;
223 65124267 2021-08-13 op
224 f63b8f73 2022-04-24 op if ((fp = fopen(path, "r")) == NULL)
225 f63b8f73 2022-04-24 op goto done;
226 65124267 2021-08-13 op
227 f63b8f73 2022-04-24 op if (is_dir(fp)) {
228 f63b8f73 2022-04-24 op send_dir(tab, path);
229 f63b8f73 2022-04-24 op goto done;
230 fb4dc49f 2021-08-13 op }
231 fb4dc49f 2021-08-13 op
232 c1d27b0e 2024-06-14 op parser_init(&tab->buffer, parser);
233 f63b8f73 2022-04-24 op for (;;) {
234 f63b8f73 2022-04-24 op size_t r;
235 fb4dc49f 2021-08-13 op
236 f63b8f73 2022-04-24 op r = fread(buf, 1, sizeof(buf), fp);
237 c1d27b0e 2024-06-14 op if (!parser_parse(&tab->buffer, buf, r))
238 f63b8f73 2022-04-24 op break;
239 f63b8f73 2022-04-24 op if (r != sizeof(buf))
240 f63b8f73 2022-04-24 op break;
241 fb4dc49f 2021-08-13 op }
242 f63b8f73 2022-04-24 op parser_free(tab);
243 fb4dc49f 2021-08-13 op
244 f63b8f73 2022-04-24 op done:
245 f63b8f73 2022-04-24 op if (fp != NULL)
246 f63b8f73 2022-04-24 op fclose(fp);
247 f63b8f73 2022-04-24 op else
248 f63b8f73 2022-04-24 op load_page_from_str(tab, fallback);
249 740f578b 2021-03-15 op }
250 288fd238 2021-04-25 op
251 eb2ed626 2021-10-07 op static size_t
252 eb2ed626 2021-10-07 op join_path(char *buf, const char *lhs, const char *rhs, size_t buflen)
253 35e1f40a 2021-03-14 op {
254 eb2ed626 2021-10-07 op strlcpy(buf, lhs, buflen);
255 eb2ed626 2021-10-07 op return strlcat(buf, rhs, buflen);
256 eb2ed626 2021-10-07 op }
257 d0fd368a 2021-07-15 op
258 eb2ed626 2021-10-07 op static void
259 eb2ed626 2021-10-07 op getenv_default(char *buf, const char *name, const char *def, size_t buflen)
260 eb2ed626 2021-10-07 op {
261 eb2ed626 2021-10-07 op size_t ret;
262 eb2ed626 2021-10-07 op char *home, *env;
263 740f578b 2021-03-15 op
264 eb2ed626 2021-10-07 op if ((home = getenv("HOME")) == NULL)
265 eb2ed626 2021-10-07 op errx(1, "HOME is not defined");
266 3a227e9a 2021-03-18 op
267 eb2ed626 2021-10-07 op if ((env = getenv(name)) != NULL)
268 eb2ed626 2021-10-07 op ret = strlcpy(buf, env, buflen);
269 eb2ed626 2021-10-07 op else
270 eb2ed626 2021-10-07 op ret = join_path(buf, home, def, buflen);
271 288fd238 2021-04-25 op
272 eb2ed626 2021-10-07 op if (ret >= buflen)
273 eb2ed626 2021-10-07 op errx(1, "buffer too small for %s", name);
274 eb2ed626 2021-10-07 op }
275 c7107cec 2021-04-01 op
276 eb2ed626 2021-10-07 op static void
277 eb2ed626 2021-10-07 op mkdirs(const char *path, mode_t mode)
278 eb2ed626 2021-10-07 op {
279 444dad86 2021-10-07 op char copy[PATH_MAX+1], orig[PATH_MAX+1], *parent;
280 ea080950 2021-07-20 op
281 eb2ed626 2021-10-07 op strlcpy(copy, path, sizeof(copy));
282 444dad86 2021-10-07 op strlcpy(orig, path, sizeof(orig));
283 eb2ed626 2021-10-07 op parent = dirname(copy);
284 eb2ed626 2021-10-07 op if (!strcmp(parent, "/"))
285 eb2ed626 2021-10-07 op return;
286 eb2ed626 2021-10-07 op mkdirs(parent, mode);
287 eb2ed626 2021-10-07 op
288 444dad86 2021-10-07 op if (mkdir(orig, mode) != 0) {
289 eb2ed626 2021-10-07 op if (errno == EEXIST)
290 eb2ed626 2021-10-07 op return;
291 444dad86 2021-10-07 op err(1, "can't mkdir %s", orig);
292 eb2ed626 2021-10-07 op }
293 eb2ed626 2021-10-07 op }
294 eb2ed626 2021-10-07 op
295 eb2ed626 2021-10-07 op static void
296 6c8ddace 2022-01-03 op init_paths(void)
297 eb2ed626 2021-10-07 op {
298 7e60a21a 2022-01-03 op char xdg_config_base[PATH_MAX];
299 7e60a21a 2022-01-03 op char xdg_data_base[PATH_MAX];
300 7e60a21a 2022-01-03 op char xdg_cache_base[PATH_MAX];
301 7e60a21a 2022-01-03 op char old_path[PATH_MAX];
302 7e60a21a 2022-01-03 op char *home;
303 7e60a21a 2022-01-03 op struct stat info;
304 eb2ed626 2021-10-07 op
305 26e95b82 2024-01-16 op if (getcwd(cwd, sizeof(cwd)) == NULL)
306 26e95b82 2024-01-16 op err(1, "getcwd failed");
307 26e95b82 2024-01-16 op
308 eb2ed626 2021-10-07 op /* old path */
309 eb2ed626 2021-10-07 op if ((home = getenv("HOME")) == NULL)
310 eb2ed626 2021-10-07 op errx(1, "HOME is not defined");
311 eb2ed626 2021-10-07 op join_path(old_path, home, "/.telescope", sizeof(old_path));
312 eb2ed626 2021-10-07 op
313 eb2ed626 2021-10-07 op /* if ~/.telescope exists, use that instead of xdg dirs */
314 eb2ed626 2021-10-07 op if (stat(old_path, &info) == 0 && S_ISDIR(info.st_mode)) {
315 eb2ed626 2021-10-07 op join_path(config_path_base, home, "/.telescope",
316 eb2ed626 2021-10-07 op sizeof(config_path_base));
317 eb2ed626 2021-10-07 op join_path(data_path_base, home, "/.telescope",
318 eb2ed626 2021-10-07 op sizeof(data_path_base));
319 eb2ed626 2021-10-07 op join_path(cache_path_base, home, "/.telescope",
320 eb2ed626 2021-10-07 op sizeof(cache_path_base));
321 eb2ed626 2021-10-07 op return;
322 eb2ed626 2021-10-07 op }
323 eb2ed626 2021-10-07 op
324 eb2ed626 2021-10-07 op /* xdg paths */
325 eb2ed626 2021-10-07 op getenv_default(xdg_config_base, "XDG_CONFIG_HOME", "/.config",
326 eb2ed626 2021-10-07 op sizeof(xdg_config_base));
327 eb2ed626 2021-10-07 op getenv_default(xdg_data_base, "XDG_DATA_HOME", "/.local/share",
328 eb2ed626 2021-10-07 op sizeof(xdg_data_base));
329 eb2ed626 2021-10-07 op getenv_default(xdg_cache_base, "XDG_CACHE_HOME", "/.cache",
330 eb2ed626 2021-10-07 op sizeof(xdg_cache_base));
331 eb2ed626 2021-10-07 op
332 eb2ed626 2021-10-07 op join_path(config_path_base, xdg_config_base, "/telescope",
333 eb2ed626 2021-10-07 op sizeof(config_path_base));
334 eb2ed626 2021-10-07 op join_path(data_path_base, xdg_data_base, "/telescope",
335 eb2ed626 2021-10-07 op sizeof(data_path_base));
336 eb2ed626 2021-10-07 op join_path(cache_path_base, xdg_cache_base, "/telescope",
337 eb2ed626 2021-10-07 op sizeof(cache_path_base));
338 eb2ed626 2021-10-07 op
339 eb2ed626 2021-10-07 op mkdirs(xdg_config_base, S_IRWXU);
340 eb2ed626 2021-10-07 op mkdirs(xdg_data_base, S_IRWXU);
341 eb2ed626 2021-10-07 op mkdirs(xdg_cache_base, S_IRWXU);
342 eb2ed626 2021-10-07 op
343 eb2ed626 2021-10-07 op mkdirs(config_path_base, S_IRWXU);
344 eb2ed626 2021-10-07 op mkdirs(data_path_base, S_IRWXU);
345 eb2ed626 2021-10-07 op mkdirs(cache_path_base, S_IRWXU);
346 eb2ed626 2021-10-07 op }
347 eb2ed626 2021-10-07 op
348 eb2ed626 2021-10-07 op int
349 eb2ed626 2021-10-07 op fs_init(void)
350 eb2ed626 2021-10-07 op {
351 6c8ddace 2022-01-03 op init_paths();
352 eb2ed626 2021-10-07 op
353 4cf6ba13 2022-02-11 op join_path(ctlsock_path, cache_path_base, "/ctl",
354 4cf6ba13 2022-02-11 op sizeof(ctlsock_path));
355 eb2ed626 2021-10-07 op join_path(config_path, config_path_base, "/config",
356 eb2ed626 2021-10-07 op sizeof(config_path));
357 eb2ed626 2021-10-07 op join_path(lockfile_path, cache_path_base, "/lock",
358 eb2ed626 2021-10-07 op sizeof(lockfile_path));
359 eb2ed626 2021-10-07 op join_path(bookmark_file, data_path_base, "/bookmarks.gmi",
360 eb2ed626 2021-10-07 op sizeof(bookmark_file));
361 eb2ed626 2021-10-07 op join_path(known_hosts_file, data_path_base, "/known_hosts",
362 eb2ed626 2021-10-07 op sizeof(known_hosts_file));
363 eb2ed626 2021-10-07 op join_path(known_hosts_tmp, cache_path_base,
364 eb2ed626 2021-10-07 op "/known_hosts.tmp.XXXXXXXXXX", sizeof(known_hosts_tmp));
365 eb2ed626 2021-10-07 op join_path(session_file, cache_path_base, "/session",
366 de6a6a40 2022-04-24 op sizeof(session_file));
367 de6a6a40 2022-04-24 op join_path(session_file_tmp, cache_path_base, "/session.XXXXXXXXXX",
368 0ec5e323 2024-02-03 op sizeof(session_file_tmp));
369 9e97090d 2022-02-26 op join_path(history_file, cache_path_base, "/history",
370 de6a6a40 2022-04-24 op sizeof(history_file));
371 de6a6a40 2022-04-24 op join_path(history_file_tmp, cache_path_base, "/history.XXXXXXXXXX",
372 0ec5e323 2024-02-03 op sizeof(history_file_tmp));
373 d35e18b3 2024-02-04 op join_path(cert_dir, data_path_base, "/certs/",
374 d35e18b3 2024-02-04 op sizeof(cert_dir));
375 f0e62b85 2024-02-15 op join_path(cert_dir_tmp, data_path_base, "/certs/id.XXXXXXXXXX",
376 f0e62b85 2024-02-15 op sizeof(cert_dir_tmp));
377 64b6a451 2024-02-05 op join_path(certs_file, config_path_base, "/certs.conf",
378 d35e18b3 2024-02-04 op sizeof(certs_file));
379 609eaf39 2024-02-05 op join_path(certs_file_tmp, config_path_base, "/certs.conf.XXXXXXXXXX",
380 d35e18b3 2024-02-04 op sizeof(certs_file_tmp));
381 eb2ed626 2021-10-07 op join_path(crashed_file, cache_path_base, "/crashed",
382 eb2ed626 2021-10-07 op sizeof(crashed_file));
383 eb2ed626 2021-10-07 op
384 d35e18b3 2024-02-04 op mkdirs(cert_dir, S_IRWXU);
385 d35e18b3 2024-02-04 op
386 108aa312 2024-02-14 op return 0;
387 9e97090d 2022-02-26 op }