Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package zathura-plugin-pdf-poppler for 
openSUSE:Factory checked in at 2024-01-03 14:53:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/zathura-plugin-pdf-poppler (Old)
 and      /work/SRC/openSUSE:Factory/.zathura-plugin-pdf-poppler.new.28375 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "zathura-plugin-pdf-poppler"

Wed Jan  3 14:53:07 2024 rev:10 rq:1135888 version:0.3.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/zathura-plugin-pdf-poppler/zathura-plugin-pdf-poppler.changes
    2022-12-15 19:26:07.188368528 +0100
+++ 
/work/SRC/openSUSE:Factory/.zathura-plugin-pdf-poppler.new.28375/zathura-plugin-pdf-poppler.changes
 2024-01-03 14:53:09.916042284 +0100
@@ -1,0 +2,7 @@
+Sun Dec 31 12:43:37 UTC 2023 - Joshua Smith <jsmith...@gmail.com>
+
+- Update to 0.3.2:
+  * Implement support for document signature
+  * Fix double encoding in document index
+
+-------------------------------------------------------------------

Old:
----
  zathura-pdf-poppler-0.3.1.tar.xz

New:
----
  zathura-pdf-poppler-0.3.2.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ zathura-plugin-pdf-poppler.spec ++++++
--- /var/tmp/diff_new_pack.4KiRO7/_old  2024-01-03 14:53:11.308093092 +0100
+++ /var/tmp/diff_new_pack.4KiRO7/_new  2024-01-03 14:53:11.312093238 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package zathura-plugin-pdf-poppler
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %define realname zathura-pdf-poppler
 Name:           zathura-plugin-pdf-poppler
-Version:        0.3.1
+Version:        0.3.2
 Release:        0
 Summary:        PDF support for zathura via poppler
 License:        Zlib

++++++ zathura-pdf-poppler-0.3.1.tar.xz -> zathura-pdf-poppler-0.3.2.tar.xz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zathura-pdf-poppler-0.3.1/.clang-format 
new/zathura-pdf-poppler-0.3.2/.clang-format
--- old/zathura-pdf-poppler-0.3.1/.clang-format 1970-01-01 01:00:00.000000000 
+0100
+++ new/zathura-pdf-poppler-0.3.2/.clang-format 2023-12-08 18:42:12.000000000 
+0100
@@ -0,0 +1,15 @@
+---
+Language: Cpp
+BasedOnStyle: LLVM
+AlignConsecutiveAssignments: true
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: false
+AlwaysBreakTemplateDeclarations: true
+BreakBeforeBraces: Attach
+ConstructorInitializerIndentWidth: 2
+NamespaceIndentation: All
+PointerAlignment: Left
+TabWidth: 2
+ColumnLimit: 120
+SortIncludes: false
+...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zathura-pdf-poppler-0.3.1/.gitlab-ci.yml 
new/zathura-pdf-poppler-0.3.2/.gitlab-ci.yml
--- old/zathura-pdf-poppler-0.3.1/.gitlab-ci.yml        2022-11-27 
16:49:24.000000000 +0100
+++ new/zathura-pdf-poppler-0.3.2/.gitlab-ci.yml        2023-12-08 
18:42:12.000000000 +0100
@@ -28,25 +28,6 @@
   except:
     - tags
 
-# Debian 11 (bullseye)
-build:debian-bullseye:
-  tags:
-    - pwmt
-  stage: build
-  image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bullseye
-  script:
-    - mkdir -p build && cd build
-    - meson ..
-    - ninja
-  cache:
-    <<: *dependency_cache
-  artifacts:
-    expire_in: 1 day
-    paths:
-      - build
-  except:
-    - tags
-
 # Debian 12 (bookworm)
 build:debian-bookworm:
   tags:
@@ -66,13 +47,12 @@
   except:
     - tags
 
-
-# Ubuntu 20.04 LTS (focal)
-build:ubuntu-focal:
+# Debian 13 (trixie)
+build:debian-trixie:
   tags:
     - pwmt
   stage: build
