Merge branch 'release/0.5.0'

This commit is contained in:
Sebastian Ramacher 2022-09-08 23:57:02 +02:00
commit 1001473ce8
44 changed files with 408 additions and 350 deletions

20
.clang-format Normal file
View file

@ -0,0 +1,20 @@
---
Language: Cpp
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignOperands: true
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: All
BreakBeforeBraces: Linux
ContinuationIndentWidth: 2
ColumnLimit: 120
ForEachMacros: ['GIRARA_LIST_FOREACH']
IndentWidth: 2
PointerAlignment: Left
TabWidth: 2
IndentCaseLabels: true
...

View file

@ -44,12 +44,12 @@ test:archlinux:
except:
- tags
# Debian 10 (Buster)
build:debian-buster:
# Debian 11 (bullseye)
build:debian-bullseye:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:buster
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bullseye
script:
- meson subprojects update
- mkdir -p build && cd build
@ -64,11 +64,11 @@ build:debian-buster:
except:
- tags
test:debian-buster:
test:debian-bullseye:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:buster
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bullseye
script:
- cd build
- ninja test
@ -76,16 +76,16 @@ test:debian-buster:
<<: *girara_cache
policy: pull
dependencies:
- build:debian-buster
- build:debian-bullseye
except:
- tags
# Ubuntu 18.04 LTS (Bionic Beaver)
build:ubuntu-bionic:
# Debian 12 (bookworm)
build:debian-bookworm:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:bionic
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bookworm
script:
- meson subprojects update
- mkdir -p build && cd build
@ -100,11 +100,11 @@ build:ubuntu-bionic:
except:
- tags
test:ubuntu-bionic:
test:debian-bookworm:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:bionic
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bookworm
script:
- cd build
- ninja test
@ -112,16 +112,16 @@ test:ubuntu-bionic:
<<: *girara_cache
policy: pull
dependencies:
- build:ubuntu-bionic
- build:debian-bookworm
except:
- tags
# Ubuntu 19.10 (Eoan Ermine)
build:ubuntu-eoan:
# Ubuntu 20.04 LTS (Focal)
build:ubuntu-focal:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:eoan
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:focal
script:
- meson subprojects update
- mkdir -p build && cd build
@ -136,11 +136,11 @@ build:ubuntu-eoan:
except:
- tags
test:ubuntu-eoan:
test:ubuntu-focal:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:eoan
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:focal
script:
- cd build
- ninja test
@ -148,6 +148,43 @@ test:ubuntu-eoan:
<<: *girara_cache
policy: pull
dependencies:
- build:ubuntu-eoan
- build:ubuntu-focal
except:
- tags
# Ubuntu 22.04 LTS (jammy)
build:ubuntu-jammy:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:jammy
script:
- meson subprojects update
- mkdir -p build && cd build
- meson --force-fallback-for=girara ..
- ninja
cache:
<<: *girara_cache
artifacts:
expire_in: 1 day
paths:
- build
except:
- tags
test:ubuntu-jammy:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:jammy
script:
- cd build
- ninja test
cache:
<<: *girara_cache
policy: pull
dependencies:
- build:ubuntu-jammy
except:
- tags

View file

@ -12,11 +12,11 @@ The following dependencies are required:
* `gtk3` (>= 3.22)
* `glib` (>= 2.50)
* `girara` (>= 0.3.7)
* `libmagic` from file(1): for mime-type detection
The following dependencies are optional:
* `sqlite3` (>= 3.6.23): splite3 database backend
* `libmagic` from file(1): for mime-type detection
* `libsynctex` from TeXLive (>= 1.19): SyncTeX support
* `libseccomp`: sandbox support

View file

