diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | RELNOTES | 3 | ||||
-rw-r--r-- | etc/disable-programs.inc | 2 | ||||
-rw-r--r-- | etc/kiwix-desktop.profile | 49 | ||||
-rw-r--r-- | src/firecfg/firecfg.config | 1 | ||||
-rw-r--r-- | src/libtrace/libtrace.c | 154 |
6 files changed, 209 insertions, 2 deletions
@@ -116,4 +116,4 @@ We also keep a list of profile fixes for previous released versions in [etc-fixe | |||
116 | 116 | ||
117 | ## New profiles: | 117 | ## New profiles: |
118 | 118 | ||
119 | gnome-sound-recorder, godot, jerry, keepassxc-cli, keepassxc-proxy, klatexformula, klatexformula_cmdl, links, newsbeuter, OpenArena, pandoc, qgis, rhythmbox-client, tcpdump, teams-for-linux, tshark, xlinks, zeal, mpg123, conplay, mpg123.bin, mpg123-alsa, mpg123-id3dump, mpg123-jack, mpg123-nas, mpg123-openal, mpg123-oss, mpg123-portaudio, mpg123-pulse, mpg123-strip, out123, pavucontrol-qt, gnome-characters, gnome-character-map, rsync, Whalebird, tor-browser (AUR), Zulip, tb-starter-wrapper, bzcat | 119 | gnome-sound-recorder, godot, jerry, keepassxc-cli, keepassxc-proxy, klatexformula, klatexformula_cmdl, links, newsbeuter, OpenArena, pandoc, qgis, rhythmbox-client, tcpdump, teams-for-linux, tshark, xlinks, zeal, mpg123, conplay, mpg123.bin, mpg123-alsa, mpg123-id3dump, mpg123-jack, mpg123-nas, mpg123-openal, mpg123-oss, mpg123-portaudio, mpg123-pulse, mpg123-strip, out123, pavucontrol-qt, gnome-characters, gnome-character-map, rsync, Whalebird, tor-browser (AUR), Zulip, tb-starter-wrapper, bzcat, kiwix-desktop |
@@ -12,7 +12,8 @@ firejail (0.9.61) baseline; urgency=low | |||
12 | * new profiles: mpg123-jack, mpg123-nas, mpg123-openal, mpg123-oss | 12 | * new profiles: mpg123-jack, mpg123-nas, mpg123-openal, mpg123-oss |
13 | * new profiles: mpg123-portaudio, mpg123-pulse, mpg123-strip, pavucontrol-qt | 13 | * new profiles: mpg123-portaudio, mpg123-pulse, mpg123-strip, pavucontrol-qt |
14 | * new profiles: gnome-characters, gnome-character-map, rsync, Whalebird, | 14 | * new profiles: gnome-characters, gnome-character-map, rsync, Whalebird, |
15 | * new profiles: tor-browser (AUR), Zulip, tb-starter-wrapper, bzcat | 15 | * new profiles: tor-browser (AUR), Zulip, tb-starter-wrapper, bzcat, |
16 | * new profiles: kiwix-desktop | ||
16 | -- netblue30 <netblue30@yahoo.com> Sat, 1 Jun 2019 08:00:00 -0500 | 17 | -- netblue30 <netblue30@yahoo.com> Sat, 1 Jun 2019 08:00:00 -0500 |
17 | 18 | ||
18 | firejail (0.9.60) baseline; urgency=low | 19 | firejail (0.9.60) baseline; urgency=low |
diff --git a/etc/disable-programs.inc b/etc/disable-programs.inc index c0bf1f8d4..a3f7c570b 100644 --- a/etc/disable-programs.inc +++ b/etc/disable-programs.inc | |||
@@ -509,6 +509,8 @@ blacklist ${HOME}/.local/share/kaffeine | |||
509 | blacklist ${HOME}/.local/share/kate | 509 | blacklist ${HOME}/.local/share/kate |
510 | blacklist ${HOME}/.local/share/kdenlive | 510 | blacklist ${HOME}/.local/share/kdenlive |
511 | blacklist ${HOME}/.local/share/kget | 511 | blacklist ${HOME}/.local/share/kget |
512 | blacklist ${HOME}/.local/share/kiwix | ||
513 | blacklist ${HOME}/.local/share/kiwix-desktop | ||
512 | blacklist ${HOME}/.local/share/klavaro | 514 | blacklist ${HOME}/.local/share/klavaro |
513 | blacklist ${HOME}/.local/share/kmail2 | 515 | blacklist ${HOME}/.local/share/kmail2 |
514 | blacklist ${HOME}/.local/share/knotes | 516 | blacklist ${HOME}/.local/share/knotes |
diff --git a/etc/kiwix-desktop.profile b/etc/kiwix-desktop.profile new file mode 100644 index 000000000..db8f7880c --- /dev/null +++ b/etc/kiwix-desktop.profile | |||
@@ -0,0 +1,49 @@ | |||
1 | # Firejail profile for kiwix-desktop | ||
2 | # Description: view/manage ZIM files | ||
3 | # This file is overwritten after every install/update | ||
4 | # Persistent local customizations | ||
5 | include kiwix-desktop.local | ||
6 | # Persistent global definitions | ||
7 | include globals.local | ||
8 | |||
9 | noblacklist ${HOME}/.local/share/kiwix | ||
10 | noblacklist ${HOME}/.local/share/kiwix-desktop | ||
11 | |||
12 | include disable-common.inc | ||
13 | include disable-devel.inc | ||
14 | include disable-exec.inc | ||
15 | include disable-interpreters.inc | ||
16 | include disable-passwdmgr.inc | ||
17 | include disable-programs.inc | ||
18 | include disable-xdg.inc | ||
19 | |||
20 | mkdir ${HOME}/.local/share/kiwix | ||
21 | mkdir ${HOME}/.local/share/kiwix-desktop | ||
22 | whitelist ${HOME}/.local/share/kiwix | ||
23 | whitelist ${HOME}/.local/share/kiwix-desktop | ||
24 | include whitelist-common.inc | ||
25 | include whitelist-var-common.inc | ||
26 | |||
27 | apparmor | ||
28 | caps.drop all | ||
29 | ipc-namespace | ||
30 | netfilter | ||
31 | # no3d | ||
32 | nodbus | ||
33 | nodvd | ||
34 | nogroups | ||
35 | nonewprivs | ||
36 | noroot | ||
37 | # nosound | ||
38 | notv | ||
39 | nou2f | ||
40 | novideo | ||
41 | protocol unix,inet,inet6,netlink | ||
42 | seccomp.drop @clock,@cpu-emulation,@debug,@module,@obsolete,@raw-io,@reboot,@resources,@swap,acct,add_key,bpf,fanotify_init,io_cancel,io_destroy,io_getevents,io_setup,io_submit,ioprio_set,kcmp,keyctl,mount,name_to_handle_at,nfsservctl,ni_syscall,open_by_handle_at,personality,pivot_root,process_vm_readv,ptrace,remap_file_pages,request_key,setdomainname,sethostname,syslog,umount,umount2,userfaultfd,vhangup,vmsplice | ||
43 | shell none | ||
44 | |||
45 | disable-mnt | ||
46 | private-cache | ||
47 | private-dev | ||
48 | private-etc alsa,alternatives,asound.conf,ca-certificates,crypto-policies,fonts,hostname,hosts,ld.so.cache,machine-id,pki,pulse,resolv.conf,ssl | ||
49 | private-tmp | ||
diff --git a/src/firecfg/firecfg.config b/src/firecfg/firecfg.config index 59d64ceb4..daaa4919e 100644 --- a/src/firecfg/firecfg.config +++ b/src/firecfg/firecfg.config | |||
@@ -314,6 +314,7 @@ kid3 | |||
314 | kid3-cli | 314 | kid3-cli |
315 | kid3-qt | 315 | kid3-qt |
316 | kino | 316 | kino |
317 | kiwix-desktop | ||
317 | klatexformula | 318 | klatexformula |
318 | klatexformula_cmdl | 319 | klatexformula_cmdl |
319 | klavaro | 320 | klavaro |
diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index 60fdb5470..71a1234cc 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c | |||
@@ -43,7 +43,16 @@ static orig_fopen64_t orig_fopen64 = NULL; | |||
43 | // | 43 | // |
44 | // library constructor/destructor | 44 | // library constructor/destructor |
45 | // | 45 | // |
46 | //#define PRINTF_DEVTTY | ||
47 | #ifdef PRINTF_DEVTTY | ||
48 | // Replacing printf with fprintf to /dev/tty in order to fix #561 | ||
49 | // In some cases this crashes the program running in the sandbox. | ||
50 | // Example: | ||
51 | // $ firejail --trace mkdir ttt | ||
52 | // logs the following error in syslog: | ||
53 | // debian kernel: [18521.399073] mkdir[12206]: segfault at 0 ip 00007f77ebf41f6b sp 00007ffe1a0161e0 error 4 in libc-2.24.so[7f77ebe4b000+195000] | ||
46 | static FILE *ftty = NULL; | 54 | static FILE *ftty = NULL; |
55 | #endif | ||
47 | static pid_t mypid = 0; | 56 | static pid_t mypid = 0; |
48 | #define MAXNAME 16 | 57 | #define MAXNAME 16 |
49 | static char myname[MAXNAME] = {'\0', }; | 58 | static char myname[MAXNAME] = {'\0', }; |
@@ -53,7 +62,10 @@ void init(void) { | |||
53 | orig_fopen = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen"); | 62 | orig_fopen = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen"); |
54 | 63 | ||
55 | // tty | 64 | // tty |
65 | #ifdef PRINTF_DEVTTY | ||
56 | ftty = orig_fopen("/dev/tty", "w"); | 66 | ftty = orig_fopen("/dev/tty", "w"); |
67 | printf("*** ftty %p ***\n", ftty); | ||
68 | #endif | ||
57 | 69 | ||
58 | // pid | 70 | // pid |
59 | mypid = getpid(); | 71 | mypid = getpid(); |
@@ -79,7 +91,9 @@ void init(void) { | |||
79 | 91 | ||
80 | static void fini(void) __attribute__((destructor)); | 92 | static void fini(void) __attribute__((destructor)); |
81 | void fini(void) { | 93 | void fini(void) { |
94 | #ifdef PRINTF_DEVTTY | ||
82 | fclose(ftty); | 95 | fclose(ftty); |
96 | #endif | ||
83 | } | 97 | } |
84 | 98 | ||
85 | // | 99 | // |
@@ -226,23 +240,43 @@ static char *translate(XTable *table, int val) { | |||
226 | static void print_sockaddr(int sockfd, const char *call, const struct sockaddr *addr, int rv) { | 240 | static void print_sockaddr(int sockfd, const char *call, const struct sockaddr *addr, int rv) { |
227 | if (addr->sa_family == AF_INET) { | 241 | if (addr->sa_family == AF_INET) { |
228 | struct sockaddr_in *a = (struct sockaddr_in *) addr; | 242 | struct sockaddr_in *a = (struct sockaddr_in *) addr; |
243 | #ifdef PRINTF_DEVTTY | ||
229 | fprintf(ftty, "%u:%s:%s %d %s port %u:%d\n", mypid, myname, call, sockfd, inet_ntoa(a->sin_addr), ntohs(a->sin_port), rv); | 244 | fprintf(ftty, "%u:%s:%s %d %s port %u:%d\n", mypid, myname, call, sockfd, inet_ntoa(a->sin_addr), ntohs(a->sin_port), rv); |
245 | #else | ||
246 | printf("%u:%s:%s %d %s port %u:%d\n", mypid, myname, call, sockfd, inet_ntoa(a->sin_addr), ntohs(a->sin_port), rv); | ||
247 | #endif | ||
230 | } | 248 | } |
231 | else if (addr->sa_family == AF_INET6) { | 249 | else if (addr->sa_family == AF_INET6) { |
232 | struct sockaddr_in6 *a = (struct sockaddr_in6 *) addr; | 250 | struct sockaddr_in6 *a = (struct sockaddr_in6 *) addr; |
233 | char str[INET6_ADDRSTRLEN]; | 251 | char str[INET6_ADDRSTRLEN]; |
234 | inet_ntop(AF_INET6, &(a->sin6_addr), str, INET6_ADDRSTRLEN); | 252 | inet_ntop(AF_INET6, &(a->sin6_addr), str, INET6_ADDRSTRLEN); |
253 | #ifdef PRINTF_DEVTTY | ||
235 | fprintf(ftty, "%u:%s:%s %d %s:%d\n", mypid, myname, call, sockfd, str, rv); | 254 | fprintf(ftty, "%u:%s:%s %d %s:%d\n", mypid, myname, call, sockfd, str, rv); |
255 | #else | ||
256 | printf("%u:%s:%s %d %s:%d\n", mypid, myname, call, sockfd, str, rv); | ||
257 | #endif | ||
236 | } | 258 | } |
237 | else if (addr->sa_family == AF_UNIX) { | 259 | else if (addr->sa_family == AF_UNIX) { |
238 | struct sockaddr_un *a = (struct sockaddr_un *) addr; | 260 | struct sockaddr_un *a = (struct sockaddr_un *) addr; |
239 | if (a->sun_path[0]) | 261 | if (a->sun_path[0]) |
262 | #ifdef PRINTF_DEVTTY | ||
240 | fprintf(ftty, "%u:%s:%s %d %s:%d\n", mypid, myname, call, sockfd, a->sun_path, rv); | 263 | fprintf(ftty, "%u:%s:%s %d %s:%d\n", mypid, myname, call, sockfd, a->sun_path, rv); |
264 | #else | ||
265 | printf("%u:%s:%s %d %s:%d\n", mypid, myname, call, sockfd, a->sun_path, rv); | ||
266 | #endif | ||
241 | else | 267 | else |
268 | #ifdef PRINTF_DEVTTY | ||
242 | fprintf(ftty, "%u:%s:%s %d @%s:%d\n", mypid, myname, call, sockfd, a->sun_path + 1, rv); | 269 | fprintf(ftty, "%u:%s:%s %d @%s:%d\n", mypid, myname, call, sockfd, a->sun_path + 1, rv); |
270 | #else | ||
271 | printf("%u:%s:%s %d @%s:%d\n", mypid, myname, call, sockfd, a->sun_path + 1, rv); | ||
272 | #endif | ||
243 | } | 273 | } |
244 | else { | 274 | else { |
275 | #ifdef PRINTF_DEVTTY | ||
245 | fprintf(ftty, "%u:%s:%s %d family %d:%d\n", mypid, myname, call, sockfd, addr->sa_family, rv); | 276 | fprintf(ftty, "%u:%s:%s %d family %d:%d\n", mypid, myname, call, sockfd, addr->sa_family, rv); |
277 | #else | ||
278 | printf("%u:%s:%s %d family %d:%d\n", mypid, myname, call, sockfd, addr->sa_family, rv); | ||
279 | #endif | ||
246 | } | 280 | } |
247 | } | 281 | } |
248 | 282 | ||
@@ -258,7 +292,11 @@ int open(const char *pathname, int flags, mode_t mode) { | |||
258 | orig_open = (orig_open_t)dlsym(RTLD_NEXT, "open"); | 292 | orig_open = (orig_open_t)dlsym(RTLD_NEXT, "open"); |
259 | 293 | ||
260 | int rv = orig_open(pathname, flags, mode); | 294 | int rv = orig_open(pathname, flags, mode); |
295 | #ifdef PRINTF_DEVTTY | ||
261 | fprintf(ftty, "%u:%s:open %s:%d\n", mypid, myname, pathname, rv); | 296 | fprintf(ftty, "%u:%s:open %s:%d\n", mypid, myname, pathname, rv); |
297 | #else | ||
298 | printf("%u:%s:open %s:%d\n", mypid, myname, pathname, rv); | ||
299 | #endif | ||
262 | return rv; | 300 | return rv; |
263 | } | 301 | } |
264 | 302 | ||
@@ -269,7 +307,11 @@ int open64(const char *pathname, int flags, mode_t mode) { | |||
269 | orig_open64 = (orig_open64_t)dlsym(RTLD_NEXT, "open64"); | 307 | orig_open64 = (orig_open64_t)dlsym(RTLD_NEXT, "open64"); |
270 | 308 | ||
271 | int rv = orig_open64(pathname, flags, mode); | 309 | int rv = orig_open64(pathname, flags, mode); |
310 | #ifdef PRINTF_DEVTTY | ||
272 | fprintf(ftty, "%u:%s:open64 %s:%d\n", mypid, myname, pathname, rv); | 311 | fprintf(ftty, "%u:%s:open64 %s:%d\n", mypid, myname, pathname, rv); |
312 | #else | ||
313 | printf("%u:%s:open64 %s:%d\n", mypid, myname, pathname, rv); | ||
314 | #endif | ||
273 | return rv; | 315 | return rv; |
274 | } | 316 | } |
275 | 317 | ||
@@ -281,7 +323,11 @@ int openat(int dirfd, const char *pathname, int flags, mode_t mode) { | |||
281 | orig_openat = (orig_openat_t)dlsym(RTLD_NEXT, "openat"); | 323 | orig_openat = (orig_openat_t)dlsym(RTLD_NEXT, "openat"); |
282 | 324 | ||
283 | int rv = orig_openat(dirfd, pathname, flags, mode); | 325 | int rv = orig_openat(dirfd, pathname, flags, mode); |
326 | #ifdef PRINTF_DEVTTY | ||
284 | fprintf(ftty, "%u:%s:openat %s:%d\n", mypid, myname, pathname, rv); | 327 | fprintf(ftty, "%u:%s:openat %s:%d\n", mypid, myname, pathname, rv); |
328 | #else | ||
329 | printf("%u:%s:openat %s:%d\n", mypid, myname, pathname, rv); | ||
330 | #endif | ||
285 | return rv; | 331 | return rv; |
286 | } | 332 | } |
287 | 333 | ||
@@ -292,7 +338,11 @@ int openat64(int dirfd, const char *pathname, int flags, mode_t mode) { | |||
292 | orig_openat64 = (orig_openat64_t)dlsym(RTLD_NEXT, "openat64"); | 338 | orig_openat64 = (orig_openat64_t)dlsym(RTLD_NEXT, "openat64"); |
293 | 339 | ||
294 | int rv = orig_openat64(dirfd, pathname, flags, mode); | 340 | int rv = orig_openat64(dirfd, pathname, flags, mode); |
341 | #ifdef PRINTF_DEVTTY | ||
295 | fprintf(ftty, "%u:%s:openat64 %s:%d\n", mypid, myname, pathname, rv); | 342 | fprintf(ftty, "%u:%s:openat64 %s:%d\n", mypid, myname, pathname, rv); |
343 | #else | ||
344 | printf("%u:%s:openat64 %s:%d\n", mypid, myname, pathname, rv); | ||
345 | #endif | ||
296 | return rv; | 346 | return rv; |
297 | } | 347 | } |
298 | 348 | ||
@@ -303,7 +353,11 @@ FILE *fopen(const char *pathname, const char *mode) { | |||
303 | orig_fopen = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen"); | 353 | orig_fopen = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen"); |
304 | 354 | ||
305 | FILE *rv = orig_fopen(pathname, mode); | 355 | FILE *rv = orig_fopen(pathname, mode); |
356 | #ifdef PRINTF_DEVTTY | ||
306 | fprintf(ftty, "%u:%s:fopen %s:%p\n", mypid, myname, pathname, rv); | 357 | fprintf(ftty, "%u:%s:fopen %s:%p\n", mypid, myname, pathname, rv); |
358 | #else | ||
359 | printf("%u:%s:fopen %s:%p\n", mypid, myname, pathname, rv); | ||
360 | #endif | ||
307 | return rv; | 361 | return rv; |
308 | } | 362 | } |
309 | 363 | ||
@@ -313,7 +367,11 @@ FILE *fopen64(const char *pathname, const char *mode) { | |||
313 | orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64"); | 367 | orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64"); |
314 | 368 | ||
315 | FILE *rv = orig_fopen64(pathname, mode); | 369 | FILE *rv = orig_fopen64(pathname, mode); |
370 | #ifdef PRINTF_DEVTTY | ||
316 | fprintf(ftty, "%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv); | 371 | fprintf(ftty, "%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv); |
372 | #else | ||
373 | printf("%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv); | ||
374 | #endif | ||
317 | return rv; | 375 | return rv; |
318 | } | 376 | } |
319 | #endif /* __GLIBC__ */ | 377 | #endif /* __GLIBC__ */ |
@@ -327,7 +385,11 @@ FILE *freopen(const char *pathname, const char *mode, FILE *stream) { | |||
327 | orig_freopen = (orig_freopen_t)dlsym(RTLD_NEXT, "freopen"); | 385 | orig_freopen = (orig_freopen_t)dlsym(RTLD_NEXT, "freopen"); |
328 | 386 | ||
329 | FILE *rv = orig_freopen(pathname, mode, stream); | 387 | FILE *rv = orig_freopen(pathname, mode, stream); |
388 | #ifdef PRINTF_DEVTTY | ||
330 | fprintf(ftty, "%u:%s:freopen %s:%p\n", mypid, myname, pathname, rv); | 389 | fprintf(ftty, "%u:%s:freopen %s:%p\n", mypid, myname, pathname, rv); |
390 | #else | ||
391 | printf("%u:%s:freopen %s:%p\n", mypid, myname, pathname, rv); | ||
392 | #endif | ||
331 | return rv; | 393 | return rv; |
332 | } | 394 | } |
333 | 395 | ||
@@ -339,7 +401,11 @@ FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { | |||
339 | orig_freopen64 = (orig_freopen64_t)dlsym(RTLD_NEXT, "freopen64"); | 401 | orig_freopen64 = (orig_freopen64_t)dlsym(RTLD_NEXT, "freopen64"); |
340 | 402 | ||
341 | FILE *rv = orig_freopen64(pathname, mode, stream); | 403 | FILE *rv = orig_freopen64(pathname, mode, stream); |
404 | #ifdef PRINTF_DEVTTY | ||
342 | fprintf(ftty, "%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv); | 405 | fprintf(ftty, "%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv); |
406 | #else | ||
407 | printf("%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv); | ||
408 | #endif | ||
343 | return rv; | 409 | return rv; |
344 | } | 410 | } |
345 | #endif /* __GLIBC__ */ | 411 | #endif /* __GLIBC__ */ |
@@ -352,7 +418,11 @@ int unlink(const char *pathname) { | |||
352 | orig_unlink = (orig_unlink_t)dlsym(RTLD_NEXT, "unlink"); | 418 | orig_unlink = (orig_unlink_t)dlsym(RTLD_NEXT, "unlink"); |
353 | 419 | ||
354 | int rv = orig_unlink(pathname); | 420 | int rv = orig_unlink(pathname); |
421 | #ifdef PRINTF_DEVTTY | ||
355 | fprintf(ftty, "%u:%s:unlink %s:%d\n", mypid, myname, pathname, rv); | 422 | fprintf(ftty, "%u:%s:unlink %s:%d\n", mypid, myname, pathname, rv); |
423 | #else | ||
424 | printf("%u:%s:unlink %s:%d\n", mypid, myname, pathname, rv); | ||
425 | #endif | ||
356 | return rv; | 426 | return rv; |
357 | } | 427 | } |
358 | 428 | ||
@@ -363,7 +433,11 @@ int unlinkat(int dirfd, const char *pathname, int flags) { | |||
363 | orig_unlinkat = (orig_unlinkat_t)dlsym(RTLD_NEXT, "unlinkat"); | 433 | orig_unlinkat = (orig_unlinkat_t)dlsym(RTLD_NEXT, "unlinkat"); |
364 | 434 | ||
365 | int rv = orig_unlinkat(dirfd, pathname, flags); | 435 | int rv = orig_unlinkat(dirfd, pathname, flags); |
436 | #ifdef PRINTF_DEVTTY | ||
366 | fprintf(ftty, "%u:%s:unlinkat %s:%d\n", mypid, myname, pathname, rv); | 437 | fprintf(ftty, "%u:%s:unlinkat %s:%d\n", mypid, myname, pathname, rv); |
438 | #else | ||
439 | printf("%u:%s:unlinkat %s:%d\n", mypid, myname, pathname, rv); | ||
440 | #endif | ||
367 | return rv; | 441 | return rv; |
368 | } | 442 | } |
369 | 443 | ||
@@ -375,7 +449,11 @@ int mkdir(const char *pathname, mode_t mode) { | |||
375 | orig_mkdir = (orig_mkdir_t)dlsym(RTLD_NEXT, "mkdir"); | 449 | orig_mkdir = (orig_mkdir_t)dlsym(RTLD_NEXT, "mkdir"); |
376 | 450 | ||
377 | int rv = orig_mkdir(pathname, mode); | 451 | int rv = orig_mkdir(pathname, mode); |
452 | #ifdef PRINTF_DEVTTY | ||
378 | fprintf(ftty, "%u:%s:mkdir %s:%d\n", mypid, myname, pathname, rv); | 453 | fprintf(ftty, "%u:%s:mkdir %s:%d\n", mypid, myname, pathname, rv); |
454 | #else | ||
455 | printf("%u:%s:mkdir %s:%d\n", mypid, myname, pathname, rv); | ||
456 | #endif | ||
379 | return rv; | 457 | return rv; |
380 | } | 458 | } |
381 | 459 | ||
@@ -386,7 +464,11 @@ int mkdirat(int dirfd, const char *pathname, mode_t mode) { | |||
386 | orig_mkdirat = (orig_mkdirat_t)dlsym(RTLD_NEXT, "mkdirat"); | 464 | orig_mkdirat = (orig_mkdirat_t)dlsym(RTLD_NEXT, "mkdirat"); |
387 | 465 | ||
388 | int rv = orig_mkdirat(dirfd, pathname, mode); | 466 | int rv = orig_mkdirat(dirfd, pathname, mode); |
467 | #ifdef PRINTF_DEVTTY | ||
389 | fprintf(ftty, "%u:%s:mkdirat %s:%d\n", mypid, myname, pathname, rv); | 468 | fprintf(ftty, "%u:%s:mkdirat %s:%d\n", mypid, myname, pathname, rv); |
469 | #else | ||
470 | printf("%u:%s:mkdirat %s:%d\n", mypid, myname, pathname, rv); | ||
471 | #endif | ||
390 | return rv; | 472 | return rv; |
391 | } | 473 | } |
392 | 474 | ||
@@ -397,7 +479,11 @@ int rmdir(const char *pathname) { | |||
397 | orig_rmdir = (orig_rmdir_t)dlsym(RTLD_NEXT, "rmdir"); | 479 | orig_rmdir = (orig_rmdir_t)dlsym(RTLD_NEXT, "rmdir"); |
398 | 480 | ||
399 | int rv = orig_rmdir(pathname); | 481 | int rv = orig_rmdir(pathname); |
482 | #ifdef PRINTF_DEVTTY | ||
400 | fprintf(ftty, "%u:%s:rmdir %s:%d\n", mypid, myname, pathname, rv); | 483 | fprintf(ftty, "%u:%s:rmdir %s:%d\n", mypid, myname, pathname, rv); |
484 | #else | ||
485 | printf("%u:%s:rmdir %s:%d\n", mypid, myname, pathname, rv); | ||
486 | #endif | ||
401 | return rv; | 487 | return rv; |
402 | } | 488 | } |
403 | 489 | ||
@@ -409,7 +495,11 @@ int stat(const char *pathname, struct stat *statbuf) { | |||
409 | orig_stat = (orig_stat_t)dlsym(RTLD_NEXT, "stat"); | 495 | orig_stat = (orig_stat_t)dlsym(RTLD_NEXT, "stat"); |
410 | 496 | ||
411 | int rv = orig_stat(pathname, statbuf); | 497 | int rv = orig_stat(pathname, statbuf); |
498 | #ifdef PRINTF_DEVTTY | ||
412 | fprintf(ftty, "%u:%s:stat %s:%d\n", mypid, myname, pathname, rv); | 499 | fprintf(ftty, "%u:%s:stat %s:%d\n", mypid, myname, pathname, rv); |
500 | #else | ||
501 | printf("%u:%s:stat %s:%d\n", mypid, myname, pathname, rv); | ||
502 | #endif | ||
413 | return rv; | 503 | return rv; |
414 | } | 504 | } |
415 | 505 | ||
@@ -421,7 +511,11 @@ int stat64(const char *pathname, struct stat64 *statbuf) { | |||
421 | orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); | 511 | orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); |
422 | 512 | ||
423 | int rv = orig_stat64(pathname, statbuf); | 513 | int rv = orig_stat64(pathname, statbuf); |
514 | #ifdef PRINTF_DEVTTY | ||
424 | fprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); | 515 | fprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); |
516 | #else | ||
517 | printf("%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); | ||
518 | #endif | ||
425 | return rv; | 519 | return rv; |
426 | } | 520 | } |
427 | #endif /* __GLIBC__ */ | 521 | #endif /* __GLIBC__ */ |
@@ -434,7 +528,11 @@ int lstat(const char *pathname, struct stat *statbuf) { | |||
434 | orig_lstat = (orig_lstat_t)dlsym(RTLD_NEXT, "lstat"); | 528 | orig_lstat = (orig_lstat_t)dlsym(RTLD_NEXT, "lstat"); |
435 | 529 | ||
436 | int rv = orig_lstat(pathname, statbuf); | 530 | int rv = orig_lstat(pathname, statbuf); |
531 | #ifdef PRINTF_DEVTTY | ||
437 | fprintf(ftty, "%u:%s:lstat %s:%d\n", mypid, myname, pathname, rv); | 532 | fprintf(ftty, "%u:%s:lstat %s:%d\n", mypid, myname, pathname, rv); |
533 | #else | ||
534 | printf("%u:%s:lstat %s:%d\n", mypid, myname, pathname, rv); | ||
535 | #endif | ||
438 | return rv; | 536 | return rv; |
439 | } | 537 | } |
440 | 538 | ||
@@ -446,7 +544,11 @@ int lstat64(const char *pathname, struct stat64 *statbuf) { | |||
446 | orig_lstat64 = (orig_lstat64_t)dlsym(RTLD_NEXT, "lstat64"); | 544 | orig_lstat64 = (orig_lstat64_t)dlsym(RTLD_NEXT, "lstat64"); |
447 | 545 | ||
448 | int rv = orig_lstat64(pathname, statbuf); | 546 | int rv = orig_lstat64(pathname, statbuf); |
547 | #ifdef PRINTF_DEVTTY | ||
449 | fprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); | 548 | fprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); |
549 | #else | ||
550 | printf("%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); | ||
551 | #endif | ||
450 | return rv; | 552 | return rv; |
451 | } | 553 | } |
452 | #endif /* __GLIBC__ */ | 554 | #endif /* __GLIBC__ */ |
@@ -459,7 +561,11 @@ DIR *opendir(const char *pathname) { | |||
459 | orig_opendir = (orig_opendir_t)dlsym(RTLD_NEXT, "opendir"); | 561 | orig_opendir = (orig_opendir_t)dlsym(RTLD_NEXT, "opendir"); |
460 | 562 | ||
461 | DIR *rv = orig_opendir(pathname); | 563 | DIR *rv = orig_opendir(pathname); |
564 | #ifdef PRINTF_DEVTTY | ||
462 | fprintf(ftty, "%u:%s:opendir %s:%p\n", mypid, myname, pathname, rv); | 565 | fprintf(ftty, "%u:%s:opendir %s:%p\n", mypid, myname, pathname, rv); |
566 | #else | ||
567 | printf("%u:%s:opendir %s:%p\n", mypid, myname, pathname, rv); | ||
568 | #endif | ||
463 | return rv; | 569 | return rv; |
464 | } | 570 | } |
465 | 571 | ||
@@ -471,7 +577,11 @@ int access(const char *pathname, int mode) { | |||
471 | orig_access = (orig_access_t)dlsym(RTLD_NEXT, "access"); | 577 | orig_access = (orig_access_t)dlsym(RTLD_NEXT, "access"); |
472 | 578 | ||
473 | int rv = orig_access(pathname, mode); | 579 | int rv = orig_access(pathname, mode); |
580 | #ifdef PRINTF_DEVTTY | ||
474 | fprintf(ftty, "%u:%s:access %s:%d\n", mypid, myname, pathname, rv); | 581 | fprintf(ftty, "%u:%s:access %s:%d\n", mypid, myname, pathname, rv); |
582 | #else | ||
583 | printf("%u:%s:access %s:%d\n", mypid, myname, pathname, rv); | ||
584 | #endif | ||
475 | return rv; | 585 | return rv; |
476 | } | 586 | } |
477 | 587 | ||
@@ -529,7 +639,11 @@ int socket(int domain, int type, int protocol) { | |||
529 | sprintf(ptr, "%s", str); | 639 | sprintf(ptr, "%s", str); |
530 | } | 640 | } |
531 | 641 | ||
642 | #ifdef PRINTF_DEVTTY | ||
532 | fprintf(ftty, "%s:%d\n", socketbuf, rv); | 643 | fprintf(ftty, "%s:%d\n", socketbuf, rv); |
644 | #else | ||
645 | printf("%s:%d\n", socketbuf, rv); | ||
646 | #endif | ||
533 | return rv; | 647 | return rv; |
534 | } | 648 | } |
535 | 649 | ||
@@ -567,7 +681,11 @@ int system(const char *command) { | |||
567 | orig_system = (orig_system_t)dlsym(RTLD_NEXT, "system"); | 681 | orig_system = (orig_system_t)dlsym(RTLD_NEXT, "system"); |
568 | 682 | ||
569 | int rv = orig_system(command); | 683 | int rv = orig_system(command); |
684 | #ifdef PRINTF_DEVTTY | ||
570 | fprintf(ftty, "%u:%s:system %s:%d\n", mypid, myname, command, rv); | 685 | fprintf(ftty, "%u:%s:system %s:%d\n", mypid, myname, command, rv); |
686 | #else | ||
687 | printf("%u:%s:system %s:%d\n", mypid, myname, command, rv); | ||
688 | #endif | ||
571 | 689 | ||
572 | return rv; | 690 | return rv; |
573 | } | 691 | } |
@@ -579,7 +697,11 @@ int setuid(uid_t uid) { | |||
579 | orig_setuid = (orig_setuid_t)dlsym(RTLD_NEXT, "setuid"); | 697 | orig_setuid = (orig_setuid_t)dlsym(RTLD_NEXT, "setuid"); |
580 | 698 | ||
581 | int rv = orig_setuid(uid); | 699 | int rv = orig_setuid(uid); |
700 | #ifdef PRINTF_DEVTTY | ||
582 | fprintf(ftty, "%u:%s:setuid %d:%d\n", mypid, myname, uid, rv); | 701 | fprintf(ftty, "%u:%s:setuid %d:%d\n", mypid, myname, uid, rv); |
702 | #else | ||
703 | printf("%u:%s:setuid %d:%d\n", mypid, myname, uid, rv); | ||
704 | #endif | ||
583 | 705 | ||
584 | return rv; | 706 | return rv; |
585 | } | 707 | } |
@@ -591,7 +713,11 @@ int setgid(gid_t gid) { | |||
591 | orig_setgid = (orig_setgid_t)dlsym(RTLD_NEXT, "setgid"); | 713 | orig_setgid = (orig_setgid_t)dlsym(RTLD_NEXT, "setgid"); |
592 | 714 | ||
593 | int rv = orig_setgid(gid); | 715 | int rv = orig_setgid(gid); |
716 | #ifdef PRINTF_DEVTTY | ||
594 | fprintf(ftty, "%u:%s:setgid %d:%d\n", mypid, myname, gid, rv); | 717 | fprintf(ftty, "%u:%s:setgid %d:%d\n", mypid, myname, gid, rv); |
718 | #else | ||
719 | printf("%u:%s:setgid %d:%d\n", mypid, myname, gid, rv); | ||
720 | #endif | ||
595 | 721 | ||
596 | return rv; | 722 | return rv; |
597 | } | 723 | } |
@@ -603,7 +729,11 @@ int setfsuid(uid_t uid) { | |||
603 | orig_setfsuid = (orig_setfsuid_t)dlsym(RTLD_NEXT, "setfsuid"); | 729 | orig_setfsuid = (orig_setfsuid_t)dlsym(RTLD_NEXT, "setfsuid"); |
604 | 730 | ||
605 | int rv = orig_setfsuid(uid); | 731 | int rv = orig_setfsuid(uid); |
732 | #ifdef PRINTF_DEVTTY | ||
606 | fprintf(ftty, "%u:%s:setfsuid %d:%d\n", mypid, myname, uid, rv); | 733 | fprintf(ftty, "%u:%s:setfsuid %d:%d\n", mypid, myname, uid, rv); |
734 | #else | ||
735 | printf("%u:%s:setfsuid %d:%d\n", mypid, myname, uid, rv); | ||
736 | #endif | ||
607 | 737 | ||
608 | return rv; | 738 | return rv; |
609 | } | 739 | } |
@@ -615,7 +745,11 @@ int setfsgid(gid_t gid) { | |||
615 | orig_setfsgid = (orig_setfsgid_t)dlsym(RTLD_NEXT, "setfsgid"); | 745 | orig_setfsgid = (orig_setfsgid_t)dlsym(RTLD_NEXT, "setfsgid"); |
616 | 746 | ||
617 | int rv = orig_setfsgid(gid); | 747 | int rv = orig_setfsgid(gid); |
748 | #ifdef PRINTF_DEVTTY | ||
618 | fprintf(ftty, "%u:%s:setfsgid %d:%d\n", mypid, myname, gid, rv); | 749 | fprintf(ftty, "%u:%s:setfsgid %d:%d\n", mypid, myname, gid, rv); |
750 | #else | ||
751 | printf("%u:%s:setfsgid %d:%d\n", mypid, myname, gid, rv); | ||
752 | #endif | ||
619 | 753 | ||
620 | return rv; | 754 | return rv; |
621 | } | 755 | } |
@@ -627,7 +761,11 @@ int setreuid(uid_t ruid, uid_t euid) { | |||
627 | orig_setreuid = (orig_setreuid_t)dlsym(RTLD_NEXT, "setreuid"); | 761 | orig_setreuid = (orig_setreuid_t)dlsym(RTLD_NEXT, "setreuid"); |
628 | 762 | ||
629 | int rv = orig_setreuid(ruid, euid); | 763 | int rv = orig_setreuid(ruid, euid); |
764 | #ifdef PRINTF_DEVTTY | ||
630 | fprintf(ftty, "%u:%s:setreuid %d %d:%d\n", mypid, myname, ruid, euid, rv); | 765 | fprintf(ftty, "%u:%s:setreuid %d %d:%d\n", mypid, myname, ruid, euid, rv); |
766 | #else | ||
767 | printf("%u:%s:setreuid %d %d:%d\n", mypid, myname, ruid, euid, rv); | ||
768 | #endif | ||
631 | 769 | ||
632 | return rv; | 770 | return rv; |
633 | } | 771 | } |
@@ -639,7 +777,11 @@ int setregid(gid_t rgid, gid_t egid) { | |||
639 | orig_setregid = (orig_setregid_t)dlsym(RTLD_NEXT, "setregid"); | 777 | orig_setregid = (orig_setregid_t)dlsym(RTLD_NEXT, "setregid"); |
640 | 778 | ||
641 | int rv = orig_setregid(rgid, egid); | 779 | int rv = orig_setregid(rgid, egid); |
780 | #ifdef PRINTF_DEVTTY | ||
642 | fprintf(ftty, "%u:%s:setregid %d %d:%d\n", mypid, myname, rgid, egid, rv); | 781 | fprintf(ftty, "%u:%s:setregid %d %d:%d\n", mypid, myname, rgid, egid, rv); |
782 | #else | ||
783 | printf("%u:%s:setregid %d %d:%d\n", mypid, myname, rgid, egid, rv); | ||
784 | #endif | ||
643 | 785 | ||
644 | return rv; | 786 | return rv; |
645 | } | 787 | } |
@@ -651,7 +793,11 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid) { | |||
651 | orig_setresuid = (orig_setresuid_t)dlsym(RTLD_NEXT, "setresuid"); | 793 | orig_setresuid = (orig_setresuid_t)dlsym(RTLD_NEXT, "setresuid"); |
652 | 794 | ||
653 | int rv = orig_setresuid(ruid, euid, suid); | 795 | int rv = orig_setresuid(ruid, euid, suid); |
796 | #ifdef PRINTF_DEVTTY | ||
654 | fprintf(ftty, "%u:%s:setresuid %d %d %d:%d\n", mypid, myname, ruid, euid, suid, rv); | 797 | fprintf(ftty, "%u:%s:setresuid %d %d %d:%d\n", mypid, myname, ruid, euid, suid, rv); |
798 | #else | ||
799 | printf("%u:%s:setresuid %d %d %d:%d\n", mypid, myname, ruid, euid, suid, rv); | ||
800 | #endif | ||
655 | 801 | ||
656 | return rv; | 802 | return rv; |
657 | } | 803 | } |
@@ -663,7 +809,11 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid) { | |||
663 | orig_setresgid = (orig_setresgid_t)dlsym(RTLD_NEXT, "setresgid"); | 809 | orig_setresgid = (orig_setresgid_t)dlsym(RTLD_NEXT, "setresgid"); |
664 | 810 | ||
665 | int rv = orig_setresgid(rgid, egid, sgid); | 811 | int rv = orig_setresgid(rgid, egid, sgid); |
812 | #ifdef PRINTF_DEVTTY | ||
666 | fprintf(ftty, "%u:%s:setresgid %d %d %d:%d\n", mypid, myname, rgid, egid, sgid, rv); | 813 | fprintf(ftty, "%u:%s:setresgid %d %d %d:%d\n", mypid, myname, rgid, egid, sgid, rv); |
814 | #else | ||
815 | printf("%u:%s:setresgid %d %d %d:%d\n", mypid, myname, rgid, egid, sgid, rv); | ||
816 | #endif | ||
667 | 817 | ||
668 | return rv; | 818 | return rv; |
669 | } | 819 | } |
@@ -678,6 +828,10 @@ static void log_exec(int argc, char** argv) { | |||
678 | int rv = readlink("/proc/self/exe", buf, PATH_MAX); | 828 | int rv = readlink("/proc/self/exe", buf, PATH_MAX); |
679 | if (rv != -1) { | 829 | if (rv != -1) { |
680 | buf[rv] = '\0'; // readlink does not add a '\0' at the end | 830 | buf[rv] = '\0'; // readlink does not add a '\0' at the end |
831 | #ifdef PRINTF_DEVTTY | ||
681 | fprintf(ftty, "%u:%s:exec %s:0\n", mypid, myname, buf); | 832 | fprintf(ftty, "%u:%s:exec %s:0\n", mypid, myname, buf); |
833 | #else | ||
834 | printf("%u:%s:exec %s:0\n", mypid, myname, buf); | ||
835 | #endif | ||
682 | } | 836 | } |
683 | } | 837 | } |