-  image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:focal
+  image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:trixie
   script:
     - mkdir -p build && cd build
     - meson ..
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zathura-pdf-poppler-0.3.1/README.md 
new/zathura-pdf-poppler-0.3.2/README.md
--- old/zathura-pdf-poppler-0.3.1/README.md     2022-11-27 16:49:24.000000000 
+0100
+++ new/zathura-pdf-poppler-0.3.2/README.md     2023-12-08 18:42:12.000000000 
+0100
@@ -10,9 +10,9 @@
 
 The following dependencies are required:
 
-* `zathura` (>= 0.4.4)
+* `zathura` (>= 0.5.3)
 * `girara`
-* `poppler-glib` (>= 0.18)
+* `poppler-glib` (>= 21.12)
 
 Installation
 ------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zathura-pdf-poppler-0.3.1/meson.build 
new/zathura-pdf-poppler-0.3.2/meson.build
--- old/zathura-pdf-poppler-0.3.1/meson.build   2022-11-27 16:49:24.000000000 
+0100
+++ new/zathura-pdf-poppler-0.3.2/meson.build   2023-12-08 18:42:12.000000000 
+0100
@@ -1,7 +1,7 @@
 project('zathura-pdf-poppler', 'c',
-  version: '0.3.1',
-  meson_version: '>=0.56',
-  default_options: 'c_std=c11'
+  version: '0.3.2',
+  meson_version: '>=0.61',
+  default_options: ['c_std=c17', 'warning_level=3']
 )
 
 version = meson.project_version()
@@ -15,10 +15,10 @@
 desktopdir = join_paths(datadir, 'applications')
 
 # required dependencies
-zathura = dependency('zathura', version: '>=0.5.2', fallback: ['zathura', 
'zathura_dependency'])
+zathura = dependency('zathura', version: '>=0.5.3', fallback: ['zathura', 
'zathura_dependency'])
 girara = dependency('girara-gtk3', fallback: ['girara', 'girara_dependency'])
 glib = dependency('glib-2.0')
-poppler = dependency('poppler-glib', version: '>=0.18')
+poppler = dependency('poppler-glib', version: '>=21.12')
 
 build_dependencies = [zathura, girara, glib, poppler]
 
@@ -43,12 +43,8 @@
 
 # compile flags
 flags = [
-  '-Wall',
-  '-Wextra',
-  '-pedantic',
   '-Werror=implicit-function-declaration',
   '-Werror=vla',
-  '-fvisibility=hidden'
 ]
 flags = cc.get_supported_arguments(flags)
 
@@ -65,6 +61,7 @@
   'zathura-pdf-poppler/render.c',
   'zathura-pdf-poppler/search.c',
   'zathura-pdf-poppler/select.c',
+  'zathura-pdf-poppler/signature.c',
   'zathura-pdf-poppler/utils.c'
 )
 
@@ -73,7 +70,8 @@
   dependencies: build_dependencies,
   c_args: defines + flags,
   install: true,
-  install_dir: plugindir
+  install_dir: plugindir,
+  gnu_symbol_visibility: 'hidden'
 )
 
 subdir('data')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/index.c 
new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/index.c
--- old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/index.c   2022-11-27 
16:49:24.000000000 +0100
+++ new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/index.c   2023-12-08 
18:42:12.000000000 +0100
@@ -48,19 +48,16 @@
       continue;
     }
 
-    gchar* markup = g_markup_escape_text(action->any.title, -1);
-    zathura_index_element_t* index_element = zathura_index_element_new(markup);
-
-    g_free(markup);
-
+    zathura_index_element_t* index_element = 
zathura_index_element_new(action->any.title);
     if (index_element == NULL) {
       poppler_action_free(action);
       continue;
     }
 