@ -72,14 +72,14 @@ fish_completion = configure_file(
bash_comp = dependency('bash-completion', required: false)
if bash_comp.found()
bash_compdir = bash_comp.get_pkgconfig_variable('completionsdir')
bash_compdir = bash_comp.get_variable(pkgconfig: 'completionsdir')
else
bash_compdir = join_paths(datadir, 'bash-completion', 'completions')
endif
fish_comp = dependency('fish', required: false)
if fish_comp.found()
fish_compdir = fish_comp.get_pkgconfig_variable('completionsdir')
fish_compdir = fish_comp.get_variable(pkgconfig: 'completionsdir')
else
fish_compdir = join_paths(datadir, 'fish', 'vendor_completions.d')
endif

View file

@ -967,6 +967,9 @@ zathura
* printing
* bookmarks and history
The strict sandbox mode is still experimental with some libc implementations.
Currently supported and tested libc implementations: glibc
No feature regressions are expected when using normal sandbox mode.
When running under WSL, the default is "none" since seccomp is not supported in

View file

@ -1,5 +1,5 @@
project('zathura', 'c',
version: '0.4.9',
version: '0.5.0',
meson_version: '>=0.56',
default_options: ['c_std=c11', 'warning_level=3'],
)
@ -44,8 +44,9 @@ gthread = dependency('gthread-2.0', version: '>=2.50')
gmodule = dependency('gmodule-no-export-2.0', version: '>=2.50')
gtk3 = dependency('gtk+-3.0', version: '>=3.22')
cairo = dependency('cairo')
magic = cc.find_library('magic', required: true)
build_dependencies = [libm, girara, glib, gio, gthread, gmodule, gtk3, cairo]
build_dependencies = [libm, girara, glib, gio, gthread, gmodule, gtk3, cairo, magic]
if host_machine.system() == 'darwin'
gtk_mac_integration = dependency('gtk-mac-integration-gtk3')
@ -77,7 +78,6 @@ flags = cc.get_supported_arguments(flags)
additional_sources = []
sqlite = dependency('sqlite3', version: '>=3.6.23', required: get_option('sqlite'))
synctex = dependency('synctex', version: '>=1.19', required: get_option('synctex'))
magic = cc.find_library('magic', required: get_option('magic'))
seccomp = dependency('libseccomp', required: get_option('seccomp'))
if sqlite.found()
@ -94,11 +94,6 @@ if synctex.found()
endif
endif
if magic.found()
build_dependencies += magic
defines += '-DWITH_MAGIC'
endif
if seccomp.found()
build_dependencies += seccomp
defines += '-DWITH_SECCOMP'

View file

@ -8,11 +8,6 @@ option('synctex',
value: 'auto',
description: 'SyncTeX integration'
)
option('magic',
type: 'feature',
value: 'auto',
description: 'magic-based MIME type detection'
)
option('seccomp',
type: 'feature',
value: 'auto',

View file

@ -7,9 +7,9 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"Last-Translator: abouzakaria kov <zakariakov@gmail.com>\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Language-Team: Arabic (http://www.transifex.com/pwmt/zathura/language/ar/)\n"
"Language: ar\n"
"MIME-Version: 1.0\n"

View file

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Catalan (http://www.transifex.com/pwmt/zathura/language/ca/)\n"
"Language: ca\n"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Czech (http://www.transifex.com/pwmt/zathura/language/cs/)\n"
"Language: cs\n"

View file

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-02-13 19:17+0100\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: German (http://www.transifex.com/pwmt/zathura/language/de/)\n"
"Language: de\n"

View file

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Greek (http://www.transifex.com/pwmt/zathura/language/el/)\n"
"Language: el\n"

View file

@ -7,9 +7,9 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: norbux <manelsales@ono.com>, 2012\n"
"Language-Team: Esperanto (http://www.transifex.com/pwmt/zathura/language/"
"eo/)\n"
"Language: eo\n"

View file

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Spanish (http://www.transifex.com/pwmt/zathura/language/es/)\n"
"Language: es\n"
@ -32,9 +32,9 @@ msgid ""
"completely view and navigate through documents without using a mouse."
msgstr ""
"Zathura es un visor de documentos altamente personalizable y funcional. "
"Proporciona una interfaz ligera y minimalista, fácil de usar, pensada para ser"
" utilizada con teclado. Zathura posibilita ver y navegar por documentos sin "
"necesidad de utilizar el ratón."
"Proporciona una interfaz ligera y minimalista, fácil de usar, pensada para "
"ser utilizada con teclado. Zathura posibilita ver y navegar por documentos "
"sin necesidad de utilizar el ratón."
#: data/org.pwmt.zathura.appdata.xml.in:17
msgid ""
@ -447,8 +447,8 @@ msgstr "Mostrar el nombre del archivo en el título de la ventana"
#: zathura/config.c:277
msgid "Use ~ instead of $HOME in the filename in the window title"
msgstr "Mostrar ~ en lugar de $HOME en el nombre de archivo del título de la "
"ventana"
msgstr ""
"Mostrar ~ en lugar de $HOME en el nombre de archivo del título de la ventana"
#: zathura/config.c:279
msgid "Display the page number in the window title"
@ -464,8 +464,8 @@ msgstr "Mostrar el nombre corto del archivo en la barra de estado"
#: zathura/config.c:285
msgid "Use ~ instead of $HOME in the filename in the statusbar"
msgstr "Mostrar ~ en lugar de $HOME en el nombre de archivo de la barra de "
"estado"
msgstr ""
"Mostrar ~ en lugar de $HOME en el nombre de archivo de la barra de estado"
#: zathura/config.c:287
msgid "Display (current page / total pages) as a percent in the statusbar"
@ -591,7 +591,8 @@ msgstr "Error al tratar de ejecutar xdg-open"
#: zathura/links.c:247
msgid "Opening external applications in strict sandbox mode is not permitted"
msgstr "La apertura de aplicaciones externas en modo sandbox estricto no está "
msgstr ""
"La apertura de aplicaciones externas en modo sandbox estricto no está "
"permitida"
#: zathura/links.c:280
@ -725,8 +726,8 @@ msgstr "[Sin nombre]"
#: zathura/zathura.c:837
msgid "Could not read file from stdin and write it to a temporary file."
msgstr "No se pudo leer el archivo desde stdin y escribirlo en un archivo "
"temporal."
msgstr ""
"No se pudo leer el archivo desde stdin y escribirlo en un archivo temporal."
#: zathura/zathura.c:857
msgid "Could not read file from GIO and copy it to a temporary file."

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Spanish (Chile) (http://www.transifex.com/pwmt/zathura/"
"language/es_CL/)\n"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Estonian (http://www.transifex.com/pwmt/zathura/language/"
"et/)\n"

View file

@ -12,8 +12,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Benjamin Betti <benjamin@betti.me>\n"
"Language-Team: French (http://www.transifex.com/pwmt/zathura/language/fr/)\n"
"Language: fr\n"

View file

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Hebrew (http://www.transifex.com/pwmt/zathura/language/he/)\n"
"Language: he\n"

View file

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Croatian (http://www.transifex.com/pwmt/zathura/language/"
"hr/)\n"
@ -15,8 +15,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#: data/org.pwmt.zathura.appdata.xml.in:7 data/org.pwmt.zathura.desktop.in:5
msgid "Zathura"

View file

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Indonesian (Indonesia) (http://www.transifex.com/pwmt/zathura/"
"language/id_ID/)\n"

View file

@ -11,8 +11,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Simone Dotto <simonedotto@protonmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/pwmt/zathura/language/it/)\n"
"Language: it\n"
@ -331,7 +331,7 @@ msgstr "Colore per evidenziare"
#: zathura/config.c:218
msgid "Foreground color for highlighting"
msgstr ""
msgstr "Colore di primo piano per l'evidenziazione"
#: zathura/config.c:220
msgid "Color for highlighting (active)"
@ -474,6 +474,7 @@ msgstr "Usa ~ al posto di $HOME nel nome del file nella barra di stato"
#: zathura/config.c:287
msgid "Display (current page / total pages) as a percent in the statusbar"
msgstr ""
"Mostra (pagina attuale / pagine totali) in percentuale nella barra di stato"
#: zathura/config.c:289
msgid "Enable synctex support"
@ -489,7 +490,7 @@ msgstr "Abilita il servizio D-Bus"
#: zathura/config.c:293
msgid "Raise window on certain D-Bus commands"
msgstr ""
msgstr "Solleva la finestra in corrispondenza di certi comandi di D-Bus"
#: zathura/config.c:295
msgid "Save history at each page change"
@ -587,7 +588,7 @@ msgstr "Mostra informazioni sulla versione"
#: zathura/config.c:516
msgid "Source config file"
msgstr ""
msgstr "File di configurazione sorgente"
#: zathura/links.c:233
msgid "Failed to run xdg-open."
@ -616,12 +617,12 @@ msgstr "Link: non valido"
#: zathura/links.c:305
#, c-format
msgid "Copied page number: %d"
msgstr ""
msgstr "Copiata pagina numero: %d"
#: zathura/links.c:314
#, c-format
msgid "Copied link: %s"
msgstr ""
msgstr "Copiato il link: %s"
#: zathura/main.c:151
msgid "Reparents to window specified by xid (X11)"
@ -681,7 +682,7 @@ msgstr "Avvia in una modalità non standard"
#: zathura/main.c:165
msgid "Bookmark to go to"
msgstr ""
msgstr "Segnalibro a cui andare"
#: zathura/main.c:166
msgid "Search for the given phrase and display results"
@ -753,7 +754,7 @@ msgstr "Il documento non contiene alcuna pagina"
#: zathura/zathura.c:1371
#, c-format
msgid "File already exists: %s. Use :write! to overwrite it."
msgstr ""
msgstr "Il file esiste già: %s. Usa :write! per sovrascriverlo."
#: zathura/zathura.c:1380
msgid "Failed to save document."

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Lithuanian (http://www.transifex.com/pwmt/zathura/language/"
"lt/)\n"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 19:20+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Heimen Stoffels <vistausss@fastmail.com>\n"
"Language-Team: Dutch (http://www.transifex.com/pwmt/zathura/language/nl/)\n"
"Language: nl\n"
@ -469,7 +469,7 @@ msgstr "~ gebruiken i.p.v. $HOME in de bestandsnaam in de statusbalk"
#: zathura/config.c:287
msgid "Display (current page / total pages) as a percent in the statusbar"
msgstr ""
msgstr "Huidige pagina/Totaalaantal in procenten tonen op statusbalk"
#: zathura/config.c:289
msgid "Enable synctex support"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Norwegian (http://www.transifex.com/pwmt/zathura/language/"
"no/)\n"

View file

@ -8,17 +8,17 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Polish (http://www.transifex.com/pwmt/zathura/language/pl/)\n"
"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n"
"%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n"
"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && "
"(n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && "
"n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
#: data/org.pwmt.zathura.appdata.xml.in:7 data/org.pwmt.zathura.desktop.in:5
msgid "Zathura"

View file

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Fernando Henrique <liquuid@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/pwmt/zathura/"
"language/pt_BR/)\n"

View file

@ -12,17 +12,17 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: AlexanderFilev <avfill@outlook.com>\n"
"Language-Team: Russian (http://www.transifex.com/pwmt/zathura/language/ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n"
"%100>=11 && n%100<=14)? 2 : 3);\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
"(n%100>=11 && n%100<=14)? 2 : 3);\n"
#: data/org.pwmt.zathura.appdata.xml.in:7 data/org.pwmt.zathura.desktop.in:5
msgid "Zathura"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Rasmussen <sebras@gmail.com>\n"
"Language-Team: Swedish (http://www.transifex.com/pwmt/zathura/language/sv/)\n"
"Language: sv\n"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Tamil (India) (http://www.transifex.com/pwmt/zathura/language/"
"ta_IN/)\n"

View file

@ -12,8 +12,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-08 05:07+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Bunyamin Can Sahan\n"
"Language-Team: Turkish (http://www.transifex.com/pwmt/zathura/language/tr/)\n"
"Language: tr\n"

View file

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: zathura\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-12 12:54+0100\n"
"PO-Revision-Date: 2022-01-06 14:12+0000\n"
"POT-Creation-Date: 2022-05-07 23:53+0200\n"
"PO-Revision-Date: 2012-03-26 16:47+0000\n"
"Last-Translator: Юрій Яновський <lytvyn349@ukr.net>\n"
"Language-Team: Ukrainian (Ukraine) (http://www.transifex.com/pwmt/zathura/"
"language/uk_UA/)\n"

View file

@ -1,46 +1,29 @@
/* SPDX-License-Identifier: Zlib */
#include "content-type.h"
#include "macros.h"
#include <girara/utils.h>
#ifdef WITH_MAGIC
#include <magic.h>
#else
#include <sys/types.h>
#include <sys/wait.h>
#endif
#include <stdio.h>
#include <glib.h>
#include <gio/gio.h>
#include <girara/utils.h>
#include <glib.h>
#include <magic.h>
#include <stdio.h>
struct zathura_content_type_context_s
{
#ifdef WITH_MAGIC
struct zathura_content_type_context_s {
magic_t magic;
#else
void* magic;
#endif
};
zathura_content_type_context_t*
zathura_content_type_new(void)
{
zathura_content_type_context_t* context =
g_try_malloc0(sizeof(zathura_content_type_context_t));
zathura_content_type_context_t* context = g_try_malloc0(sizeof(zathura_content_type_context_t));
if (context == NULL) {
return NULL;
}
#ifdef WITH_MAGIC
/* creat magic cookie */
static const int flags =
MAGIC_ERROR |
MAGIC_MIME_TYPE |
MAGIC_SYMLINK |
MAGIC_NO_CHECK_APPTYPE |
MAGIC_NO_CHECK_CDF |
MAGIC_NO_CHECK_ELF |
MAGIC_NO_CHECK_ENCODING;
static const int flags = MAGIC_ERROR | MAGIC_MIME_TYPE | MAGIC_SYMLINK | MAGIC_NO_CHECK_APPTYPE | MAGIC_NO_CHECK_CDF |
MAGIC_NO_CHECK_ELF | MAGIC_NO_CHECK_ENCODING;
magic_t magic = magic_open(flags);
if (magic == NULL) {
girara_debug("failed creating the magic cookie");
@ -55,32 +38,22 @@ zathura_content_type_new(void)
}
context->magic = magic;
#endif
return context;
}
void
zathura_content_type_free(zathura_content_type_context_t* context)
{
if (context == NULL) {
return;
}
#ifdef WITH_MAGIC
if (context->magic != NULL) {
if (context != NULL && context->magic != NULL) {
magic_close(context->magic);
}
#endif
g_free(context);
}
/** Read a most GT_MAX_READ bytes before falling back to file. */
static const size_t GT_MAX_READ = 1 << 16;
#ifdef WITH_MAGIC
static char*
guess_type_magic(zathura_content_type_context_t* context, const char* path)
{
@ -108,67 +81,11 @@ guess_type_magic(zathura_content_type_context_t* context, const char* path)
return content_type;
}
static char*
guess_type_file(const char* UNUSED(path))
{
return NULL;
}
#else
static char*
guess_type_magic(zathura_content_type_context_t* UNUSED(context),
const char* UNUSED(path))
{
return NULL;
}
static char*
guess_type_file(const char* path)
{
/* g_spawn_async expects char** */
static char cmd_file[] = "file";
static char opt_b[] = "-b";
static char opt_mime_type[] = "--mime-type";
char* argv[] = { cmd_file, opt_b, opt_mime_type, g_strdup(path), NULL };
GError* error = NULL;
char* out = NULL;
int ret = 0;
const bool r = g_spawn_sync(NULL, argv, NULL,
G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
NULL, NULL, &out, NULL, &ret, &error);
g_free(argv[3]);
if (r == false) {
girara_warning("failed to execute command: %s", error->message);
g_error_free(error);
g_free(out);
return NULL;
}
if (g_spawn_check_exit_status(ret, &error) == false) {
girara_warning("file failed: %s", error->message);
g_error_free(error);
g_free(out);
return NULL;
}
g_strdelimit(out, "\n\r", '\0');
girara_debug("file detected filetype: %s", out);
char* content_type = g_content_type_from_mime_type(out);
if (content_type == NULL) {
girara_warning("failed to convert mime type to content type: %s", out);
return out;
}
g_free(out);
return content_type;
}
#endif
static char*
guess_type_glib(const char* path)
{
gboolean uncertain = FALSE;
char* content_type = g_content_type_guess(path, NULL, 0, &uncertain);
gboolean uncertain = FALSE;
char* content_type = g_content_type_guess(path, NULL, 0, &uncertain);
if (content_type == NULL) {
girara_debug("g_content_type failed\n");
} else {
@ -185,7 +102,7 @@ guess_type_glib(const char* path)
}
guchar* content = NULL;
size_t length = 0;
size_t length = 0;
while (uncertain == TRUE && length < GT_MAX_READ) {
g_free(content_type);
content_type = NULL;
@ -216,21 +133,21 @@ guess_type_glib(const char* path)
return NULL;
}
static int compare_content_types(const void* lhs, const void* rhs) {
static int
compare_content_types(const void* lhs, const void* rhs)
{
return g_strcmp0(lhs, rhs);
}
char*
zathura_content_type_guess(zathura_content_type_context_t* context,
const char* path,
zathura_content_type_guess(zathura_content_type_context_t* context, const char* path,
const girara_list_t* supported_content_types)
{
/* try libmagic first */
char *content_type = guess_type_magic(context, path);
char* content_type = guess_type_magic(context, path);
if (content_type != NULL) {
if (supported_content_types == NULL ||
girara_list_find(supported_content_types, compare_content_types,
content_type) != NULL) {
girara_list_find(supported_content_types, compare_content_types, content_type) != NULL) {
return content_type;
}
girara_debug("content type '%s' not supported, trying again", content_type);
@ -240,13 +157,11 @@ zathura_content_type_guess(zathura_content_type_context_t* context,
content_type = guess_type_glib(path);
if (content_type != NULL) {
if (supported_content_types == NULL ||
girara_list_find(supported_content_types, compare_content_types,
content_type) != NULL) {
girara_list_find(supported_content_types, compare_content_types, content_type) != NULL) {
return content_type;
}
girara_debug("content type '%s' not supported, trying again", content_type);
girara_debug("content type '%s' not supported", content_type);
g_free(content_type);
}
/* and if libmagic is not available, try file as last resort */
return guess_type_file(path);
return NULL;
}

View file

@ -3,7 +3,9 @@
#ifndef ZATHURA_CONTENT_TYPE_H
#define ZATHURA_CONTENT_TYPE_H
#include "types.h"
#include <girara/datastructures.h>
typedef struct zathura_content_type_context_s zathura_content_type_context_t;
/**
* Create new context for content type detection.
@ -26,8 +28,7 @@ void zathura_content_type_free(zathura_content_type_context_t* context);
* @param path file name
* @return content type of path, needs to freeed with g_free.
*/
char* zathura_content_type_guess(zathura_content_type_context_t* context,
const char* path,
char* zathura_content_type_guess(zathura_content_type_context_t* context, const char* path,
const girara_list_t* supported_content_types);
#endif

View file

@ -168,7 +168,7 @@ zathura_db_read_key_file_from_file(const char* path)
g_key_file_free(key_file);
return NULL;
}
g_strlcat(content, dummy_content, dummy_len + 1);
strcpy(content, dummy_content);
contentlen = dummy_len;
}

View file

@ -265,8 +265,11 @@ sqlite_db_check_layout(sqlite3* session, const int database_version, const bool
return;
}
}
if (new_db == true)
if (new_db == true) {
/* set version if initializing a new database */
sqlite3_exec(session, "PRAGMA user_version = " G_STRINGIFY(DATABASE_VERSION) ";", NULL, 0, NULL);
return;
}
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
if (sqlite3_compileoption_used("SQLITE_OMIT_ALTERTABLE") == 1) {

View file

@ -260,6 +260,40 @@ handle_goto_page(zathura_t* zathura, GVariant* parameters,
g_dbus_method_invocation_return_value(invocation, result);
}
typedef struct {
zathura_t* zathura;
girara_list_t** rectangles;
unsigned int page;
unsigned int number_of_pages;
} highlights_rect_data_t;
static gboolean
synctex_highlight_rects_impl(gpointer ptr)
{
highlights_rect_data_t* data = ptr;
synctex_highlight_rects(data->zathura, data->page, data->rectangles);
for (unsigned int i = 0; i != data->number_of_pages; ++i) {
girara_list_free(data->rectangles[i]);
}
g_free(data->rectangles);
return false;
}
static void
synctex_highlight_rects_idle(zathura_t* zathura, girara_list_t** rectangles,
unsigned int page, unsigned number_of_pages)
{
highlights_rect_data_t* data = g_try_malloc0(sizeof(highlights_rect_data_t));
data->zathura = zathura;
data->rectangles = rectangles;
data->page = page;
data->number_of_pages = number_of_pages;
gdk_threads_add_idle(synctex_highlight_rects_impl, data);
}
static void
handle_highlight_rects(zathura_t* zathura, GVariant* parameters,
GDBusMethodInvocation* invocation)
@ -357,26 +391,55 @@ handle_highlight_rects(zathura_t* zathura, GVariant* parameters,
}
g_variant_iter_free(secondary_iter);
synctex_highlight_rects(zathura, page, rectangles);
g_free(rectangles);
/* run synctex_highlight_rects in main thread when idle */
synctex_highlight_rects_idle(zathura, rectangles, page, number_of_pages);
GVariant* result = g_variant_new("(b)", true);
g_dbus_method_invocation_return_value(invocation, result);
}
typedef struct {
zathura_t* zathura;
gchar* input_file;
unsigned int line;
unsigned int column;
} view_data_t;
static gboolean
synctex_view_impl(gpointer ptr)
{
view_data_t* data = ptr;
synctex_view(data->zathura, data->input_file, data->line, data->column);
g_free(data->input_file);
g_free(data);
return false;
}
static void
handle_synctex_view(zathura_t* zathura, GVariant* parameters,
GDBusMethodInvocation* invocation)
synctex_view_idle(zathura_t* zathura, gchar* input_file, unsigned int line, unsigned int column)
{
view_data_t* data = g_try_malloc0(sizeof(view_data_t));
data->zathura = zathura;
data->input_file = input_file;
data->line = line;
data->column = column;
gdk_threads_add_idle(synctex_view_impl, data);
}
static void
handle_synctex_view(zathura_t* zathura, GVariant* parameters, GDBusMethodInvocation* invocation)
{
gchar* input_file = NULL;
guint line = 0;
guint column = 0;
guint line = 0;
guint column = 0;
g_variant_get(parameters, "(suu)", &input_file, &line, &column);
const bool ret = synctex_view(zathura, input_file, line, column);
g_free(input_file);
synctex_view_idle(zathura, input_file, line, column);
GVariant* result = g_variant_new("(b)", ret);
GVariant* result = g_variant_new("(b)", true);
g_dbus_method_invocation_return_value(invocation, result);
}
@ -586,11 +649,10 @@ iterate_instances_call_synctex_view(const char* filename,
}
int
zathura_dbus_synctex_position(const char* filename, const char* input_file,
int line, int column, pid_t hint)
zathura_dbus_synctex_position(const char* filename, const char* input_file, int line, int column, pid_t hint)
{
if (filename == NULL || input_file == NULL || line < 0 || column < 0) {
return false;
return -1;
}
return iterate_instances_call_synctex_view(filename, input_file, line, column, hint);

View file

@ -10,7 +10,7 @@
#include <girara/utils.h>
typedef struct private_s {
typedef struct {
char* file_path;
} ZathuraFileMonitorPrivate;
@ -21,21 +21,14 @@ enum {
PROP_FILE_PATH
};
enum {
RELOAD_FILE,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static void
finalize(GObject* object)
{
ZathuraFileMonitor* file_monitor = ZATHURA_FILEMONITOR(object);
ZathuraFileMonitorPrivate* private = zathura_filemonitor_get_instance_private(file_monitor);
ZathuraFileMonitor* file_monitor = ZATHURA_FILEMONITOR(object);
ZathuraFileMonitorPrivate* priv = zathura_filemonitor_get_instance_private(file_monitor);
if (private->file_path != NULL) {
g_free(private->file_path);
if (priv->file_path != NULL) {
g_free(priv->file_path);
}
G_OBJECT_CLASS(zathura_filemonitor_parent_class)->finalize(object);
@ -44,15 +37,15 @@ finalize(GObject* object)
static void
set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
{
ZathuraFileMonitor* file_monitor = ZATHURA_FILEMONITOR(object);
ZathuraFileMonitorPrivate* private = zathura_filemonitor_get_instance_private(file_monitor);
ZathuraFileMonitor* file_monitor = ZATHURA_FILEMONITOR(object);
ZathuraFileMonitorPrivate* priv = zathura_filemonitor_get_instance_private(file_monitor);
switch (prop_id) {
case PROP_FILE_PATH:
if (private->file_path != NULL) {
g_free(private->file_path);
if (priv->file_path != NULL) {
g_free(priv->file_path);
}
private->file_path = g_value_dup_string(value);
priv->file_path = g_value_dup_string(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@ -62,12 +55,12 @@ set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* ps
static void
get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
{
ZathuraFileMonitor* file_monitor = ZATHURA_FILEMONITOR(object);
ZathuraFileMonitorPrivate* private = zathura_filemonitor_get_instance_private(file_monitor);
ZathuraFileMonitor* file_monitor = ZATHURA_FILEMONITOR(object);
ZathuraFileMonitorPrivate* priv = zathura_filemonitor_get_instance_private(file_monitor);
switch (prop_id) {
case PROP_FILE_PATH:
g_value_set_string(value, private->file_path);
g_value_set_string(value, priv->file_path);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@ -94,22 +87,21 @@ zathura_filemonitor_class_init(ZathuraFileMonitorClass* class)
G_PARAM_STATIC_STRINGS));
/* add signals */
signals[RELOAD_FILE] =
g_signal_new("reload-file", ZATHURA_TYPE_FILEMONITOR, G_SIGNAL_RUN_LAST, 0,
NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0);
g_signal_new("reload-file", ZATHURA_TYPE_FILEMONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
static void
zathura_filemonitor_init(ZathuraFileMonitor* file_monitor)
{
ZathuraFileMonitorPrivate* private = zathura_filemonitor_get_instance_private(file_monitor);
private->file_path = NULL;
ZathuraFileMonitorPrivate* priv = zathura_filemonitor_get_instance_private(file_monitor);
priv->file_path = NULL;
}
const char* zathura_filemonitor_get_filepath(ZathuraFileMonitor* file_monitor)
{
ZathuraFileMonitorPrivate* private = zathura_filemonitor_get_instance_private(file_monitor);
return private->file_path;
ZathuraFileMonitorPrivate* priv = zathura_filemonitor_get_instance_private(file_monitor);
return priv->file_path;
}
void zathura_filemonitor_start(ZathuraFileMonitor* file_monitor)

View file

@ -195,15 +195,16 @@ load_dir(void* data, void* userdata)
}
}
void
bool
zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager)
{
if (plugin_manager == NULL || plugin_manager->path == NULL) {
return;
return false;
}
/* read all files in the plugin directory */
girara_list_foreach(plugin_manager->path, load_dir, plugin_manager);
return girara_list_size(plugin_manager->plugins) > 0;
}
zathura_plugin_t*

View file

@ -37,8 +37,9 @@ void zathura_plugin_manager_add_dir(zathura_plugin_manager_t* plugin_manager, co
* Loads all plugins available in the previously given directories
*
* @param plugin_manager The plugin manager
* @return Success if some plugins have been loaded, false otherwise
*/
void zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager);
bool zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager);
/**
* Returns the (if available) associated plugin

View file

@ -11,6 +11,12 @@
#include <stdlib.h>
#include <errno.h>
#include <girara/utils.h>
#include <linux/sched.h> /* for clone filter */
#ifdef GDK_WINDOWING_X11
#include <gtk/gtkx.h>
#endif
#define ADD_RULE(str_action, action, call, ...) \
do { \
@ -100,8 +106,15 @@ seccomp_enable_basic_filter(void)
DENY_RULE(uselib);
DENY_RULE(vmsplice);
/* TODO: check for additional syscalls to blacklist */
/* DENY_RULE (execve); */
/*
*
* In case this basic filter is actually triggered, print a clear error message to report this
* The syscalls here should never be executed by an unprivileged process
*
* */
girara_debug("Using a basic seccomp filter to blacklist privileged system calls! \
Errors reporting 'bad system call' may be an indicator of compromise");
/* applying filter... */
if (seccomp_load(ctx) >= 0) {
@ -117,7 +130,7 @@ out:
}
int
seccomp_enable_strict_filter(void)
seccomp_enable_strict_filter(zathura_t* zathura)
{
/* prevent child processes from getting more priv e.g. via setuid, capabilities, ... */
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
@ -132,20 +145,21 @@ seccomp_enable_strict_filter(void)
}
/* initialize the filter */
scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_KILL);
/* ENOSYS tells the calling process that the syscall is not implemented,
* allowing for a potential fallback function to execute
* scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_ERRNO(ENOSYS));*/
scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_KILL_PROCESS);
if (ctx == NULL){
girara_error("seccomp_init failed");
return -1;
}
ALLOW_RULE(access);
/* ALLOW_RULE (arch_prctl); */
ALLOW_RULE(bind);
ALLOW_RULE(brk);
ALLOW_RULE(clock_getres);
ALLOW_RULE(clone); /* TODO: investigate */
/* ALLOW_RULE(clone); specified below */
ALLOW_RULE(close);
/* ALLOW_RULE (connect); */
ALLOW_RULE(eventfd2);
ALLOW_RULE(exit);
ALLOW_RULE(exit_group);
@ -167,23 +181,19 @@ seccomp_enable_strict_filter(void)
ALLOW_RULE(getpid);
ALLOW_RULE(getppid);
ALLOW_RULE(gettid);
/* ALLOW_RULE (getpeername); */
ALLOW_RULE(getrandom);
ALLOW_RULE(getresgid);
ALLOW_RULE(getresuid);
ALLOW_RULE(getrlimit);
ALLOW_RULE(getpeername);
/* ALLOW_RULE (getsockname); */
/* ALLOW_RULE (getsockopt); needed for access to x11 socket in network namespace (without abstract sockets) */
ALLOW_RULE(inotify_add_watch);
ALLOW_RULE(inotify_init1);
ALLOW_RULE(inotify_rm_watch);
/* ALLOW_RULE (ioctl); specified below */
/* ALLOW_RULE (ioctl); specified below */
ALLOW_RULE(lseek);
ALLOW_RULE(lstat);
ALLOW_RULE(madvise);
ALLOW_RULE(memfd_create);
ALLOW_RULE(mkdir); /* needed for first run only */
ALLOW_RULE(mmap);
ALLOW_RULE(mprotect);
ALLOW_RULE(mremap);
@ -194,23 +204,23 @@ seccomp_enable_strict_filter(void)
ALLOW_RULE(pipe);
ALLOW_RULE(pipe2);
ALLOW_RULE(poll);
ALLOW_RULE(pwrite64); /* TODO: build detailed filter */
ALLOW_RULE(pwrite64);
ALLOW_RULE(pread64);
/* ALLOW_RULE (prlimit64); */
/* ALLOW_RULE (prctl); specified below */
ALLOW_RULE(read);
ALLOW_RULE(readlink);
ALLOW_RULE(recvfrom);
ALLOW_RULE(recvmsg);
ALLOW_RULE(restart_syscall);
ALLOW_RULE(rseq);
ALLOW_RULE(rt_sigaction);
ALLOW_RULE(rt_sigprocmask);
ALLOW_RULE(sched_setattr);
ALLOW_RULE(sched_getattr);
ALLOW_RULE(sendmsg);
ALLOW_RULE(sendto);
ALLOW_RULE(select);
ALLOW_RULE(set_robust_list);
/* ALLOW_RULE (set_tid_address); */
/* ALLOW_RULE (setsockopt); */
ALLOW_RULE(shmat);
ALLOW_RULE(shmctl);
ALLOW_RULE(shmdt);
@ -219,30 +229,66 @@ seccomp_enable_strict_filter(void)
ALLOW_RULE(stat);
ALLOW_RULE(statx);
ALLOW_RULE(statfs);
/* ALLOW_RULE (socket); */
ALLOW_RULE(sysinfo);
/* ALLOW_RULE(umask); allowed for X11 only below */
ALLOW_RULE(uname);
ALLOW_RULE(unlink);
ALLOW_RULE(write); /* specified below (zathura needs to write files)*/
ALLOW_RULE(write);
ALLOW_RULE(writev);
ALLOW_RULE(wait4); /* trying to open links should not crash the app */
/* ADD_RULE("errno", SCMP_ACT_ERRNO(EPERM), sched_setattr, 0); */
/* ADD_RULE("errno", SCMP_ACT_ERRNO(EPERM), sched_getattr, 0); */
/* required by glib */
ALLOW_RULE(sched_setattr);
ALLOW_RULE(sched_getattr);
/* required by some X11 setups */
ADD_RULE("errno", SCMP_ACT_ERRNO(EPERM), umask, 0);
ADD_RULE("errno", SCMP_ACT_ERRNO(EPERM), socket, 0);
ALLOW_RULE(wait4);
/* required for testing only */
ALLOW_RULE(timer_create);
ALLOW_RULE(timer_delete);
/* Permit X11 specific syscalls */
#ifdef GDK_WINDOWING_X11
GdkDisplay* display = gtk_widget_get_display(zathura->ui.session->gtk.view);
if (GDK_IS_X11_DISPLAY (display)) {
girara_debug("On X11, supporting X11 syscalls");
/* permit the socket syscall for local UNIX domain sockets (required by X11) */
ADD_RULE("allow", SCMP_ACT_ALLOW, socket, 1, SCMP_CMP(0, SCMP_CMP_EQ, AF_UNIX));
ALLOW_RULE(mkdir);
ALLOW_RULE(setsockopt);
ALLOW_RULE(connect);
ALLOW_RULE(umask);
}
else {
girara_debug("On Wayland, blocking X11 syscalls");
}
#endif
/* filter clone arguments */
ADD_RULE("allow", SCMP_ACT_ALLOW, clone, 1, SCMP_CMP(0, SCMP_CMP_EQ, \
CLONE_VM | \
CLONE_FS | \
CLONE_FILES | \
CLONE_SIGHAND | \
CLONE_THREAD | \
CLONE_SYSVSEM | \
CLONE_SETTLS | \
CLONE_PARENT_SETTID | \
CLONE_CHILD_CLEARTID));
/* fcntl filter - not yet working */
/*ADD_RULE("allow", SCMP_ACT_ALLOW, fcntl, 1, SCMP_CMP(0, SCMP_CMP_EQ, \
F_GETFL | \
F_SETFL | \
F_ADD_SEALS | \
F_SEAL_SEAL | \
F_SEAL_SHRINK | \
F_DUPFD_CLOEXEC | \
F_SETFD | \
FD_CLOEXEC )); */
/* Special requirements for ioctl, allowed on stdout/stderr */
ADD_RULE("allow", SCMP_ACT_ALLOW, ioctl, 1, SCMP_CMP(0, SCMP_CMP_EQ, 1));
ADD_RULE("allow", SCMP_ACT_ALLOW, ioctl, 1, SCMP_CMP(0, SCMP_CMP_EQ, 2));
@ -252,53 +298,33 @@ seccomp_enable_strict_filter(void)
ADD_RULE("allow", SCMP_ACT_ALLOW, prctl, 1, SCMP_CMP(0, SCMP_CMP_EQ, PR_SET_PDEATHSIG));
/* special restrictions for open, prevent opening files for writing */
ADD_RULE("allow", SCMP_ACT_ALLOW, open, 1, SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0));
ADD_RULE("allow", SCMP_ACT_ALLOW, open, 1, SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0));
ADD_RULE("errno", SCMP_ACT_ERRNO(EACCES), open, 1, SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY, O_WRONLY));
ADD_RULE("errno", SCMP_ACT_ERRNO(EACCES), open, 1, SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_RDWR, O_RDWR));
/* special restrictions for openat, prevent opening files for writing */
ADD_RULE("allow", SCMP_ACT_ALLOW, openat, 1, SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0));
ADD_RULE("allow", SCMP_ACT_ALLOW, openat, 1, SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0));
ADD_RULE("errno", SCMP_ACT_ERRNO(EACCES), openat, 1, SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_WRONLY, O_WRONLY));
ADD_RULE("errno", SCMP_ACT_ERRNO(EACCES), openat, 1, SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_RDWR, O_RDWR));
/* allowed for debugging: */
/* ALLOW_RULE (prctl); */
/* ALLOW_RULE (ioctl); */
/* TODO: test fcntl rules */
/* if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(fcntl), 1, */
/* SCMP_CMP(0, SCMP_CMP_EQ, F_GETFL)) < 0) */
/* goto out; */
/* if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(fcntl), 1, */
/* SCMP_CMP(0, SCMP_CMP_EQ, F_SETFL)) < 0) */
/* goto out; */
/* if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(fcntl), 1, */
/* SCMP_CMP(0, SCMP_CMP_EQ, F_SETFD)) < 0) */
/* goto out; */
/* if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(fcntl), 1, */
/* SCMP_CMP(0, SCMP_CMP_EQ, F_GETFD)) < 0) */
/* goto out; */
/* if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(fcntl), 1, */
/* SCMP_CMP(0, SCMP_CMP_EQ, F_SETLK)) < 0) */
/* goto out; */
/* TODO: build detailed filter for prctl */
/* needed by gtk??? (does not load content without) */
/* /\* special restrictions for prctl, only allow PR_SET_NAME/PR_SET_PDEATHSIG *\/ */
/* if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(prctl), 1, */
/* SCMP_CMP(0, SCMP_CMP_EQ, PR_SET_NAME)) < 0) */
/* goto out; */
/* Sandbox Status Notes:
*
* write: no actual files on the filesystem are opened with write permissions
* exception is /run/user/UID/dconf/user (file descriptor not available during runtime)
*
*
* mkdir: needed for first run only to create /run/user/UID/dconf (before seccomp init)
* wait4: required to attempt opening links (which is then blocked)
*
*
* TODO: prevent dbus socket connection before sandbox init - by checking the sandbox settings in zathurarc
*
* TODO: check requirement of pipe/pipe2 syscalls when dbus is disabled
*/
/* if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(prctl), 1, */
/* SCMP_CMP(0, SCMP_CMP_EQ, PR_SET_PDEATHSIG)) < 0) */
/* goto out; */
/* when zathura is run on wayland, with X11 server available but blocked, unset the DISPLAY variable */
/* otherwise it will try to connect to X11 using inet socket protocol */

View file

@ -3,6 +3,8 @@
#ifndef ZATHURA_SECCOMP_FILTERS_H
#define ZATHURA_SECCOMP_FILTERS_H
#include "zathura.h"
/* basic filter */
/* this mode allows normal use */
/* only dangerous syscalls are blacklisted */
@ -10,6 +12,6 @@ int seccomp_enable_basic_filter(void);
/* strict filter before document parsing */
/* this filter is to be enabled after most of the initialisation of zathura has finished */
int seccomp_enable_strict_filter(void);
int seccomp_enable_strict_filter(zathura_t* zathura);
#endif

View file

@ -45,13 +45,11 @@ zathura_image_buffer_create(unsigned int width, unsigned int height)
g_return_val_if_fail(height != 0, NULL);
unsigned int size = 0;
if (checked_umul(width, height, &size) == true ||
checked_umul(size, 3, &size) == true) {
if (checked_umul(width, height, &size) == true || checked_umul(size, 3, &size) == true) {
return NULL;
}
zathura_image_buffer_t* image_buffer = malloc(sizeof(zathura_image_buffer_t));
if (image_buffer == NULL) {
return NULL;
}
@ -81,25 +79,27 @@ zathura_image_buffer_free(zathura_image_buffer_t* image_buffer)
free(image_buffer);
}
static void
document_information_entry_free(void* data)
{
zathura_document_information_entry_t* entry = data;
zathura_document_information_entry_free(entry);
}
girara_list_t*
zathura_document_information_entry_list_new(void)
{
girara_list_t* list = girara_list_new2((girara_free_function_t)
zathura_document_information_entry_free);
return list;
return girara_list_new2(document_information_entry_free);
}
zathura_document_information_entry_t*
zathura_document_information_entry_new(zathura_document_information_type_t type,
const char* value)
zathura_document_information_entry_new(zathura_document_information_type_t type, const char* value)
{
if (value == NULL) {
return NULL;
}
zathura_document_information_entry_t* entry =
g_try_malloc0(sizeof(zathura_document_information_entry_t));
zathura_document_information_entry_t* entry = g_try_malloc0(sizeof(zathura_document_information_entry_t));
if (entry == NULL) {
return NULL;
}
@ -117,9 +117,6 @@ zathura_document_information_entry_free(zathura_document_information_entry_t* en
return;
}
if (entry->value != NULL) {
g_free(entry->value);
}
g_free(entry->value);
g_free(entry);
}

View file

@ -173,10 +173,12 @@ zathura_update_view_ppi(zathura_t* zathura)
GdkRectangle monitor_geom;
gdk_monitor_get_geometry(monitor, &monitor_geom);
/* calculate ppi, knowing that 1 inch = 25.4 mm */
if (width_mm == 0) {
/* Due to a bug in Gtk, width is sometimes incorrectly reported to be 1mm
* see https://gitlab.gnome.org/GNOME/gtk/issues/3115 for details */
if (width_mm <= 1) {
girara_debug("cannot calculate PPI: monitor has zero width");
} else {
/* calculate ppi, knowing that 1 inch = 25.4 mm */
ppi = monitor_geom.width * 25.4 / width_mm;
}
@ -430,7 +432,9 @@ zathura_init(zathura_t* zathura)
g_set_prgname("org.pwmt.zathura");
/* load plugins */
zathura_plugin_manager_load(zathura->plugins.manager);
if (zathura_plugin_manager_load(zathura->plugins.manager) == false) {
girara_error("Found no plugins. Please install at least one plugin.");
}
/* configuration */
config_load_default(zathura);
@ -451,7 +455,7 @@ zathura_init(zathura_t* zathura)
break;
case ZATHURA_SANDBOX_STRICT:
girara_debug("Strict sandbox preventing write and network access.");
if (seccomp_enable_strict_filter() != 0) {
if (seccomp_enable_strict_filter(zathura) != 0) {
girara_error("Failed to initialize strict seccomp filter.");
goto error_free;
}

View file

@ -90,6 +90,8 @@ typedef enum {
/* forward declaration for types from database.h */
typedef struct _ZathuraDatabase zathura_database_t;
/* forward declaration for types from content-type.h */
typedef struct zathura_content_type_context_s zathura_content_type_context_t;
struct zathura_s
{