aboutsummary<
aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/ttfautohint-source-date-epoch.patch
blob: e42fdbf6b0ae228a6bd4eeaaba0aee150e602dc3 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Honour an external definition of SOURCE_DATE_EPOCH when updating the embedded
modification date in TTF/TTC files.

--- a/lib/tatime.c
+++ b/lib/tatime.c
@@ -15,6 +15,8 @@
 
 #include <time.h>
 #include <stdint.h>
+#include <errno.h>
+#include <limits.h>
 
 #include "ta.h"
 
@@ -27,12 +29,51 @@ TA_get_current_time(FT_ULong* high,
 {
   /* there have been 24107 days between January 1st, 1904 (the epoch of */
   /* OpenType), and January 1st, 1970 (the epoch of the `time' function) */
-  TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60;
-  TA_ULongLong seconds_to_today = seconds_to_1970 + (TA_ULongLong)time(NULL);
+  const TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60;
+  TA_ULongLong seconds_to_build;
 
+  time_t now;
+  char *source_date_epoch, *endptr;
+  TA_ULongLong epoch;
+  source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+  if (source_date_epoch) {
+    errno = 0;
+    epoch = strtoull(source_date_epoch, &endptr, 10);
+    if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
+	|| (errno != 0 && epoch == 0)) {
+      fprintf(stderr,
+	      "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n",
+	      strerror(errno));
+      exit(EXIT_FAILURE);
+    }
+    if (endptr == source_date_epoch) {
+      fprintf(stderr,
+	      "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n",
+	      endptr);
+      exit(EXIT_FAILURE);
+    }
+    if (*endptr != '\0') {
+      fprintf(stderr,
+	      "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n",
+	      endptr);
+      exit(EXIT_FAILURE);
+    }
+    if (epoch > ULONG_MAX) {
+      fprintf(stderr,
+	      "Environment variable $SOURCE_DATE_EPOCH: value must be smaller "
+	      "than or equal to: %lu but was found to be: %llu \n",
+	      ULONG_MAX, epoch);
+      exit(EXIT_FAILURE);
+    }
+    now = epoch;
+  } else {
+    now = time(NULL);
+  }
 
-  *high = (FT_ULong)(seconds_to_today >> 32);
-  *low = (FT_ULong)seconds_to_today;
+  seconds_to_build = seconds_to_1970 + (TA_ULongLong)now;
+
+  *high = (FT_ULong)(seconds_to_build >> 32);
+  *low = (FT_ULong)seconds_to_build;
 }
 
 /* end of tatime.c */
True</property> @@ -942,7 +990,7 @@ Do you trust the new certificate?</property> </packing> </child> <child> - <object class="GtkLabel" id="certificate_changed_issuer"> + <object class="GtkLabel" id="certificate_changed_new_issuer"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -972,21 +1020,33 @@ Do you trust the new certificate?</property> </packing> </child> <child> - <object class="GtkLabel" id="certificate_changed_old_fingerprint_label"> + <object class="GtkLabel" id="certificate_changed_old_subject"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="vexpand">True</property> + <property name="hexpand">True</property> <property name="xalign">0</property> - <property name="xpad">12</property> - <property name="label" translatable="yes" comments="Fingerprint of the old certificate.">Old fingerprint:</property> </object> <packing> - <property name="left_attach">0</property> + <property name="left_attach">1</property> <property name="top_attach">3</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> + <child> + <object class="GtkLabel" id="certificate_changed_old_issuer"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> <child> <object class="GtkLabel" id="certificate_changed_old_fingerprint"> <property name="visible">True</property> @@ -997,7 +1057,7 @@ Do you trust the new certificate?</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="top_attach">5</property> <property name="width">1</property> <property name="height">1</property> </packing> diff --git a/plugins/rdp/vinagre-rdp-tab.c b/plugins/rdp/vinagre-rdp-tab.c index 28e3eb6..30a8698 100644 --- a/plugins/rdp/vinagre-rdp-tab.c +++ b/plugins/rdp/vinagre-rdp-tab.c @@ -917,6 +917,7 @@ frdp_certificate_verify (freerdp *instance, widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_fingerprint")); gtk_label_set_text (GTK_LABEL (widget), fingerprint); + /* FIXME: Warn user in case of host_mismatch. */ response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_hide (dialog); @@ -939,7 +940,6 @@ frdp_changed_certificate_verify (freerdp *instance, GtkBuilder *builder; GtkWidget *dialog; GtkWidget *widget; - GtkWidget *label; gint response; builder = vinagre_utils_get_builder (); @@ -950,29 +950,23 @@ frdp_changed_certificate_verify (freerdp *instance, _("Connect"), GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); - widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_subject")); + widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_new_subject")); gtk_label_set_text (GTK_LABEL (widget), subject); - widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_issuer")); + widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_new_issuer")); gtk_label_set_text (GTK_LABEL (widget), issuer); widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_new_fingerprint")); gtk_label_set_text (GTK_LABEL (widget), new_fingerprint); - widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_old_fingerprint")); - label = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_old_fingerprint_label")); - if (old_fingerprint != NULL && old_fingerprint[0] != '\0') - { - gtk_label_set_text (GTK_LABEL (widget), old_fingerprint); - gtk_widget_show (widget); - gtk_widget_show (label); - } - else - { - gtk_widget_hide (widget); - gtk_widget_hide (label); - } + widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_old_subject")); + gtk_label_set_text (GTK_LABEL (widget), old_subject); + widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_old_issuer")); + gtk_label_set_text (GTK_LABEL (widget), old_issuer); + + widget = GTK_WIDGET (gtk_builder_get_object (builder, "certificate_changed_old_fingerprint")); + gtk_label_set_text (GTK_LABEL (widget), old_fingerprint); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_hide (dialog); -- 2.18.1