-    zathura_rectangle_t rect = { 0, 0, 0, 0 };
-    index_element->link = poppler_link_to_zathura_link(poppler_document, 
action, rect);
+    zathura_rectangle_t rect = {0, 0, 0, 0};
+    index_element->link      = poppler_link_to_zathura_link(poppler_document, 
action, rect);
     if (index_element->link == NULL) {
+      zathura_index_element_free(index_element);
       poppler_action_free(action);
       continue;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/plugin.c 
new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/plugin.c
--- old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/plugin.c  2022-11-27 
16:49:24.000000000 +0100
+++ new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/plugin.c  2023-12-08 
18:42:12.000000000 +0100
@@ -23,7 +23,8 @@
     .page_get_selection       = pdf_page_get_selection,
     .page_render_cairo        = pdf_page_render_cairo,
     .page_image_get_cairo     = pdf_page_image_get_cairo,
-    .page_get_label           = pdf_page_get_label
+    .page_get_label           = pdf_page_get_label,
+    .page_get_signatures      = pdf_page_get_signatures
   }),
   ZATHURA_PLUGIN_MIMETYPES({
     "application/pdf"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/plugin.h 
new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/plugin.h
--- old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/plugin.h  2022-11-27 
16:49:24.000000000 +0100
+++ new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/plugin.h  2023-12-08 
18:42:12.000000000 +0100
@@ -202,4 +202,12 @@
 GIRARA_HIDDEN zathura_error_t pdf_page_get_label(zathura_page_t* page,
     void* data, char** label);
 
+/**
+ * Get signatures
+ *
+ * @param poppler_document Internal document representation
+ * @param cairo Cairo object
+ */
+GIRARA_HIDDEN girara_list_t* pdf_page_get_signatures(zathura_page_t* page, 
void* data, zathura_error_t* error);
+
 #endif // PDF_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/signature.c 
new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/signature.c
--- old/zathura-pdf-poppler-0.3.1/zathura-pdf-poppler/signature.c       
1970-01-01 01:00:00.000000000 +0100
+++ new/zathura-pdf-poppler-0.3.2/zathura-pdf-poppler/signature.c       
2023-12-08 18:42:12.000000000 +0100
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier: Zlib */
+
+#include <cairo.h>
+#include <girara/log.h>
+
+#include "plugin.h"
+
+#define SIGNATURE_OVERLAY_OFFSET 3
+#define SIGNATURE_OVERLAY_ADJUST .5
+#define SIGNATURE_OVERLAY_OPACITY .9
+#define CAIRO_LINE_OFFSET_VERTICAL 13
+#define CAIRO_LINE_OFFSET_HORIZONTAL 5
+
+static void print_validation_result(PopplerSignatureInfo* sig_info) {
+  static const char* const cert_status_strings[] = {
+      "trusted",          // POPPLER_CERTIFICATE_TRUSTED
+      "untrusted issuer", // POPPLER_CERTIFICATE_UNTRUSTED_ISSUER
+      "unknown issuer",   // POPPLER_CERTIFICATE_UNKNOWN_ISSUER
+      "revoked",          // POPPLER_CERTIFICATE_REVOKED
+      "expired",          // POPPLER_CERTIFICATE_EXPIRED
+      "generic error",    // POPPLER_CERTIFICATE_GENERIC_ERROR
+      "not verified"      // POPPLER_CERTIFICATE_NOT_VERIFIED
+  };
+
+  static const char* const sig_status_strings[] = {
+      "valid",           // POPPLER_SIGNATURE_VALID
+      "invalid",         // POPPLER_SIGNATURE_INVALID
+      "digest mismatch", // POPPLER_SIGNATURE_DIGEST_MISMATCH
+      "decoding error",  // POPPLER_SIGNATURE_DECODING_ERROR
+      "generic error",   // POPPLER_SIGNATURE_GENERIC_ERROR
+      "not found",       // POPPLER_SIGNATURE_NOT_FOUND
+      "not verified"     // POPPLER_SIGNATURE_NOT_VERIFIED
+  };
+
+  PopplerSignatureStatus sig_status    = 
poppler_signature_info_get_signature_status(sig_info);
+  PopplerCertificateStatus cert_status = 
poppler_signature_info_get_certificate_status(sig_info);
+
+  girara_debug("signature validation result: '%s'\ncertification validation: 
'%s'",
+               sig_status_strings[sig_status], 
cert_status_strings[cert_status]);
+}
+
+static void signature_info_free(void* data) {
+  zathura_signature_info_t* signature_info = data;
+  zathura_signature_info_free(signature_info);
+}
+
+girara_list_t* pdf_page_get_signatures(zathura_page_t* page, void* data, 
zathura_error_t* error) {
+  if (page == NULL || data == NULL) {
+    if (error) {
+      *error = ZATHURA_ERROR_INVALID_ARGUMENTS;
+    }
+    return NULL;
+  }
+
+  girara_list_t* signatures = girara_list_new2(signature_info_free);
+
+  PopplerPage* poppler_page = data;
+  const double page_height  = zathura_page_get_height(page);
+  GList* form_fields        = 
poppler_page_get_form_field_mapping(poppler_page);
+
+  for (GList* entry = form_fields; entry && entry->data; entry = 
g_list_next(entry)) {
+    PopplerFormFieldMapping* mapping = (PopplerFormFieldMapping*)entry->data;
+    PopplerFormField* form_field     = mapping->field;
+    if (poppler_form_field_get_field_type(form_field) != 
POPPLER_FORM_FIELD_SIGNATURE) {
+      continue;
+    }
+
+    zathura_signature_info_t* signature = zathura_signature_info_new();
+    signature->position.x1              = mapping->area.x1;
+    signature->position.x2              = mapping->area.x2;
+    signature->position.y1              = page_height - mapping->area.y2;
+    signature->position.y2              = page_height - mapping->area.y1;
+
+    // get signature info (Poppler appears to have issues with performing 
revocation check, therefore disabled for now)
+    static const int flags = 
POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE |
+                             
POPPLER_SIGNATURE_VALIDATION_FLAG_WITHOUT_OCSP_REVOCATION_CHECK |
+                             
POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH;
+    PopplerSignatureInfo* sig_info = 
poppler_form_field_signature_validate_sync(form_field, flags, NULL, NULL);
+    if (girara_get_log_level() == GIRARA_DEBUG) {
+      print_validation_result(sig_info);
+    }
+
+    switch (poppler_signature_info_get_signature_status(sig_info)) {
+    case POPPLER_SIGNATURE_VALID:
+      switch (poppler_signature_info_get_certificate_status(sig_info)) {
+      case POPPLER_CERTIFICATE_TRUSTED:
+        signature->signer = 
g_strdup(poppler_signature_info_get_signer_name(sig_info));
+        signature->time   = 
g_date_time_ref(poppler_signature_info_get_local_signing_time(sig_info));
+        signature->state  = ZATHURA_SIGNATURE_VALID;
+        break;
+      case POPPLER_CERTIFICATE_UNTRUSTED_ISSUER:
+      case POPPLER_CERTIFICATE_UNKNOWN_ISSUER:
+        signature->state = ZATHURA_SIGNATURE_CERTIFICATE_UNTRUSTED;
+        break;
+      case POPPLER_CERTIFICATE_REVOKED:
+        signature->state = ZATHURA_SIGNATURE_CERTIFICATE_REVOKED;
+        break;
+      case POPPLER_CERTIFICATE_EXPIRED:
+        signature->state = ZATHURA_SIGNATURE_CERTIFICATE_EXPIRED;
+        break;
+      default: // CERTIFICATE NOT VERIFIED or GENERIC ERROR
+        signature->state = ZATHURA_SIGNATURE_CERTIFICATE_INVALID;
+        break;
+      }
+
+      break;
+    case POPPLER_SIGNATURE_GENERIC_ERROR:
+    case POPPLER_SIGNATURE_NOT_FOUND:
+    case POPPLER_SIGNATURE_NOT_VERIFIED:
+      signature->state = ZATHURA_SIGNATURE_ERROR;
+      break;
+    default: // SIGNATURE INVALID or DIGEST MISMATCH or DECODING ERROR
+      signature->state = ZATHURA_SIGNATURE_INVALID;
+      break;
+    }
+
+    poppler_signature_info_free(sig_info);
+    girara_list_append(signatures, signature);
+  }
+
+  poppler_page_free_form_field_mapping(form_fields);
+  return signatures;
+}

Reply via email to