Merge lp:~noskcaj/ubuntu/trusty/gpgme1.0/1.4.3 into lp:ubuntu/trusty/gpgme1.0

Proposed by Jackson Doak
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~noskcaj/ubuntu/trusty/gpgme1.0/1.4.3
Merge into: lp:ubuntu/trusty/gpgme1.0
Diff against target: 4204 lines (+1933/-793)
43 files modified
ChangeLog (+92/-0)
NEWS (+18/-0)
VERSION (+1/-1)
config.h.in (+5/-1)
configure (+257/-219)
configure.ac (+155/-113)
debian/changelog (+25/-3)
debian/control (+2/-2)
debian/libgpgme11.symbols (+4/-0)
doc/gpgme.info (+112/-111)
doc/gpgme.info-1 (+76/-14)
doc/gpgme.info-2 (+21/-8)
doc/gpgme.texi (+57/-1)
doc/stamp-vti (+4/-4)
doc/uiserver.texi (+20/-18)
doc/version.texi (+4/-4)
gpgme.spec (+1/-1)
lang/cl/gpgme.asd (+1/-1)
src/Makefile.am (+3/-2)
src/Makefile.in (+71/-62)
src/data-identify.c (+247/-0)
src/dirinfo.c (+147/-23)
src/engine-g13.c (+4/-4)
src/engine-gpg.c (+4/-4)
src/engine-gpgconf.c (+3/-3)
src/engine-gpgsm.c (+6/-4)
src/engine-uiserver.c (+2/-2)
src/gpgme-tool.c (+66/-7)
src/gpgme.def (+4/-0)
src/gpgme.h.in (+22/-0)
src/libgpgme.vers (+2/-0)
src/parsetlv.c (+103/-0)
src/parsetlv.h (+48/-0)
src/posix-util.c (+1/-23)
src/signers.c (+8/-0)
src/sys-util.h (+29/-0)
src/util.h (+5/-6)
src/w32-util.c (+179/-118)
tests/gpg/Makefile.am (+35/-14)
tests/gpg/Makefile.in (+36/-20)
tests/gpg/final.test (+4/-0)
tests/gpg/initial.test (+4/-0)
tests/gpg/start-stop-agent (+45/-0)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/trusty/gpgme1.0/1.4.3
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+192293@code.launchpad.net

Description of the change

Merge from debian

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

"This was missing in the previous upload" is confusing for the copy&pasted merge changelog, I dropped this bit. Uploaded, thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-05-29 18:33:42 +0000
3+++ ChangeLog 2013-10-23 07:14:02 +0000
4@@ -1,3 +1,95 @@
5+2013-08-12 Werner Koch <wk@gnupg.org>
6+
7+ Release 1.4.3.
8+ * configure.ac: Change LT version to C22/A11/R0.
9+
10+ Make test suite workable with GnuPG 2.1.
11+ * tests/gpg/start-stop-agent: New.
12+ * tests/gpg/initial.test: New.
13+ * tests/gpg/final.test: New.
14+ * tests/gpg/Makefile.am (c_tests): New.
15+ (TESTS): Move all to c_tests. Add initial.test, final.test, and
16+ c_tests.
17+ (TESTS_ENVIRONMENT): Add C_ALL=C
18+ (private_keys): New.
19+ (EXTRA_DIST): Add new files.
20+ (./private-keys-v1.d/gpg-sample.stamp): Copy private keys.
21+ (all-local): Depend on gpg-sample.stamp.
22+ * tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F: New.
23+ * tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD: New.
24+ * tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66: New.
25+ * tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C: New.
26+ * tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD: New.
27+
28+ Improve detection of default gpg by configure.
29+ * configure.ac: Move test for gpgconf before test for gpg.
30+ (GPG, GPGSM, G13): Use gpgconf instead of AC_PATH_PROG if possible.
31+
32+2013-08-09 Werner Koch <wk@gnupg.org>
33+
34+ Add function gpgme_data_identify.
35+ * src/gpgme.h.in (gpgme_data_type_t): New.
36+ (gpgme_data_identify): New prototype.
37+ * src/data-identify.c: New.
38+ * src/parsetlv.c, src/parsetlv.h: New. Take from gpa.
39+ * src/libgpgme.vers, src/gpgme.def: Add gpgme_data_identify.
40+ * src/gpgme-tool.c (status): Add STATUS_IDENTIFY_RESULT.
41+ (gt_identify): New.
42+ (cmd_identify): New.
43+
44+ (hlp_passwd): Move close to cmd_passwd.
45+
46+2013-08-02 Werner Koch <wk@gnupg.org>
47+
48+ Prefer GnuPG-2 engines over GnuPG-1.
49+ * src/util.h: Move some prototypes to ...
50+ * src/sys-util.h: New.
51+ * src/Makefile.am (main_sources): Add sys-util.h.
52+ * configure.ac (AH_VERBATIM): Add DIRSEP_C and DIRSEP_S.
53+ * src/dirinfo.c: Include sys-util.h.
54+ (WANT_GPG_NAME, WANT_GPGSM_NAME, WANT_G13_NAME)
55+ (WANT_UISRV_SOCKET): New.
56+ (dirinfo): Add corresponding fields.
57+ (parse_output): Add arg COMPONENTS and set new fields.
58+ (read_gpgconf_dirs): Add arg components and act upon it.
59+ (get_gpgconf_item): Call read_gpgconf_dirs two times. Add debug
60+ output.
61+ (_gpgme_get_default_gpg_name): New.
62+ (_gpgme_get_default_gpgsm_name): New.
63+ (_gpgme_get_default_g13_name): New.
64+ (_gpgme_get_default_gpgconf_name): New.
65+ (_gpgme_get_default_uisrv_socket): New.
66+ * src/engine-gpg.c, src/engine-g13.c, src/engine-gpgconf.c
67+ * src/engine-gpgsm.c, src/engine-uiserver.c: Change to use
68+ _gpgme_get_default_ instead of those from sys-util.h.
69+ * src/posix-util.c (_gpgme_get_gpg_path): Include sys-util.h.
70+ (_gpgme_get_uiserver_socket_path): Remove.
71+ * src/w32-util.c (_gpgme_get_gpg_path): Include sys-util.h.
72+ (_gpgme_get_uiserver_socket_path): Remove.
73+
74+ w32: Try to locate gpg in the gpgme installation dir.
75+ * src/w32-util.c (my_hmodule): New.
76+ (wchar_to_utf8): New.
77+ (DllMain): New.
78+ (_gpgme_get_inst_dir): New.
79+ (find_program_in_dir): New.
80+ (find_program_in_inst_dir): Add arg INST_DIR.
81+ (_gpgme_get_gpg_path): Get inst_dir before acquiring the lock.
82+ (_gpgme_get_gpgconf_path): Ditto.
83+ (_gpgme_get_g13_path): Ditto.
84+ (_gpgme_get_w32spawn_path): Ditto.
85+
86+2013-07-31 Werner Koch <wk@gnupg.org>
87+
88+ doc: Add --binary option for the OUTPUT command of an uiserver.
89+
90+2013-06-18 Werner Koch <wk@gnupg.org>
91+
92+ Add function gpgme_signers_count.
93+ * src/signers.c (gpgme_signers_count): New.
94+ * src/libgpgme.vers, src/gpgme.def: Add as external symbol.
95+ * src/gpgme.h.in: Add prototype.
96+
97 2013-05-28 Werner Koch <wk@gnupg.org>
98
99 Release 1.4.2.
100
101=== modified file 'NEWS'
102--- NEWS 2013-05-29 18:33:42 +0000
103+++ NEWS 2013-10-23 07:14:02 +0000
104@@ -1,3 +1,21 @@
105+Noteworthy changes in version 1.4.3 (2013-08-12)
106+------------------------------------------------
107+
108+ * The default engine names are now taken from the output of gpgconf.
109+ If gpgconf is not found the use of gpg 1 is assumed.
110+
111+ * Under Windows the default engines names are first searched in the
112+ installation directory of the gpgme DLL.
113+
114+ * New function gpgme_data_identify to detect the type of a message.
115+
116+ * Interface changes relative to the 1.4.2 release:
117+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118+ gpgme_signers_count NEW.
119+ gpgme_data_type_t NEW.
120+ gpgme_data_identify NEW.
121+
122+
123 Noteworthy changes in version 1.4.2 (2013-05-28)
124 ------------------------------------------------
125
126
127=== modified file 'VERSION'
128--- VERSION 2013-05-29 18:33:42 +0000
129+++ VERSION 2013-10-23 07:14:02 +0000
130@@ -1,1 +1,1 @@
131-1.4.2
132+1.4.3
133
134=== modified file 'config.h.in'
135--- config.h.in 2013-05-14 20:29:20 +0000
136+++ config.h.in 2013-10-23 07:14:02 +0000
137@@ -205,11 +205,15 @@
138 #undef REPLACE_TTYNAME_R
139
140
141-/* Separators as used in $PATH. */
142+/* Separators as used in $PATH and file name. */
143 #ifdef HAVE_DOSISH_SYSTEM
144 #define PATHSEP_C ';'
145+#define DIRSEP_C '\\'
146+#define DIRSEP_S "\\"
147 #else
148 #define PATHSEP_C ':'
149+#define DIRSEP_C '/'
150+#define DIRSEP_S "/"
151 #endif
152
153
154
155=== modified file 'configure'
156--- configure 2013-05-29 18:33:42 +0000
157+++ configure 2013-10-23 07:14:02 +0000
158@@ -1,6 +1,6 @@
159 #! /bin/sh
160 # Guess values for system-dependent variables and create Makefiles.
161-# Generated by GNU Autoconf 2.69 for gpgme 1.4.2.
162+# Generated by GNU Autoconf 2.69 for gpgme 1.4.3.
163 #
164 # Report bugs to <http://bugs.gnupg.org>.
165 #
166@@ -590,8 +590,8 @@
167 # Identity of this package.
168 PACKAGE_NAME='gpgme'
169 PACKAGE_TARNAME='gpgme'
170-PACKAGE_VERSION='1.4.2'
171-PACKAGE_STRING='gpgme 1.4.2'
172+PACKAGE_VERSION='1.4.3'
173+PACKAGE_STRING='gpgme 1.4.3'
174 PACKAGE_BUGREPORT='http://bugs.gnupg.org'
175 PACKAGE_URL=''
176
177@@ -652,11 +652,6 @@
178 HAVE_G13_FALSE
179 HAVE_G13_TRUE
180 G13
181-RUN_GPGCONF_TESTS_FALSE
182-RUN_GPGCONF_TESTS_TRUE
183-HAVE_GPGCONF_FALSE
184-HAVE_GPGCONF_TRUE
185-GPGCONF
186 RUN_GPGSM_TESTS_FALSE
187 RUN_GPGSM_TESTS_TRUE
188 HAVE_GPGSM_FALSE
189@@ -666,6 +661,11 @@
190 RUN_GPG_TESTS_FALSE
191 RUN_GPG_TESTS_TRUE
192 GPG
193+RUN_GPGCONF_TESTS_FALSE
194+RUN_GPGCONF_TESTS_TRUE
195+HAVE_GPGCONF_FALSE
196+HAVE_GPGCONF_TRUE
197+GPGCONF
198 HAVE_ASSUAN_FALSE
199 HAVE_ASSUAN_TRUE
200 LIBASSUAN_LIBS
201@@ -857,12 +857,12 @@
202 with_gpgsm_version
203 with_gpgconf_version
204 with_g13_version
205+with_gpgconf
206+enable_gpgconf_test
207 with_gpg
208 enable_gpg_test
209 with_gpgsm
210 enable_gpgsm_test
211-with_gpgconf
212-enable_gpgconf_test
213 with_g13
214 enable_g13_test
215 enable_fd_passing
216@@ -1420,7 +1420,7 @@
217 # Omit some internal or obsolete options to make the list less imposing.
218 # This message is too long to be a string in the A/UX 3.1 sh.
219 cat <<_ACEOF
220-\`configure' configures gpgme 1.4.2 to adapt to many kinds of systems.
221+\`configure' configures gpgme 1.4.3 to adapt to many kinds of systems.
222
223 Usage: $0 [OPTION]... [VAR=VALUE]...
224
225@@ -1490,7 +1490,7 @@
226
227 if test -n "$ac_init_help"; then
228 case $ac_init_help in
229- short | recursive ) echo "Configuration of gpgme 1.4.2:";;
230+ short | recursive ) echo "Configuration of gpgme 1.4.3:";;
231 esac
232 cat <<\_ACEOF
233
234@@ -1511,9 +1511,9 @@
235 --enable-w32-glib build GPGME Glib for W32
236 --enable-w32-qt build GPGME Qt for W32
237 --disable-largefile omit support for large files
238+ --disable-gpgconf-test disable GPGCONF run test
239 --disable-gpg-test disable GPG run test
240 --disable-gpgsm-test disable GPGSM run test
241- --disable-gpgconf-test disable GPGCONF run test
242 --disable-g13-test disable G13 run test
243 --disable-fd-passing do not use FD passing
244
245@@ -1536,9 +1536,9 @@
246 --with-gpgconf-version=VER
247 require GPGCONF version VER
248 --with-g13-version=VER require G13 version VER
249+ --with-gpgconf=PATH use gpgconf binary at PATH
250 --with-gpg=PATH use GnuPG binary at PATH
251 --with-gpgsm=PATH use GpgSM binary at PATH
252- --with-gpgconf=PATH use gpgconf binary at PATH
253 --with-g13=PATH use g13 binary at PATH
254
255 Some influential environment variables:
256@@ -1620,7 +1620,7 @@
257 test -n "$ac_init_help" && exit $ac_status
258 if $ac_init_version; then
259 cat <<\_ACEOF
260-gpgme configure 1.4.2
261+gpgme configure 1.4.3
262 generated by GNU Autoconf 2.69
263
264 Copyright (C) 2012 Free Software Foundation, Inc.
265@@ -2450,7 +2450,7 @@
266 This file contains any messages produced by compilers while
267 running configure, to aid debugging if configure makes a mistake.
268
269-It was created by gpgme $as_me 1.4.2, which was
270+It was created by gpgme $as_me 1.4.3, which was
271 generated by GNU Autoconf 2.69. Invocation command line was
272
273 $ $0 $@
274@@ -2813,10 +2813,10 @@
275 # (Interfaces added: AGE++)
276 # (Interfaces removed/changed: AGE=0)
277 #
278-LIBGPGME_LT_CURRENT=21
279+LIBGPGME_LT_CURRENT=22
280 # Subtract 2 from this value if you want to make the LFS transition an
281 # ABI break. [Note to self: Remove this comment with the next regular break.]
282-LIBGPGME_LT_AGE=10
283+LIBGPGME_LT_AGE=11
284 LIBGPGME_LT_REVISION=0
285
286 # If the API is changed in an incompatible way: increment the next counter.
287@@ -2864,6 +2864,8 @@
288
289 ac_config_headers="$ac_config_headers config.h"
290
291+# Note: For automake 1.13 add the option
292+# serial-tests
293 am__api_version='1.11'
294
295 # Find a good install program. We prefer a C program (faster),
296@@ -3302,7 +3304,7 @@
297
298 # Define the identity of the package.
299 PACKAGE='gpgme'
300- VERSION='1.4.2'
301+ VERSION='1.4.3'
302
303
304 cat >>confdefs.h <<_ACEOF
305@@ -5995,7 +5997,7 @@
306 #define VERSION "$VERSION"
307 _ACEOF
308
309-VERSION_NUMBER=0x010402
310+VERSION_NUMBER=0x010403
311
312
313 # Don't default to build static libs.
314@@ -17323,7 +17325,7 @@
315 #
316 # Provide information about the build.
317 #
318-BUILD_REVISION="009e26a"
319+BUILD_REVISION="d788c35"
320
321
322 cat >>confdefs.h <<_ACEOF
323@@ -17332,7 +17334,7 @@
324
325
326 BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
327-BUILD_FILEVERSION="${BUILD_FILEVERSION}158"
328+BUILD_FILEVERSION="${BUILD_FILEVERSION}55176"
329
330
331 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
332@@ -18737,6 +18739,11 @@
333
334
335 cat >>confdefs.h <<_ACEOF
336+#define NEED_GPGCONF_VERSION "$NEED_GPGCONF_VERSION"
337+_ACEOF
338+
339+
340+cat >>confdefs.h <<_ACEOF
341 #define NEED_GPG_VERSION "$NEED_GPG_VERSION"
342 _ACEOF
343
344@@ -18747,16 +18754,190 @@
345
346
347 cat >>confdefs.h <<_ACEOF
348-#define NEED_GPGCONF_VERSION "$NEED_GPGCONF_VERSION"
349-_ACEOF
350-
351-
352-cat >>confdefs.h <<_ACEOF
353 #define NEED_G13_VERSION "$NEED_G13_VERSION"
354 _ACEOF
355
356
357-
358+#
359+# Check for GPGCONF
360+#
361+gpgconf_usable_for_test=no
362+NO_OVERRIDE=no
363+
364+# Check whether --with-gpgconf was given.
365+if test "${with_gpgconf+set}" = set; then :
366+ withval=$with_gpgconf; GPGCONF=$withval
367+else
368+ NO_OVERRIDE=yes
369+fi
370+
371+if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
372+ GPGCONF=
373+ NO_OVERRIDE=yes
374+ if test "$cross_compiling" != "yes"; then
375+ # Extract the first word of "gpgconf", so it can be a program name with args.
376+set dummy gpgconf; ac_word=$2
377+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
378+$as_echo_n "checking for $ac_word... " >&6; }
379+if ${ac_cv_path_GPGCONF+:} false; then :
380+ $as_echo_n "(cached) " >&6
381+else
382+ case $GPGCONF in
383+ [\\/]* | ?:[\\/]*)
384+ ac_cv_path_GPGCONF="$GPGCONF" # Let the user override the test with a path.
385+ ;;
386+ *)
387+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
388+for as_dir in $PATH
389+do
390+ IFS=$as_save_IFS
391+ test -z "$as_dir" && as_dir=.
392+ for ac_exec_ext in '' $ac_executable_extensions; do
393+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
394+ ac_cv_path_GPGCONF="$as_dir/$ac_word$ac_exec_ext"
395+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
396+ break 2
397+ fi
398+done
399+ done
400+IFS=$as_save_IFS
401+
402+ ;;
403+esac
404+fi
405+GPGCONF=$ac_cv_path_GPGCONF
406+if test -n "$GPGCONF"; then
407+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGCONF" >&5
408+$as_echo "$GPGCONF" >&6; }
409+else
410+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
411+$as_echo "no" >&6; }
412+fi
413+
414+
415+ fi
416+ if test -z "$GPGCONF"; then
417+ GPGCONF="$GPGCONF_DEFAULT"
418+ fi
419+fi
420+if test "$GPGCONF" = no; then
421+ if test "$NO_OVERRIDE" = "yes"; then
422+ if test "$cross_compiling" != "yes"; then
423+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
424+***
425+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
426+***" >&5
427+$as_echo "$as_me: WARNING:
428+***
429+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
430+***" >&2;}
431+ else
432+ as_fn_error $? "
433+***
434+*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
435+***" "$LINENO" 5
436+ fi
437+ fi
438+else
439+
440+cat >>confdefs.h <<_ACEOF
441+#define GPGCONF_PATH "$GPGCONF"
442+_ACEOF
443+
444+
445+$as_echo "#define ENABLE_GPGCONF 1" >>confdefs.h
446+
447+fi
448+ if test "$GPGCONF" != "no"; then
449+ HAVE_GPGCONF_TRUE=
450+ HAVE_GPGCONF_FALSE='#'
451+else
452+ HAVE_GPGCONF_TRUE='#'
453+ HAVE_GPGCONF_FALSE=
454+fi
455+
456+
457+GPGCONF_VERSION=unknown
458+ok=maybe
459+if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
460+ ok=no
461+else
462+ if test "$cross_compiling" = "yes"; then
463+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF version can not be checked when cross compiling" >&5
464+$as_echo "$as_me: WARNING: GPGCONF version can not be checked when cross compiling" >&2;}
465+ ok=no
466+ else
467+ if test ! -x "$GPGCONF"; then
468+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF not executable, version check disabled" >&5
469+$as_echo "$as_me: WARNING: GPGCONF not executable, version check disabled" >&2;}
470+ ok=no
471+ fi
472+ fi
473+fi
474+if test "$ok" = "maybe"; then
475+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGCONF >= $NEED_GPGCONF_VERSION" >&5
476+$as_echo_n "checking for GPGCONF >= $NEED_GPGCONF_VERSION... " >&6; }
477+ req_major=`echo $NEED_GPGCONF_VERSION | \
478+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
479+ req_minor=`echo $NEED_GPGCONF_VERSION | \
480+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
481+ req_micro=`echo $NEED_GPGCONF_VERSION | \
482+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
483+ GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
484+ major=`echo $GPGCONF_VERSION | \
485+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
486+ minor=`echo $GPGCONF_VERSION | \
487+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
488+ micro=`echo $GPGCONF_VERSION | \
489+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
490+
491+ if test "$major" -gt "$req_major"; then
492+ ok=yes
493+ else
494+ if test "$major" -eq "$req_major"; then
495+ if test "$minor" -gt "$req_minor"; then
496+ ok=yes
497+ else
498+ if test "$minor" -eq "$req_minor"; then
499+ if test "$micro" -ge "$req_micro"; then
500+ ok=yes
501+ fi
502+ fi
503+ fi
504+ fi
505+ fi
506+ if test "$ok" = "yes"; then
507+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
508+$as_echo "yes" >&6; }
509+ if test "$cross_compiling" != "yes"; then
510+ gpgconf_usable_for_test=yes
511+ fi
512+ else
513+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
514+$as_echo "no" >&6; }
515+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&5
516+$as_echo "$as_me: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&2;}
517+ fi
518+fi
519+run_gpgconf_test="$ok"
520+# Check whether --enable-gpgconf-test was given.
521+if test "${enable_gpgconf_test+set}" = set; then :
522+ enableval=$enable_gpgconf_test; run_gpgconf_test=$enableval
523+fi
524+
525+ if test "$run_gpgconf_test" = "yes"; then
526+ RUN_GPGCONF_TESTS_TRUE=
527+ RUN_GPGCONF_TESTS_FALSE='#'
528+else
529+ RUN_GPGCONF_TESTS_TRUE='#'
530+ RUN_GPGCONF_TESTS_FALSE=
531+fi
532+
533+
534+
535+#
536+# Check for GPG
537+#
538 NO_OVERRIDE=no
539
540 # Check whether --with-gpg was given.
541@@ -18770,7 +18951,10 @@
542 GPG=
543 NO_OVERRIDE=yes
544 if test "$cross_compiling" != "yes"; then
545- # Extract the first word of "gpg", so it can be a program name with args.
546+ if test "$gpgconf_usable_for_test" = "yes"; then
547+ GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
548+ else
549+ # Extract the first word of "gpg", so it can be a program name with args.
550 set dummy gpg; ac_word=$2
551 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
552 $as_echo_n "checking for $ac_word... " >&6; }
553@@ -18810,6 +18994,7 @@
554 fi
555
556
557+ fi
558 fi
559 if test -z "$GPG"; then
560 GPG="$GPG_DEFAULT"
561@@ -18916,6 +19101,10 @@
562
563
564
565+
566+#
567+# Check for GPGSM
568+#
569 NO_OVERRIDE=no
570
571 # Check whether --with-gpgsm was given.
572@@ -18929,7 +19118,10 @@
573 GPGSM=
574 NO_OVERRIDE=yes
575 if test "$cross_compiling" != "yes"; then
576- # Extract the first word of "gpgsm", so it can be a program name with args.
577+ if test "$gpgconf_usable_for_test" = "yes"; then
578+ GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
579+ else
580+ # Extract the first word of "gpgsm", so it can be a program name with args.
581 set dummy gpgsm; ac_word=$2
582 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
583 $as_echo_n "checking for $ac_word... " >&6; }
584@@ -18969,6 +19161,7 @@
585 fi
586
587
588+ fi
589 fi
590 if test -z "$GPGSM"; then
591 GPGSM="$GPGSM_DEFAULT"
592@@ -19087,176 +19280,9 @@
593
594
595
596-NO_OVERRIDE=no
597-
598-# Check whether --with-gpgconf was given.
599-if test "${with_gpgconf+set}" = set; then :
600- withval=$with_gpgconf; GPGCONF=$withval
601-else
602- NO_OVERRIDE=yes
603-fi
604-
605-if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
606- GPGCONF=
607- NO_OVERRIDE=yes
608- if test "$cross_compiling" != "yes"; then
609- # Extract the first word of "gpgconf", so it can be a program name with args.
610-set dummy gpgconf; ac_word=$2
611-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
612-$as_echo_n "checking for $ac_word... " >&6; }
613-if ${ac_cv_path_GPGCONF+:} false; then :
614- $as_echo_n "(cached) " >&6
615-else
616- case $GPGCONF in
617- [\\/]* | ?:[\\/]*)
618- ac_cv_path_GPGCONF="$GPGCONF" # Let the user override the test with a path.
619- ;;
620- *)
621- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
622-for as_dir in $PATH
623-do
624- IFS=$as_save_IFS
625- test -z "$as_dir" && as_dir=.
626- for ac_exec_ext in '' $ac_executable_extensions; do
627- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
628- ac_cv_path_GPGCONF="$as_dir/$ac_word$ac_exec_ext"
629- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
630- break 2
631- fi
632-done
633- done
634-IFS=$as_save_IFS
635-
636- ;;
637-esac
638-fi
639-GPGCONF=$ac_cv_path_GPGCONF
640-if test -n "$GPGCONF"; then
641- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGCONF" >&5
642-$as_echo "$GPGCONF" >&6; }
643-else
644- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
645-$as_echo "no" >&6; }
646-fi
647-
648-
649- fi
650- if test -z "$GPGCONF"; then
651- GPGCONF="$GPGCONF_DEFAULT"
652- fi
653-fi
654-if test "$GPGCONF" = no; then
655- if test "$NO_OVERRIDE" = "yes"; then
656- if test "$cross_compiling" != "yes"; then
657- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
658-***
659-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
660-***" >&5
661-$as_echo "$as_me: WARNING:
662-***
663-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
664-***" >&2;}
665- else
666- as_fn_error $? "
667-***
668-*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
669-***" "$LINENO" 5
670- fi
671- fi
672-else
673-
674-cat >>confdefs.h <<_ACEOF
675-#define GPGCONF_PATH "$GPGCONF"
676-_ACEOF
677-
678-
679-$as_echo "#define ENABLE_GPGCONF 1" >>confdefs.h
680-
681-fi
682- if test "$GPGCONF" != "no"; then
683- HAVE_GPGCONF_TRUE=
684- HAVE_GPGCONF_FALSE='#'
685-else
686- HAVE_GPGCONF_TRUE='#'
687- HAVE_GPGCONF_FALSE=
688-fi
689-
690-
691-GPGCONF_VERSION=unknown
692-ok=maybe
693-if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
694- ok=no
695-else
696- if test "$cross_compiling" = "yes"; then
697- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF version can not be checked when cross compiling" >&5
698-$as_echo "$as_me: WARNING: GPGCONF version can not be checked when cross compiling" >&2;}
699- ok=no
700- else
701- if test ! -x "$GPGCONF"; then
702- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF not executable, version check disabled" >&5
703-$as_echo "$as_me: WARNING: GPGCONF not executable, version check disabled" >&2;}
704- ok=no
705- fi
706- fi
707-fi
708-if test "$ok" = "maybe"; then
709- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGCONF >= $NEED_GPGCONF_VERSION" >&5
710-$as_echo_n "checking for GPGCONF >= $NEED_GPGCONF_VERSION... " >&6; }
711- req_major=`echo $NEED_GPGCONF_VERSION | \
712- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
713- req_minor=`echo $NEED_GPGCONF_VERSION | \
714- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
715- req_micro=`echo $NEED_GPGCONF_VERSION | \
716- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
717- GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
718- major=`echo $GPGCONF_VERSION | \
719- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
720- minor=`echo $GPGCONF_VERSION | \
721- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
722- micro=`echo $GPGCONF_VERSION | \
723- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
724-
725- if test "$major" -gt "$req_major"; then
726- ok=yes
727- else
728- if test "$major" -eq "$req_major"; then
729- if test "$minor" -gt "$req_minor"; then
730- ok=yes
731- else
732- if test "$minor" -eq "$req_minor"; then
733- if test "$micro" -ge "$req_micro"; then
734- ok=yes
735- fi
736- fi
737- fi
738- fi
739- fi
740- if test "$ok" = "yes"; then
741- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
742-$as_echo "yes" >&6; }
743- else
744- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
745-$as_echo "no" >&6; }
746- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&5
747-$as_echo "$as_me: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&2;}
748- fi
749-fi
750-run_gpgconf_test="$ok"
751-# Check whether --enable-gpgconf-test was given.
752-if test "${enable_gpgconf_test+set}" = set; then :
753- enableval=$enable_gpgconf_test; run_gpgconf_test=$enableval
754-fi
755-
756- if test "$run_gpgconf_test" = "yes"; then
757- RUN_GPGCONF_TESTS_TRUE=
758- RUN_GPGCONF_TESTS_FALSE='#'
759-else
760- RUN_GPGCONF_TESTS_TRUE='#'
761- RUN_GPGCONF_TESTS_FALSE=
762-fi
763-
764-
765-
766+#
767+# Check for G13
768+#
769 NO_OVERRIDE=no
770
771 # Check whether --with-g13 was given.
772@@ -19270,7 +19296,14 @@
773 G13=
774 NO_OVERRIDE=yes
775 if test "$cross_compiling" != "yes"; then
776- # Extract the first word of "g13", so it can be a program name with args.
777+ if test "$gpgconf_usable_for_test" = "yes"; then
778+ G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
779+ if test -z "$G13"; then
780+ # Use a hack if gpgconf has no support for g13.
781+ G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
782+ fi
783+ else
784+ # Extract the first word of "g13", so it can be a program name with args.
785 set dummy g13; ac_word=$2
786 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
787 $as_echo_n "checking for $ac_word... " >&6; }
788@@ -19310,6 +19343,7 @@
789 fi
790
791
792+ fi
793 fi
794 if test -z "$G13"; then
795 G13="$G13_DEFAULT"
796@@ -19427,6 +19461,10 @@
797
798
799
800+#
801+# Other checks
802+#
803+
804 # Check for funopen
805 for ac_func in funopen
806 do :
807@@ -19889,6 +19927,14 @@
808 as_fn_error $? "conditional \"HAVE_ASSUAN\" was never defined.
809 Usually this means the macro was only invoked conditionally." "$LINENO" 5
810 fi
811+if test -z "${HAVE_GPGCONF_TRUE}" && test -z "${HAVE_GPGCONF_FALSE}"; then
812+ as_fn_error $? "conditional \"HAVE_GPGCONF\" was never defined.
813+Usually this means the macro was only invoked conditionally." "$LINENO" 5
814+fi
815+if test -z "${RUN_GPGCONF_TESTS_TRUE}" && test -z "${RUN_GPGCONF_TESTS_FALSE}"; then
816+ as_fn_error $? "conditional \"RUN_GPGCONF_TESTS\" was never defined.
817+Usually this means the macro was only invoked conditionally." "$LINENO" 5
818+fi
819 if test -z "${RUN_GPG_TESTS_TRUE}" && test -z "${RUN_GPG_TESTS_FALSE}"; then
820 as_fn_error $? "conditional \"RUN_GPG_TESTS\" was never defined.
821 Usually this means the macro was only invoked conditionally." "$LINENO" 5
822@@ -19901,14 +19947,6 @@
823 as_fn_error $? "conditional \"RUN_GPGSM_TESTS\" was never defined.
824 Usually this means the macro was only invoked conditionally." "$LINENO" 5
825 fi
826-if test -z "${HAVE_GPGCONF_TRUE}" && test -z "${HAVE_GPGCONF_FALSE}"; then
827- as_fn_error $? "conditional \"HAVE_GPGCONF\" was never defined.
828-Usually this means the macro was only invoked conditionally." "$LINENO" 5
829-fi
830-if test -z "${RUN_GPGCONF_TESTS_TRUE}" && test -z "${RUN_GPGCONF_TESTS_FALSE}"; then
831- as_fn_error $? "conditional \"RUN_GPGCONF_TESTS\" was never defined.
832-Usually this means the macro was only invoked conditionally." "$LINENO" 5
833-fi
834 if test -z "${HAVE_G13_TRUE}" && test -z "${HAVE_G13_FALSE}"; then
835 as_fn_error $? "conditional \"HAVE_G13\" was never defined.
836 Usually this means the macro was only invoked conditionally." "$LINENO" 5
837@@ -20322,7 +20360,7 @@
838 # report actual input values of CONFIG_FILES etc. instead of their
839 # values after options handling.
840 ac_log="
841-This file was extended by gpgme $as_me 1.4.2, which was
842+This file was extended by gpgme $as_me 1.4.3, which was
843 generated by GNU Autoconf 2.69. Invocation command line was
844
845 CONFIG_FILES = $CONFIG_FILES
846@@ -20388,7 +20426,7 @@
847 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
848 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
849 ac_cs_version="\\
850-gpgme config.status 1.4.2
851+gpgme config.status 1.4.3
852 configured by $0, generated by GNU Autoconf 2.69,
853 with options \\"\$ac_cs_config\\"
854
855@@ -22682,16 +22720,16 @@
856 echo "
857 GPGME v${VERSION} has been configured as follows:
858
859- Revision: 009e26a (158)
860+ Revision: d788c35 (55176)
861 Platform: $host
862
863- GnuPG path: $GPG
864- GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
865- GpgSM path: $GPGSM
866- GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
867- GpgConf path: $GPGCONF
868- GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
869- G13 path: $G13
870+ Gpgconf at: $GPGCONF
871+ Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
872+ GPG at: $GPG
873+ GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
874+ Gpgsm at: $GPGSM
875+ Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
876+ G13 at: $G13
877 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
878
879 Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
880
881=== modified file 'configure.ac'
882--- configure.ac 2013-05-29 18:33:42 +0000
883+++ configure.ac 2013-10-23 07:14:02 +0000
884@@ -29,7 +29,7 @@
885 # for the LT versions.
886 m4_define(mym4_version_major, [1])
887 m4_define(mym4_version_minor, [4])
888-m4_define(mym4_version_micro, [2])
889+m4_define(mym4_version_micro, [3])
890
891 # Below is m4 magic to extract and compute the revision number, the
892 # decimalized short revision number, a beta version string, and a flag
893@@ -55,10 +55,10 @@
894 # (Interfaces added: AGE++)
895 # (Interfaces removed/changed: AGE=0)
896 #
897-LIBGPGME_LT_CURRENT=21
898+LIBGPGME_LT_CURRENT=22
899 # Subtract 2 from this value if you want to make the LFS transition an
900 # ABI break. [Note to self: Remove this comment with the next regular break.]
901-LIBGPGME_LT_AGE=10
902+LIBGPGME_LT_AGE=11
903 LIBGPGME_LT_REVISION=0
904
905 # If the API is changed in an incompatible way: increment the next counter.
906@@ -77,6 +77,8 @@
907 AC_CONFIG_MACRO_DIR([m4])
908 AC_CONFIG_SRCDIR(src/gpgme.h.in)
909 AC_CONFIG_HEADER(config.h)
910+# Note: For automake 1.13 add the option
911+# serial-tests
912 AM_INIT_AUTOMAKE
913 AM_MAINTAINER_MODE
914 AC_CANONICAL_HOST
915@@ -443,16 +445,121 @@
916 NEED_G13_VERSION=0.0.0
917 fi
918
919+AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
920+ [Min. needed GPGCONF version.])
921 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
922 [Min. needed GnuPG version.])
923 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
924 [Min. needed GPGSM version.])
925-AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
926- [Min. needed GPGCONF version.])
927 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
928 [Min. needed G13 version.])
929
930-
931+#
932+# Check for GPGCONF
933+#
934+gpgconf_usable_for_test=no
935+NO_OVERRIDE=no
936+AC_ARG_WITH(gpgconf,
937+ AC_HELP_STRING([--with-gpgconf=PATH],
938+ [use gpgconf binary at PATH]),
939+ GPGCONF=$withval, NO_OVERRIDE=yes)
940+if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
941+ GPGCONF=
942+ NO_OVERRIDE=yes
943+ if test "$cross_compiling" != "yes"; then
944+ AC_PATH_PROG(GPGCONF, gpgconf)
945+ fi
946+ if test -z "$GPGCONF"; then
947+ GPGCONF="$GPGCONF_DEFAULT"
948+ fi
949+fi
950+if test "$GPGCONF" = no; then
951+ if test "$NO_OVERRIDE" = "yes"; then
952+ if test "$cross_compiling" != "yes"; then
953+ AC_MSG_WARN([
954+***
955+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
956+***])
957+ else
958+ AC_MSG_ERROR([
959+***
960+*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
961+***])
962+ fi
963+ fi
964+else
965+ AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
966+ AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
967+fi
968+AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
969+
970+dnl Check for GPGCONF version requirement.
971+GPGCONF_VERSION=unknown
972+ok=maybe
973+if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
974+ ok=no
975+else
976+ if test "$cross_compiling" = "yes"; then
977+ AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
978+ ok=no
979+ else
980+ if test ! -x "$GPGCONF"; then
981+ AC_MSG_WARN([GPGCONF not executable, version check disabled])
982+ ok=no
983+ fi
984+ fi
985+fi
986+if test "$ok" = "maybe"; then
987+ AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
988+ req_major=`echo $NEED_GPGCONF_VERSION | \
989+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
990+ req_minor=`echo $NEED_GPGCONF_VERSION | \
991+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
992+ req_micro=`echo $NEED_GPGCONF_VERSION | \
993+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
994+ GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
995+ major=`echo $GPGCONF_VERSION | \
996+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
997+ minor=`echo $GPGCONF_VERSION | \
998+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
999+ micro=`echo $GPGCONF_VERSION | \
1000+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
1001+
1002+ if test "$major" -gt "$req_major"; then
1003+ ok=yes
1004+ else
1005+ if test "$major" -eq "$req_major"; then
1006+ if test "$minor" -gt "$req_minor"; then
1007+ ok=yes
1008+ else
1009+ if test "$minor" -eq "$req_minor"; then
1010+ if test "$micro" -ge "$req_micro"; then
1011+ ok=yes
1012+ fi
1013+ fi
1014+ fi
1015+ fi
1016+ fi
1017+ if test "$ok" = "yes"; then
1018+ AC_MSG_RESULT(yes)
1019+ if test "$cross_compiling" != "yes"; then
1020+ gpgconf_usable_for_test=yes
1021+ fi
1022+ else
1023+ AC_MSG_RESULT(no)
1024+ AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
1025+ fi
1026+fi
1027+run_gpgconf_test="$ok"
1028+AC_ARG_ENABLE(gpgconf-test,
1029+ AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
1030+ run_gpgconf_test=$enableval)
1031+AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
1032+
1033+
1034+#
1035+# Check for GPG
1036+#
1037 NO_OVERRIDE=no
1038 AC_ARG_WITH(gpg,
1039 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
1040@@ -461,7 +568,11 @@
1041 GPG=
1042 NO_OVERRIDE=yes
1043 if test "$cross_compiling" != "yes"; then
1044- AC_PATH_PROG(GPG, gpg)
1045+ if test "$gpgconf_usable_for_test" = "yes"; then
1046+ GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
1047+ else
1048+ AC_PATH_PROG(GPG, gpg)
1049+ fi
1050 fi
1051 if test -z "$GPG"; then
1052 GPG="$GPG_DEFAULT"
1053@@ -546,6 +657,10 @@
1054 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
1055 AC_SUBST(GPG_PATH)
1056
1057+
1058+#
1059+# Check for GPGSM
1060+#
1061 NO_OVERRIDE=no
1062 AC_ARG_WITH(gpgsm,
1063 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
1064@@ -554,7 +669,11 @@
1065 GPGSM=
1066 NO_OVERRIDE=yes
1067 if test "$cross_compiling" != "yes"; then
1068- AC_PATH_PROG(GPGSM, gpgsm)
1069+ if test "$gpgconf_usable_for_test" = "yes"; then
1070+ GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
1071+ else
1072+ AC_PATH_PROG(GPGSM, gpgsm)
1073+ fi
1074 fi
1075 if test -z "$GPGSM"; then
1076 GPGSM="$GPGSM_DEFAULT"
1077@@ -642,102 +761,9 @@
1078 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
1079
1080
1081-NO_OVERRIDE=no
1082-AC_ARG_WITH(gpgconf,
1083- AC_HELP_STRING([--with-gpgconf=PATH],
1084- [use gpgconf binary at PATH]),
1085- GPGCONF=$withval, NO_OVERRIDE=yes)
1086-if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
1087- GPGCONF=
1088- NO_OVERRIDE=yes
1089- if test "$cross_compiling" != "yes"; then
1090- AC_PATH_PROG(GPGCONF, gpgconf)
1091- fi
1092- if test -z "$GPGCONF"; then
1093- GPGCONF="$GPGCONF_DEFAULT"
1094- fi
1095-fi
1096-if test "$GPGCONF" = no; then
1097- if test "$NO_OVERRIDE" = "yes"; then
1098- if test "$cross_compiling" != "yes"; then
1099- AC_MSG_WARN([
1100-***
1101-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
1102-***])
1103- else
1104- AC_MSG_ERROR([
1105-***
1106-*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
1107-***])
1108- fi
1109- fi
1110-else
1111- AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
1112- AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
1113-fi
1114-AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
1115-
1116-dnl Check for GPGCONF version requirement.
1117-GPGCONF_VERSION=unknown
1118-ok=maybe
1119-if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
1120- ok=no
1121-else
1122- if test "$cross_compiling" = "yes"; then
1123- AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
1124- ok=no
1125- else
1126- if test ! -x "$GPGCONF"; then
1127- AC_MSG_WARN([GPGCONF not executable, version check disabled])
1128- ok=no
1129- fi
1130- fi
1131-fi
1132-if test "$ok" = "maybe"; then
1133- AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
1134- req_major=`echo $NEED_GPGCONF_VERSION | \
1135- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1136- req_minor=`echo $NEED_GPGCONF_VERSION | \
1137- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1138- req_micro=`echo $NEED_GPGCONF_VERSION | \
1139- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1140- GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
1141- major=`echo $GPGCONF_VERSION | \
1142- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
1143- minor=`echo $GPGCONF_VERSION | \
1144- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
1145- micro=`echo $GPGCONF_VERSION | \
1146- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
1147-
1148- if test "$major" -gt "$req_major"; then
1149- ok=yes
1150- else
1151- if test "$major" -eq "$req_major"; then
1152- if test "$minor" -gt "$req_minor"; then
1153- ok=yes
1154- else
1155- if test "$minor" -eq "$req_minor"; then
1156- if test "$micro" -ge "$req_micro"; then
1157- ok=yes
1158- fi
1159- fi
1160- fi
1161- fi
1162- fi
1163- if test "$ok" = "yes"; then
1164- AC_MSG_RESULT(yes)
1165- else
1166- AC_MSG_RESULT(no)
1167- AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
1168- fi
1169-fi
1170-run_gpgconf_test="$ok"
1171-AC_ARG_ENABLE(gpgconf-test,
1172- AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
1173- run_gpgconf_test=$enableval)
1174-AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
1175-
1176-
1177+#
1178+# Check for G13
1179+#
1180 NO_OVERRIDE=no
1181 AC_ARG_WITH(g13,
1182 AC_HELP_STRING([--with-g13=PATH],
1183@@ -747,7 +773,15 @@
1184 G13=
1185 NO_OVERRIDE=yes
1186 if test "$cross_compiling" != "yes"; then
1187- AC_PATH_PROG(G13, g13)
1188+ if test "$gpgconf_usable_for_test" = "yes"; then
1189+ G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
1190+ if test -z "$G13"; then
1191+ # Use a hack if gpgconf has no support for g13.
1192+ G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
1193+ fi
1194+ else
1195+ AC_PATH_PROG(G13, g13)
1196+ fi
1197 fi
1198 if test -z "$G13"; then
1199 G13="$G13_DEFAULT"
1200@@ -834,6 +868,10 @@
1201 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
1202
1203
1204+#
1205+# Other checks
1206+#
1207+
1208 # Check for funopen
1209 AC_CHECK_FUNCS(funopen)
1210 if test $ac_cv_func_funopen != yes; then
1211@@ -920,11 +958,15 @@
1212 # Add a few constants to help porting to W32
1213 AH_VERBATIM([SEPCONSTANTS],
1214 [
1215-/* Separators as used in $PATH. */
1216+/* Separators as used in $PATH and file name. */
1217 #ifdef HAVE_DOSISH_SYSTEM
1218 #define PATHSEP_C ';'
1219+#define DIRSEP_C '\\'
1220+#define DIRSEP_S "\\"
1221 #else
1222 #define PATHSEP_C ':'
1223+#define DIRSEP_C '/'
1224+#define DIRSEP_S "/"
1225 #endif
1226 ])
1227
1228@@ -1025,13 +1067,13 @@
1229 Revision: mym4_revision (mym4_revision_dec)
1230 Platform: $host
1231
1232- GnuPG path: $GPG
1233- GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
1234- GpgSM path: $GPGSM
1235- GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
1236- GpgConf path: $GPGCONF
1237- GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
1238- G13 path: $G13
1239+ Gpgconf at: $GPGCONF
1240+ Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
1241+ GPG at: $GPG
1242+ GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
1243+ Gpgsm at: $GPGSM
1244+ Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
1245+ G13 at: $G13
1246 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
1247
1248 Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
1249
1250=== modified file 'debian/changelog'
1251--- debian/changelog 2013-07-30 10:34:24 +0000
1252+++ debian/changelog 2013-10-23 07:14:02 +0000
1253@@ -1,3 +1,28 @@
1254+gpgme1.0 (1.4.3-0.1ubuntu1) trusty; urgency=low
1255+
1256+ * Merge from debian unstable. Remaining changes:
1257+ - debian/rules: Switch back to using /usr/bin/gpg and add back gnupg build
1258+ dependency, as we don't install gnupg2 by default. This was missing in the
1259+ previous upload, and unbreaks nautilus-dropbox, seahorse, bzr, and other
1260+ libgpgme consumers.
1261+ - debian/control: Depends on "gnupg | gnupg2" rather than gnupg2,
1262+ default to the old version since the new one depends on gpg-agent,
1263+ pinentry-gtk2, and a bunch of other packages we don't need/want in the
1264+ default installation
1265+
1266+ -- Jackson Doak <noskcaj@ubuntu.com> Wed, 23 Oct 2013 18:01:04 +1100
1267+
1268+gpgme1.0 (1.4.3-0.1) unstable; urgency=low
1269+
1270+ * NMU
1271+ * New upstream release.
1272+ * debian/control (Build-Depends): Dropped dirmngr (closes: #712813). It is
1273+ not necessary for the build.
1274+ (Vcs-Browser, Vcs-Svn): Fixed vcs-field-not-canonical.
1275+ * debian/libgpgme11.symbols: Updated symbols file.
1276+
1277+ -- Daniel Leidert <dleidert@debian.org> Mon, 12 Aug 2013 22:33:16 +0200
1278+
1279 gpgme1.0 (1.4.2-0.1ubuntu3) saucy; urgency=low
1280
1281 * debian/rules: Switch back to using /usr/bin/gpg and add back gnupg build
1282@@ -536,6 +561,3 @@
1283
1284 -- Jose Carlos Garcia Sogo <jose@jaimedelamo.eu.org> Mon, 30 Apr 2001 19:34:26 +0200
1285
1286-Local variables:
1287-mode: debian-changelog
1288-End:
1289
1290=== modified file 'debian/control'
1291--- debian/control 2013-07-30 10:34:24 +0000
1292+++ debian/control 2013-10-23 07:14:02 +0000
1293@@ -14,8 +14,8 @@
1294 scdaemon
1295 Standards-Version: 3.9.4
1296 Homepage: http://www.gnupg.org/gpgme.html
1297-Vcs-Browser: http://svn.debian.org/wsvn/pkg-gnupg/gpgme/trunk/
1298-Vcs-Svn: svn://svn.debian.org/svn/pkg-gnupg/gpgme/trunk/
1299+Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-gnupg/gpgme/trunk/
1300+Vcs-Svn: svn://anonscm.debian.org/pkg-gnupg/gpgme/trunk/
1301
1302 Package: libgpgme11-dev
1303 Section: libdevel
1304
1305=== modified file 'debian/libgpgme11.symbols'
1306--- debian/libgpgme11.symbols 2013-05-14 20:29:20 +0000
1307+++ debian/libgpgme11.symbols 2013-10-23 07:14:02 +0000
1308@@ -14,6 +14,7 @@
1309 gpgme_ctx_set_engine_info@GPGME_1.1 1.1.6
1310 gpgme_data_get_encoding@GPGME_1.0 1.1.2
1311 gpgme_data_get_file_name@GPGME_1.1 1.1.2
1312+ gpgme_data_identify@GPGME_1.1 1.4.3
1313 gpgme_data_new@GPGME_1.0 1.1.2
1314 gpgme_data_new_from_cbs@GPGME_1.0 1.1.2
1315 gpgme_data_new_from_fd@GPGME_1.0 1.1.2
1316@@ -148,6 +149,7 @@
1317 gpgme_sig_notation_get@GPGME_1.1 1.1.2
1318 gpgme_signers_add@GPGME_1.0 1.1.2
1319 gpgme_signers_clear@GPGME_1.0 1.1.2
1320+ gpgme_signers_count@GPGME_1.0 1.4.3
1321 gpgme_signers_enum@GPGME_1.0 1.1.2
1322 gpgme_strerror@GPGME_1.0 1.1.2
1323 gpgme_strerror_r@GPGME_1.0 1.1.2
1324@@ -174,6 +176,7 @@
1325 gpgme_ctx_set_engine_info@GPGME_1.1 1.1.6
1326 gpgme_data_get_encoding@GPGME_1.0 1.1.2
1327 gpgme_data_get_file_name@GPGME_1.1 1.1.2
1328+ gpgme_data_identify@GPGME_1.1 1.4.3
1329 gpgme_data_new@GPGME_1.0 1.1.2
1330 gpgme_data_new_from_cbs@GPGME_1.0 1.1.2
1331 gpgme_data_new_from_fd@GPGME_1.0 1.1.2
1332@@ -308,6 +311,7 @@
1333 gpgme_sig_notation_get@GPGME_1.1 1.1.2
1334 gpgme_signers_add@GPGME_1.0 1.1.2
1335 gpgme_signers_clear@GPGME_1.0 1.1.2
1336+ gpgme_signers_count@GPGME_1.0 1.4.3
1337 gpgme_signers_enum@GPGME_1.0 1.1.2
1338 gpgme_strerror@GPGME_1.0 1.1.2
1339 gpgme_strerror_r@GPGME_1.0 1.1.2
1340
1341=== modified file 'doc/gpgme.info'
1342--- doc/gpgme.info 2013-05-29 18:33:42 +0000
1343+++ doc/gpgme.info 2013-10-23 07:14:02 +0000
1344@@ -22,8 +22,8 @@
1345
1346 This file documents the GPGME library.
1347
1348- This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
1349-Easy' Reference Manual', for Version 1.4.2.
1350+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
1351+Made Easy' Reference Manual', for Version 1.4.3.
1352
1353 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
1354 2013 g10 Code GmbH.
1355@@ -41,117 +41,118 @@
1356
1357 
1358 Indirect:
1359-gpgme.info-1: 1756
1360-gpgme.info-2: 281093
1361+gpgme.info-1: 1758
1362+gpgme.info-2: 283468
1363 
1364 Tag Table:
1365 (Indirect)
1366-Node: Top1756
1367-Node: Introduction8595
1368-Node: Getting Started9382
1369-Node: Features10507
1370-Node: Overview11657
1371-Node: Preparation12766
1372-Node: Header13763
1373-Node: Building the Source14462
1374-Node: Largefile Support (LFS)16571
1375-Node: Using Automake21882
1376-Node: Using Libtool23518
1377-Node: Library Version Check23868
1378-Node: Signal Handling27823
1379-Node: Multi Threading29039
1380-Ref: Multi Threading-Footnote-131221
1381-Node: Protocols and Engines31635
1382-Node: Engine Version Check33984
1383-Node: Engine Information34561
1384-Node: Engine Configuration38261
1385-Node: OpenPGP39523
1386-Node: Cryptographic Message Syntax39859
1387-Node: Algorithms40153
1388-Ref: Algorithms-Footnote-140632
1389-Node: Public Key Algorithms40760
1390-Node: Hash Algorithms42691
1391-Node: Error Handling43789
1392-Node: Error Values45651
1393-Node: Error Sources50729
1394-Node: Error Codes53056
1395-Node: Error Strings57695
1396-Node: Exchanging Data59474
1397-Node: Creating Data Buffers61303
1398-Node: Memory Based Data Buffers61819
1399-Node: File Based Data Buffers65173
1400-Node: Callback Based Data Buffers67344
1401-Node: Destroying Data Buffers72900
1402-Node: Manipulating Data Buffers74259
1403-Node: Data Buffer I/O Operations74678
1404-Node: Data Buffer Meta-Data77381
1405-Node: Contexts80731
1406-Node: Creating Contexts81854
1407-Node: Destroying Contexts82665
1408-Node: Result Management83000
1409-Node: Context Attributes84406
1410-Node: Protocol Selection85184
1411-Node: Crypto Engine86196
1412-Node: ASCII Armor88017
1413-Node: Text Mode88629
1414-Node: Included Certificates89560
1415-Node: Key Listing Mode90935
1416-Node: Passphrase Callback94292
1417-Node: Progress Meter Callback97430
1418-Node: Locale99354
1419-Node: Key Management100893
1420-Node: Listing Keys110818
1421-Node: Information About Keys118080
1422-Node: Key Signatures126078
1423-Node: Manipulating Keys130090
1424-Node: Generating Keys130932
1425-Node: Exporting Keys135539
1426-Node: Importing Keys141438
1427-Ref: Importing Keys-Footnote-1148601
1428-Node: Deleting Keys148729
1429-Node: Changing Passphrases150126
1430-Node: Advanced Key Editing151387
1431-Node: Trust Item Management154491
1432-Node: Listing Trust Items155561
1433-Node: Information About Trust Items157859
1434-Node: Manipulating Trust Items159741
1435-Node: Crypto Operations160702
1436-Node: Decrypt161946
1437-Node: Verify165804
1438-Node: Decrypt and Verify183660
1439-Node: Sign185664
1440-Node: Selecting Signers186228
1441-Node: Creating a Signature187209
1442-Node: Signature Notation Data191798
1443-Node: Encrypt193982
1444-Node: Encrypting a Plaintext194338
1445-Node: Run Control200183
1446-Node: Waiting For Completion200930
1447-Node: Using External Event Loops202976
1448-Node: I/O Callback Interface204943
1449-Node: Registering I/O Callbacks210037
1450-Node: I/O Callback Example212028
1451-Node: I/O Callback Example GTK+218247
1452-Node: I/O Callback Example GDK220036
1453-Node: I/O Callback Example Qt221678
1454-Node: Cancellation223966
1455-Node: UI Server Protocol226219
1456-Ref: UI Server Protocol-Footnote-1227650
1457-Node: UI Server Encrypt227769
1458-Node: UI Server Sign232950
1459-Node: UI Server Decrypt235179
1460-Node: UI Server Verify236617
1461-Node: UI Server Set Input Files240119
1462-Node: UI Server Sign/Encrypt Files240919
1463-Node: UI Server Verify/Decrypt Files242688
1464-Node: UI Server Import/Export Keys244534
1465-Node: UI Server Checksum Files245567
1466-Node: Miscellaneous UI Server Commands247733
1467-Ref: command SENDER249645
1468-Node: Debugging251321
1469-Node: Library Copying252976
1470-Node: Copying281093
1471-Node: Function and Data Index318724
1472-Node: Concept Index343986
1473+Node: Top1758
1474+Node: Introduction8599
1475+Node: Getting Started9386
1476+Node: Features10511
1477+Node: Overview11661
1478+Node: Preparation12770
1479+Node: Header13767
1480+Node: Building the Source14466
1481+Node: Largefile Support (LFS)16575
1482+Node: Using Automake21886
1483+Node: Using Libtool23522
1484+Node: Library Version Check23872
1485+Node: Signal Handling27827
1486+Node: Multi Threading29043
1487+Ref: Multi Threading-Footnote-131225
1488+Node: Protocols and Engines31639
1489+Node: Engine Version Check33988
1490+Node: Engine Information34565
1491+Node: Engine Configuration38265
1492+Node: OpenPGP39527
1493+Node: Cryptographic Message Syntax39863
1494+Node: Algorithms40157
1495+Ref: Algorithms-Footnote-140636
1496+Node: Public Key Algorithms40764
1497+Node: Hash Algorithms42695
1498+Node: Error Handling43793
1499+Node: Error Values45655
1500+Node: Error Sources50733
1501+Node: Error Codes53060
1502+Node: Error Strings57699
1503+Node: Exchanging Data59478
1504+Node: Creating Data Buffers61307
1505+Node: Memory Based Data Buffers61823
1506+Node: File Based Data Buffers65177
1507+Node: Callback Based Data Buffers67348
1508+Node: Destroying Data Buffers72904
1509+Node: Manipulating Data Buffers74263
1510+Node: Data Buffer I/O Operations74755
1511+Node: Data Buffer Meta-Data77458
1512+Node: Data Buffer Convenience80840
1513+Node: Contexts82776
1514+Node: Creating Contexts83899
1515+Node: Destroying Contexts84710
1516+Node: Result Management85045
1517+Node: Context Attributes86451
1518+Node: Protocol Selection87229
1519+Node: Crypto Engine88241
1520+Node: ASCII Armor90062
1521+Node: Text Mode90674
1522+Node: Included Certificates91605
1523+Node: Key Listing Mode92980
1524+Node: Passphrase Callback96337
1525+Node: Progress Meter Callback99475
1526+Node: Locale101399
1527+Node: Key Management102938
1528+Node: Listing Keys112863
1529+Node: Information About Keys120125
1530+Node: Key Signatures128123
1531+Node: Manipulating Keys132135
1532+Node: Generating Keys132977
1533+Node: Exporting Keys137584
1534+Node: Importing Keys143483
1535+Ref: Importing Keys-Footnote-1150646
1536+Node: Deleting Keys150774
1537+Node: Changing Passphrases152171
1538+Node: Advanced Key Editing153432
1539+Node: Trust Item Management156536
1540+Node: Listing Trust Items157606
1541+Node: Information About Trust Items159904
1542+Node: Manipulating Trust Items161786
1543+Node: Crypto Operations162747
1544+Node: Decrypt163991
1545+Node: Verify167849
1546+Node: Decrypt and Verify185705
1547+Node: Sign187709
1548+Node: Selecting Signers188273
1549+Node: Creating a Signature189425
1550+Node: Signature Notation Data194014
1551+Node: Encrypt196198
1552+Node: Encrypting a Plaintext196554
1553+Node: Run Control202400
1554+Node: Waiting For Completion203147
1555+Node: Using External Event Loops205193
1556+Node: I/O Callback Interface207160
1557+Node: Registering I/O Callbacks212254
1558+Node: I/O Callback Example214245
1559+Node: I/O Callback Example GTK+220464
1560+Node: I/O Callback Example GDK222253
1561+Node: I/O Callback Example Qt223895
1562+Node: Cancellation226183
1563+Node: UI Server Protocol228436
1564+Ref: UI Server Protocol-Footnote-1229867
1565+Node: UI Server Encrypt229986
1566+Node: UI Server Sign235246
1567+Node: UI Server Decrypt237554
1568+Node: UI Server Verify238992
1569+Node: UI Server Set Input Files242494
1570+Node: UI Server Sign/Encrypt Files243294
1571+Node: UI Server Verify/Decrypt Files245063
1572+Node: UI Server Import/Export Keys246909
1573+Node: UI Server Checksum Files247942
1574+Node: Miscellaneous UI Server Commands250108
1575+Ref: command SENDER252020
1576+Node: Debugging253696
1577+Node: Library Copying255351
1578+Node: Copying283468
1579+Node: Function and Data Index321099
1580+Node: Concept Index346851
1581 
1582 End Tag Table
1583
1584=== modified file 'doc/gpgme.info-1'
1585--- doc/gpgme.info-1 2013-05-29 18:33:42 +0000
1586+++ doc/gpgme.info-1 2013-10-23 07:14:02 +0000
1587@@ -22,8 +22,8 @@
1588
1589 This file documents the GPGME library.
1590
1591- This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
1592-Easy' Reference Manual', for Version 1.4.2.
1593+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
1594+Made Easy' Reference Manual', for Version 1.4.3.
1595
1596 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
1597 2013 g10 Code GmbH.
1598@@ -45,8 +45,8 @@
1599 Main Menu
1600 *********
1601
1602-This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
1603-Easy' Reference Manual', for Version 1.4.2 of the GPGME library.
1604+This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG Made
1605+Easy' Reference Manual', for Version 1.4.3 of the GPGME library.
1606
1607 * Menu:
1608
1609@@ -1783,6 +1783,7 @@
1610
1611 * Data Buffer I/O Operations:: I/O operations on data buffers.
1612 * Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
1613+* Data Buffer Convenience:: Convenience fucntion for data buffers.
1614
1615 
1616 File: gpgme.info, Node: Data Buffer I/O Operations, Next: Data Buffer Meta-Data, Up: Manipulating Data Buffers
1617@@ -1852,7 +1853,7 @@
1618 ? gpgme_error_from_errno (errno) : 0;
1619
1620 
1621-File: gpgme.info, Node: Data Buffer Meta-Data, Prev: Data Buffer I/O Operations, Up: Manipulating Data Buffers
1622+File: gpgme.info, Node: Data Buffer Meta-Data, Next: Data Buffer Convenience, Prev: Data Buffer I/O Operations, Up: Manipulating Data Buffers
1623
1624 6.3.2 Data Buffer Meta-Data
1625 ---------------------------
1626@@ -1930,6 +1931,61 @@
1627 data object with the handle DH to ENC.
1628
1629 
1630+File: gpgme.info, Node: Data Buffer Convenience, Prev: Data Buffer Meta-Data, Up: Manipulating Data Buffers
1631+
1632+6.3.3 Data Buffer Convenience Functions
1633+---------------------------------------
1634+
1635+ -- Data type: enum gpgme_data_type_t
1636+ The `gpgme_data_type_t' type is used to return the detected type
1637+ of the content of a data buffer.
1638+
1639+`GPGME_DATA_TYPE_INVALID'
1640+ This is returned by `gpgme_data_identify' if it was not possible
1641+ to identify the data. Reasons for this might be a non-seekable
1642+ stream or a memory problem. The value is 0.
1643+
1644+`GPGME_DATA_TYPE_UNKNOWN'
1645+ The type of the data is not known.
1646+
1647+`GPGME_DATA_TYPE_PGP_SIGNED'
1648+ The data is an OpenPGP signed message. This may be a binary
1649+ signature, a detached one or a cleartext signature.
1650+
1651+`GPGME_DATA_TYPE_PGP_OTHER'
1652+ This is a generic OpenPGP message. In most cases this will be
1653+ encrypted data.
1654+
1655+`GPGME_DATA_TYPE_PGP_KEY'
1656+ This is an OpenPGP key (private or public).
1657+
1658+`GPGME_DATA_TYPE_CMS_SIGNED'
1659+ This is a CMS signed message.
1660+
1661+`GPGME_DATA_TYPE_CMS_ENCRYPTED'
1662+ This is a CMS encrypted (enveloped data) message.
1663+
1664+`GPGME_DATA_TYPE_CMS_OTHER'
1665+ This is used for other CMS message types.
1666+
1667+`GPGME_DATA_TYPE_X509_CERT'
1668+ The data is a X.509 certificate
1669+
1670+`GPGME_DATA_TYPE_PKCS12'
1671+ The data is a PKCS#12 message. This is commonly used to exchange
1672+ private keys for X.509.
1673+
1674+ -- Function: gpgme_data_type_t gpgme_data_identify (gpgme_data_t DH)
1675+ The function `gpgme_data_identify' returns the type of the data
1676+ with the handle DH. If it is not possible to perform the
1677+ identification, the function returns zero
1678+ (`GPGME_DATA_TYPE_INVALID'). Note that depending on how the data
1679+ object has been created the identification may not be possible or
1680+ the data object may change its internal state (file pointer
1681+ moved). For file or memory based data object, the state should
1682+ not change.
1683+
1684+
1685 File: gpgme.info, Node: Contexts, Next: UI Server Protocol, Prev: Exchanging Data, Up: Top
1686
1687 7 Contexts
1688@@ -4570,6 +4626,10 @@
1689
1690 Calling this function acquires an additional reference for the key.
1691
1692+ -- Function: unsigned int gpgme_signers_count (const gpgme_ctx_t CTX)
1693+ The function `gpgme_signers_count' returns the number of signer
1694+ keys in the context CTX.
1695+
1696 -- Function: gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t CTX,
1697 int SEQ)
1698 The function `gpgme_signers_enum' returns the SEQth key in the
1699@@ -4767,9 +4827,9 @@
1700 encoding specified for CIPHER) and the text mode attributes set
1701 for the context CTX.
1702
1703- KEY must be a `NULL'-terminated array of keys. The user must keep
1704- references for all keys during the whole duration of the call (but
1705- see `gpgme_op_encrypt_start' for the requirements with the
1706+ RECP must be a `NULL'-terminated array of keys. The user must
1707+ keep references for all keys during the whole duration of the call
1708+ (but see `gpgme_op_encrypt_start' for the requirements with the
1709 asynchronous variant).
1710
1711 The value in FLAGS is a bitwise-or combination of one or multiple
1712@@ -5644,10 +5704,11 @@
1713 implement the `GETINFO pid' command. Sending this command a second
1714 time replaces the file descriptor set by the last one.
1715
1716- -- Command: OUTPUT FD=N
1717+ -- Command: OUTPUT FD=N [-binary]
1718 Set the file descriptor to be used for the output (i.e. the
1719- encrypted message) to N. For OpenPGP, the output needs to be
1720- ASCII armored; for CMS, the output needs to be Base-64 encoded.
1721+ encrypted message) to N. If the option `--binary' is given the
1722+ output shall be in binary format; if not given, the output for
1723+ OpenPGP needs to be ASCII armored and for CMS Base-64 encoded.
1724 For details on the file descriptor, see the `INPUT' command.
1725
1726 The setting of the recipients, the data source and destination may
1727@@ -5748,11 +5809,12 @@
1728 file descriptor, see the description of `INPUT' in the `ENCRYPT'
1729 section.
1730
1731- -- Command: OUTPUT FD=N
1732+ -- Command: OUTPUT FD=N [-binary]
1733 Set the file descriptor to be used for the output. The output is
1734 either the complete signed message or in case of a detached
1735- signature just that detached signature. For OpenPGP, the output
1736- needs to be ASCII armored; for CMS, the output needs to be Base-64
1737+ signature just that detached signature. If the option `--binary'
1738+ is given the output shall be in binary format; if not given, the
1739+ output for OpenPGP needs to be ASCII armored and for CMS Base-64
1740 encoded. For details on the file descriptor, see the `INPUT'
1741 command.
1742
1743
1744=== modified file 'doc/gpgme.info-2'
1745--- doc/gpgme.info-2 2013-05-29 18:33:42 +0000
1746+++ doc/gpgme.info-2 2013-10-23 07:14:02 +0000
1747@@ -22,8 +22,8 @@
1748
1749 This file documents the GPGME library.
1750
1751- This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
1752-Easy' Reference Manual', for Version 1.4.2.
1753+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
1754+Made Easy' Reference Manual', for Version 1.4.3.
1755
1756 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
1757 2013 g10 Code GmbH.
1758@@ -778,13 +778,15 @@
1759 (line 10)
1760 * DECRYPT_VERIFY_FILES: UI Server Verify/Decrypt Files.
1761 (line 12)
1762-* ENCRYPT: UI Server Encrypt. (line 46)
1763+* ENCRYPT: UI Server Encrypt. (line 47)
1764 * ENCRYPT_FILES: UI Server Sign/Encrypt Files.
1765 (line 10)
1766 * ENCRYPT_SIGN_FILES: UI Server Sign/Encrypt Files.
1767 (line 12)
1768 * enum gpgme_data_encoding_t: Data Buffer Meta-Data.
1769 (line 28)
1770+* enum gpgme_data_type_t: Data Buffer Convenience.
1771+ (line 7)
1772 * enum gpgme_event_io_t: I/O Callback Interface.
1773 (line 57)
1774 * enum gpgme_hash_algo_t: Hash Algorithms. (line 10)
1775@@ -815,6 +817,8 @@
1776 (line 69)
1777 * gpgme_data_get_file_name: Data Buffer Meta-Data.
1778 (line 7)
1779+* gpgme_data_identify: Data Buffer Convenience.
1780+ (line 46)
1781 * gpgme_data_new: Memory Based Data Buffers.
1782 (line 13)
1783 * gpgme_data_new_from_cbs: Callback Based Data Buffers.
1784@@ -852,6 +856,8 @@
1785 * gpgme_data_set_file_name: Data Buffer Meta-Data.
1786 (line 18)
1787 * gpgme_data_t: Exchanging Data. (line 14)
1788+* gpgme_data_type_t: Data Buffer Convenience.
1789+ (line 7)
1790 * gpgme_data_write: Data Buffer I/O Operations.
1791 (line 18)
1792 * gpgme_data_write_cb_t: Callback Based Data Buffers.
1793@@ -1039,7 +1045,8 @@
1794 * gpgme_signature_t: Verify. (line 92)
1795 * gpgme_signers_add: Selecting Signers. (line 15)
1796 * gpgme_signers_clear: Selecting Signers. (line 7)
1797-* gpgme_signers_enum: Selecting Signers. (line 22)
1798+* gpgme_signers_count: Selecting Signers. (line 21)
1799+* gpgme_signers_enum: Selecting Signers. (line 26)
1800 * gpgme_ssize_t: Exchanging Data. (line 31)
1801 * gpgme_strerror: Error Strings. (line 7)
1802 * gpgme_strerror_r: Error Strings. (line 17)
1803@@ -1070,21 +1077,21 @@
1804 * INPUT <3>: UI Server Sign. (line 13)
1805 * INPUT: UI Server Encrypt. (line 23)
1806 * MESSAGE: UI Server Verify. (line 11)
1807-* MICALG: UI Server Sign. (line 43)
1808+* MICALG: UI Server Sign. (line 44)
1809 * off_t (*gpgme_data_seek_cb_t) (void *HANDLE, off_t OFFSET, int WHENCE): Callback Based Data Buffers.
1810 (line 44)
1811 * OUTPUT <1>: UI Server Verify. (line 24)
1812 * OUTPUT <2>: UI Server Decrypt. (line 20)
1813 * OUTPUT <3>: UI Server Sign. (line 19)
1814 * OUTPUT: UI Server Encrypt. (line 36)
1815-* PREP_ENCRYPT: UI Server Encrypt. (line 72)
1816-* PROTOCOL: UI Server Encrypt. (line 97)
1817+* PREP_ENCRYPT: UI Server Encrypt. (line 73)
1818+* PROTOCOL: UI Server Encrypt. (line 98)
1819 * RECIPIENT: UI Server Encrypt. (line 10)
1820 * SENDER: Miscellaneous UI Server Commands.
1821 (line 51)
1822 * SESSION: Miscellaneous UI Server Commands.
1823 (line 70)
1824-* SIGN: UI Server Sign. (line 33)
1825+* SIGN: UI Server Sign. (line 34)
1826 * SIGN_FILES: UI Server Sign/Encrypt Files.
1827 (line 11)
1828 * SIGSTATUS: UI Server Verify. (line 59)
1829@@ -1174,6 +1181,8 @@
1830 * cryptographic operation, verification: Verify. (line 6)
1831 * cryptographic operation, wait for: Waiting For Completion.
1832 (line 6)
1833+* data buffer, convenience: Data Buffer Convenience.
1834+ (line 6)
1835 * data buffer, creation: Creating Data Buffers. (line 6)
1836 * data buffer, destruction: Destroying Data Buffers.
1837 (line 6)
1838@@ -1224,6 +1233,8 @@
1839 (line 6)
1840 * hash algorithms: Hash Algorithms. (line 6)
1841 * header file: Header. (line 6)
1842+* identify: Data Buffer Convenience.
1843+ (line 6)
1844 * include file: Header. (line 6)
1845 * key listing: Listing Keys. (line 6)
1846 * key listing mode: Key Listing Mode. (line 6)
1847@@ -1303,6 +1314,8 @@
1848 (line 6)
1849 * trust item, manipulation: Manipulating Trust Items.
1850 (line 6)
1851+* type of data: Data Buffer Convenience.
1852+ (line 6)
1853 * UI server: UI Server Protocol. (line 6)
1854 * user interface server: UI Server Protocol. (line 6)
1855 * verification: Verify. (line 6)
1856
1857=== modified file 'doc/gpgme.texi'
1858--- doc/gpgme.texi 2013-05-29 18:33:42 +0000
1859+++ doc/gpgme.texi 2013-10-23 07:14:02 +0000
1860@@ -1885,6 +1885,7 @@
1861 @menu
1862 * Data Buffer I/O Operations:: I/O operations on data buffers.
1863 * Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
1864+* Data Buffer Convenience:: Convenience fucntion for data buffers.
1865 @end menu
1866
1867
1868@@ -2047,6 +2048,56 @@
1869 the data object with the handle @var{dh} to @var{enc}.
1870 @end deftypefun
1871
1872+@node Data Buffer Convenience
1873+@subsection Data Buffer Convenience Functions
1874+@cindex data buffer, convenience
1875+@cindex type of data
1876+@cindex identify
1877+
1878+@deftp {Data type} {enum gpgme_data_type_t}
1879+@tindex gpgme_data_type_t
1880+The @code{gpgme_data_type_t} type is used to return the detected type
1881+of the content of a data buffer.
1882+@end deftp
1883+
1884+@table @code
1885+@item GPGME_DATA_TYPE_INVALID
1886+This is returned by @code{gpgme_data_identify} if it was not possible
1887+to identify the data. Reasons for this might be a non-seekable stream
1888+or a memory problem. The value is 0.
1889+@item GPGME_DATA_TYPE_UNKNOWN
1890+The type of the data is not known.
1891+@item GPGME_DATA_TYPE_PGP_SIGNED
1892+The data is an OpenPGP signed message. This may be a binary
1893+signature, a detached one or a cleartext signature.
1894+@item GPGME_DATA_TYPE_PGP_OTHER
1895+This is a generic OpenPGP message. In most cases this will be
1896+encrypted data.
1897+@item GPGME_DATA_TYPE_PGP_KEY
1898+This is an OpenPGP key (private or public).
1899+@item GPGME_DATA_TYPE_CMS_SIGNED
1900+This is a CMS signed message.
1901+@item GPGME_DATA_TYPE_CMS_ENCRYPTED
1902+This is a CMS encrypted (enveloped data) message.
1903+@item GPGME_DATA_TYPE_CMS_OTHER
1904+This is used for other CMS message types.
1905+@item GPGME_DATA_TYPE_X509_CERT
1906+The data is a X.509 certificate
1907+@item GPGME_DATA_TYPE_PKCS12
1908+The data is a PKCS#12 message. This is commonly used to exchange
1909+private keys for X.509.
1910+@end table
1911+
1912+@deftypefun gpgme_data_type_t gpgme_data_identify (@w{gpgme_data_t @var{dh}})
1913+The function @code{gpgme_data_identify} returns the type of the data
1914+with the handle @var{dh}. If it is not possible to perform the
1915+identification, the function returns zero
1916+(@code{GPGME_DATA_TYPE_INVALID}). Note that depending on how the data
1917+object has been created the identification may not be possible or the
1918+data object may change its internal state (file pointer moved). For
1919+file or memory based data object, the state should not change.
1920+@end deftypefun
1921+
1922
1923 @c
1924 @c Chapter Contexts
1925@@ -4785,6 +4836,11 @@
1926 Calling this function acquires an additional reference for the key.
1927 @end deftypefun
1928
1929+@deftypefun @w{unsigned int} gpgme_signers_count (@w{const gpgme_ctx_t @var{ctx}})
1930+The function @code{gpgme_signers_count} returns the number of signer keys in
1931+the context @var{ctx}.
1932+@end deftypefun
1933+
1934 @deftypefun gpgme_key_t gpgme_signers_enum (@w{const gpgme_ctx_t @var{ctx}}, @w{int @var{seq}})
1935 The function @code{gpgme_signers_enum} returns the @var{seq}th key in
1936 the list of signers in the context @var{ctx}. An additional reference
1937@@ -4988,7 +5044,7 @@
1938 that is not set, by the encoding specified for @var{cipher}) and the
1939 text mode attributes set for the context @var{ctx}.
1940
1941-@var{key} must be a @code{NULL}-terminated array of keys. The user
1942+@var{recp} must be a @code{NULL}-terminated array of keys. The user
1943 must keep references for all keys during the whole duration of the
1944 call (but see @code{gpgme_op_encrypt_start} for the requirements with
1945 the asynchronous variant).
1946
1947=== modified file 'doc/stamp-vti'
1948--- doc/stamp-vti 2013-05-29 18:33:42 +0000
1949+++ doc/stamp-vti 2013-10-23 07:14:02 +0000
1950@@ -1,4 +1,4 @@
1951-@set UPDATED 28 May 2013
1952-@set UPDATED-MONTH May 2013
1953-@set EDITION 1.4.2
1954-@set VERSION 1.4.2
1955+@set UPDATED 9 August 2013
1956+@set UPDATED-MONTH August 2013
1957+@set EDITION 1.4.3
1958+@set VERSION 1.4.3
1959
1960=== modified file 'doc/uiserver.texi'
1961--- doc/uiserver.texi 2013-05-14 20:29:20 +0000
1962+++ doc/uiserver.texi 2013-10-23 07:14:02 +0000
1963@@ -61,7 +61,7 @@
1964
1965 @deffn Command INPUT FD=@var{n}
1966 Set the file descriptor for the message to be encrypted to @var{n}. The
1967-message send to the server is binary encoded.
1968+message send to the server is binary encoded.
1969
1970 GpgOL is a Windows only program, thus @var{n} is not a libc file
1971 descriptor but a regular system handle. Given that the Assuan
1972@@ -77,14 +77,15 @@
1973 @c %Libassuan manual}, on how to do descriptor passing.
1974 @end deffn
1975
1976-@deffn Command OUTPUT FD=@var{n}
1977+@deffn Command OUTPUT FD=@var{n} [--binary]
1978 Set the file descriptor to be used for the output (i.e. the encrypted
1979-message) to @var{n}. For OpenPGP, the output needs to be ASCII armored;
1980-for CMS, the output needs to be Base-64 encoded. For details on the
1981-file descriptor, see the @code{INPUT} command.
1982+message) to @var{n}. If the option @code{--binary} is given the
1983+output shall be in binary format; if not given, the output for OpenPGP
1984+needs to be ASCII armored and for CMS Base-64 encoded. For details on
1985+the file descriptor, see the @code{INPUT} command.
1986 @end deffn
1987
1988-@noindent
1989+@noindent
1990 The setting of the recipients, the data source and destination may
1991 happen in any order, even intermixed. If this has been done the actual
1992 encryption operation is called using:
1993@@ -193,12 +194,13 @@
1994 section.
1995 @end deffn
1996
1997-@deffn Command OUTPUT FD=@var{n}
1998-Set the file descriptor to be used for the output. The output is either
1999-the complete signed message or in case of a detached signature just that
2000-detached signature. For OpenPGP, the output needs to be ASCII armored;
2001-for CMS, the output needs to be Base-64 encoded. For details on the
2002-file descriptor, see the @code{INPUT} command.
2003+@deffn Command OUTPUT FD=@var{n} [--binary]
2004+Set the file descriptor to be used for the output. The output is
2005+either the complete signed message or in case of a detached signature
2006+just that detached signature. If the option @code{--binary} is given
2007+the output shall be in binary format; if not given, the output for
2008+OpenPGP needs to be ASCII armored and for CMS Base-64 encoded. For
2009+details on the file descriptor, see the @code{INPUT} command.
2010 @end deffn
2011
2012 @noindent
2013@@ -209,7 +211,7 @@
2014 @noindent
2015 The signing operation is then initiated by:
2016
2017-@deffn Command SIGN -@w{}-protocol=@var{name} [-@w{}-detached]
2018+@deffn Command SIGN -@w{}-protocol=@var{name} [-@w{}-detached]
2019 Sign the data set with the @code{INPUT} command and write it to the sink
2020 set by OUTPUT. @var{name} is the signing protocol used for the
2021 message. For a description of the allowed protocols see the
2022@@ -272,7 +274,7 @@
2023
2024 The server needs to support the verification of opaque signatures as
2025 well as detached signatures. The kind of input sources controls what
2026-kind message is to be verified.
2027+kind message is to be verified.
2028
2029 @deffn Command MESSAGE FD=@var{n}
2030 This command is used with detached signatures to set the file descriptor
2031@@ -309,7 +311,7 @@
2032 @table @asis
2033 @item MESSAGE and INPUT
2034 This indicates a detached signature. Output data is not applicable.
2035-@item INPUT
2036+@item INPUT
2037 This indicates an opaque signature. As no output command has been given,
2038 the server is only required to check the signature.
2039 @item INPUT and OUTPUT
2040@@ -338,7 +340,7 @@
2041 The signature is valid but additional information was shown regarding the
2042 validity of the key.
2043 @item red
2044-The signature is not valid.
2045+The signature is not valid.
2046 @end table
2047
2048 @var{displaystring} is a percent-and-plus-encoded string with a short
2049@@ -539,7 +541,7 @@
2050 To allow the server to pop up the windows in the correct relation to the
2051 client, the client is advised to tell the server by sending the option:
2052
2053-@deffn {Command option} window-id @var{number}
2054+@deffn {Command option} window-id @var{number}
2055 The @var{number} represents the native window ID of the clients current
2056 window. On Windows systems this is a windows handle (@code{HWND}) and
2057 on X11 systems it is the @code{X Window ID}. The number needs to be
2058@@ -592,7 +594,7 @@
2059 which signing protocol should be preferred.
2060 @end deffn
2061
2062-@noindent
2063+@noindent
2064 To allow the UI-server to visually identify a running operation or to
2065 associate operations the server MAY support the command:
2066
2067
2068=== modified file 'doc/version.texi'
2069--- doc/version.texi 2013-05-29 18:33:42 +0000
2070+++ doc/version.texi 2013-10-23 07:14:02 +0000
2071@@ -1,4 +1,4 @@
2072-@set UPDATED 28 May 2013
2073-@set UPDATED-MONTH May 2013
2074-@set EDITION 1.4.2
2075-@set VERSION 1.4.2
2076+@set UPDATED 9 August 2013
2077+@set UPDATED-MONTH August 2013
2078+@set EDITION 1.4.3
2079+@set VERSION 1.4.3
2080
2081=== modified file 'gpgme.spec'
2082--- gpgme.spec 2013-05-29 18:33:42 +0000
2083+++ gpgme.spec 2013-10-23 07:14:02 +0000
2084@@ -1,7 +1,7 @@
2085 # This is a template. The dist target uses it to create the real file.
2086 Summary: GPGME - GnuPG Made Easy
2087 Name: gpgme
2088-Version: 1.4.2
2089+Version: 1.4.3
2090 Release: 1
2091 URL: http://www.gnupg.org/gpgme.html
2092 Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
2093
2094=== modified file 'lang/cl/gpgme.asd'
2095--- lang/cl/gpgme.asd 2013-05-29 18:33:42 +0000
2096+++ lang/cl/gpgme.asd 2013-10-23 07:14:02 +0000
2097@@ -27,7 +27,7 @@
2098 (defsystem gpgme
2099 :description "GnuPG Made Easy."
2100 :author "g10 Code GmbH"
2101- :version "1.4.2"
2102+ :version "1.4.3"
2103 :licence "GPL"
2104 :depends-on ("cffi" "gpg-error")
2105 :components ((:file "gpgme-package")
2106
2107=== modified file 'src/Makefile.am'
2108--- src/Makefile.am 2013-05-29 18:33:42 +0000
2109+++ src/Makefile.am 2013-10-23 07:14:02 +0000
2110@@ -103,8 +103,9 @@
2111 # unresolved symbols to the thread module.
2112 main_sources = \
2113 util.h conversion.c get-env.c context.h ops.h \
2114+ parsetlv.c parsetlv.h \
2115 data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
2116- data-compat.c \
2117+ data-compat.c data-identify.c \
2118 signers.c sig-notation.c \
2119 wait.c wait-global.c wait-private.c wait-user.c wait.h \
2120 op-support.c \
2121@@ -118,7 +119,7 @@
2122 $(uiserver_components) \
2123 $(g13_components) vfs-mount.c vfs-create.c \
2124 gpgconf.c \
2125- sema.h priv-io.h $(system_components) dirinfo.c \
2126+ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \
2127 debug.c debug.h gpgme.c version.c error.c
2128
2129 libgpgme_la_SOURCES = $(main_sources) \
2130
2131=== modified file 'src/Makefile.in'
2132--- src/Makefile.in 2013-05-29 18:33:42 +0000
2133+++ src/Makefile.in 2013-10-23 07:14:02 +0000
2134@@ -128,20 +128,21 @@
2135 LTLIBRARIES = $(lib_LTLIBRARIES)
2136 @HAVE_W32_SYSTEM_TRUE@am__DEPENDENCIES_1 = versioninfo.lo
2137 am__libgpgme_glib_la_SOURCES_DIST = util.h conversion.c get-env.c \
2138- context.h ops.h data.h data.c data-fd.c data-stream.c \
2139- data-mem.c data-user.c data-compat.c signers.c sig-notation.c \
2140- wait.c wait-global.c wait-private.c wait-user.c wait.h \
2141- op-support.c encrypt.c encrypt-sign.c decrypt.c \
2142- decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \
2143- keylist.c trust-item.c trustlist.c import.c export.c genkey.c \
2144- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
2145- engine-backend.h engine.c engine-gpg.c status-table.c \
2146- engine-gpgsm.c assuan-support.c engine-assuan.c \
2147- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
2148- vfs-create.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
2149- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
2150- w32-sema.c dirinfo.c debug.c debug.h gpgme.c version.c error.c \
2151- ath.c w32-glib-io.c
2152+ context.h ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
2153+ data-stream.c data-mem.c data-user.c data-compat.c \
2154+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
2155+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
2156+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
2157+ passphrase.c progress.c key.c keylist.c trust-item.c \
2158+ trustlist.c import.c export.c genkey.c delete.c edit.c \
2159+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
2160+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
2161+ assuan-support.c engine-assuan.c engine-gpgconf.c \
2162+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
2163+ gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
2164+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
2165+ dirinfo.c debug.c debug.h gpgme.c version.c error.c ath.c \
2166+ w32-glib-io.c
2167 @HAVE_GPGSM_TRUE@am__objects_1 = engine-gpgsm.lo
2168 @HAVE_ASSUAN_TRUE@am__objects_2 = assuan-support.lo engine-assuan.lo
2169 @HAVE_GPGCONF_TRUE@am__objects_3 = engine-gpgconf.lo
2170@@ -152,18 +153,19 @@
2171 @HAVE_DOSISH_SYSTEM_FALSE@ posix-io.lo $(am__objects_6)
2172 @HAVE_DOSISH_SYSTEM_TRUE@am__objects_7 = w32-util.lo w32-sema.lo \
2173 @HAVE_DOSISH_SYSTEM_TRUE@ $(am__objects_6)
2174-am__objects_8 = conversion.lo get-env.lo data.lo data-fd.lo \
2175- data-stream.lo data-mem.lo data-user.lo data-compat.lo \
2176- signers.lo sig-notation.lo wait.lo wait-global.lo \
2177- wait-private.lo wait-user.lo op-support.lo encrypt.lo \
2178- encrypt-sign.lo decrypt.lo decrypt-verify.lo verify.lo sign.lo \
2179- passphrase.lo progress.lo key.lo keylist.lo trust-item.lo \
2180- trustlist.lo import.lo export.lo genkey.lo delete.lo edit.lo \
2181- getauditlog.lo opassuan.lo passwd.lo engine.lo engine-gpg.lo \
2182- status-table.lo $(am__objects_1) $(am__objects_2) \
2183- $(am__objects_3) $(am__objects_4) $(am__objects_5) \
2184- vfs-mount.lo vfs-create.lo gpgconf.lo $(am__objects_7) \
2185- dirinfo.lo debug.lo gpgme.lo version.lo error.lo
2186+am__objects_8 = conversion.lo get-env.lo parsetlv.lo data.lo \
2187+ data-fd.lo data-stream.lo data-mem.lo data-user.lo \
2188+ data-compat.lo data-identify.lo signers.lo sig-notation.lo \
2189+ wait.lo wait-global.lo wait-private.lo wait-user.lo \
2190+ op-support.lo encrypt.lo encrypt-sign.lo decrypt.lo \
2191+ decrypt-verify.lo verify.lo sign.lo passphrase.lo progress.lo \
2192+ key.lo keylist.lo trust-item.lo trustlist.lo import.lo \
2193+ export.lo genkey.lo delete.lo edit.lo getauditlog.lo \
2194+ opassuan.lo passwd.lo engine.lo engine-gpg.lo status-table.lo \
2195+ $(am__objects_1) $(am__objects_2) $(am__objects_3) \
2196+ $(am__objects_4) $(am__objects_5) vfs-mount.lo vfs-create.lo \
2197+ gpgconf.lo $(am__objects_7) dirinfo.lo debug.lo gpgme.lo \
2198+ version.lo error.lo
2199 @BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_OBJECTS = $(am__objects_8) \
2200 @BUILD_W32_GLIB_TRUE@ ath.lo w32-glib-io.lo
2201 libgpgme_glib_la_OBJECTS = $(am_libgpgme_glib_la_OBJECTS)
2202@@ -172,19 +174,20 @@
2203 $(libgpgme_glib_la_LDFLAGS) $(LDFLAGS) -o $@
2204 @BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_rpath = -rpath $(libdir)
2205 am__libgpgme_pthread_la_SOURCES_DIST = util.h conversion.c get-env.c \
2206- context.h ops.h data.h data.c data-fd.c data-stream.c \
2207- data-mem.c data-user.c data-compat.c signers.c sig-notation.c \
2208- wait.c wait-global.c wait-private.c wait-user.c wait.h \
2209- op-support.c encrypt.c encrypt-sign.c decrypt.c \
2210- decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \
2211- keylist.c trust-item.c trustlist.c import.c export.c genkey.c \
2212- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
2213- engine-backend.h engine.c engine-gpg.c status-table.c \
2214- engine-gpgsm.c assuan-support.c engine-assuan.c \
2215- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
2216- vfs-create.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
2217- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
2218- w32-sema.c dirinfo.c debug.c debug.h gpgme.c version.c error.c \
2219+ context.h ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
2220+ data-stream.c data-mem.c data-user.c data-compat.c \
2221+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
2222+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
2223+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
2224+ passphrase.c progress.c key.c keylist.c trust-item.c \
2225+ trustlist.c import.c export.c genkey.c delete.c edit.c \
2226+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
2227+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
2228+ assuan-support.c engine-assuan.c engine-gpgconf.c \
2229+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
2230+ gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
2231+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
2232+ dirinfo.c debug.c debug.h gpgme.c version.c error.c \
2233 ath-pthread.c w32-io.c
2234 @HAVE_DOSISH_SYSTEM_TRUE@am__objects_9 = w32-io.lo
2235 am_libgpgme_pthread_la_OBJECTS = $(am__objects_8) ath-pthread.lo \
2236@@ -195,20 +198,21 @@
2237 $(libgpgme_pthread_la_LDFLAGS) $(LDFLAGS) -o $@
2238 @HAVE_PTHREAD_TRUE@am_libgpgme_pthread_la_rpath = -rpath $(libdir)
2239 am__libgpgme_qt_la_SOURCES_DIST = util.h conversion.c get-env.c \
2240- context.h ops.h data.h data.c data-fd.c data-stream.c \
2241- data-mem.c data-user.c data-compat.c signers.c sig-notation.c \
2242- wait.c wait-global.c wait-private.c wait-user.c wait.h \
2243- op-support.c encrypt.c encrypt-sign.c decrypt.c \
2244- decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \
2245- keylist.c trust-item.c trustlist.c import.c export.c genkey.c \
2246- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
2247- engine-backend.h engine.c engine-gpg.c status-table.c \
2248- engine-gpgsm.c assuan-support.c engine-assuan.c \
2249- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
2250- vfs-create.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
2251- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
2252- w32-sema.c dirinfo.c debug.c debug.h gpgme.c version.c error.c \
2253- ath.c w32-qt-io.cpp kdpipeiodevice.h kdpipeiodevice.cpp \
2254+ context.h ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
2255+ data-stream.c data-mem.c data-user.c data-compat.c \
2256+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
2257+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
2258+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
2259+ passphrase.c progress.c key.c keylist.c trust-item.c \
2260+ trustlist.c import.c export.c genkey.c delete.c edit.c \
2261+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
2262+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
2263+ assuan-support.c engine-assuan.c engine-gpgconf.c \
2264+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
2265+ gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
2266+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
2267+ dirinfo.c debug.c debug.h gpgme.c version.c error.c ath.c \
2268+ w32-qt-io.cpp kdpipeiodevice.h kdpipeiodevice.cpp \
2269 kdpipeiodevice.moc
2270 @BUILD_W32_QT_TRUE@am_libgpgme_qt_la_OBJECTS = $(am__objects_8) ath.lo \
2271 @BUILD_W32_QT_TRUE@ w32-qt-io.lo kdpipeiodevice.lo
2272@@ -218,19 +222,21 @@
2273 $(CXXFLAGS) $(libgpgme_qt_la_LDFLAGS) $(LDFLAGS) -o $@
2274 @BUILD_W32_QT_TRUE@am_libgpgme_qt_la_rpath = -rpath $(libdir)
2275 am__libgpgme_la_SOURCES_DIST = util.h conversion.c get-env.c context.h \
2276- ops.h data.h data.c data-fd.c data-stream.c data-mem.c \
2277- data-user.c data-compat.c signers.c sig-notation.c wait.c \
2278- wait-global.c wait-private.c wait-user.c wait.h op-support.c \
2279- encrypt.c encrypt-sign.c decrypt.c decrypt-verify.c verify.c \
2280- sign.c passphrase.c progress.c key.c keylist.c trust-item.c \
2281+ ops.h parsetlv.c parsetlv.h data.h data.c data-fd.c \
2282+ data-stream.c data-mem.c data-user.c data-compat.c \
2283+ data-identify.c signers.c sig-notation.c wait.c wait-global.c \
2284+ wait-private.c wait-user.c wait.h op-support.c encrypt.c \
2285+ encrypt-sign.c decrypt.c decrypt-verify.c verify.c sign.c \
2286+ passphrase.c progress.c key.c keylist.c trust-item.c \
2287 trustlist.c import.c export.c genkey.c delete.c edit.c \
2288 getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
2289 engine.c engine-gpg.c status-table.c engine-gpgsm.c \
2290 assuan-support.c engine-assuan.c engine-gpgconf.c \
2291 engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
2292 gpgconf.c sema.h priv-io.h ath.h posix-util.c posix-sema.c \
2293- posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c dirinfo.c \
2294- debug.c debug.h gpgme.c version.c error.c ath.c w32-io.c
2295+ posix-io.c w32-ce.h w32-ce.c w32-util.c w32-sema.c sys-util.h \
2296+ dirinfo.c debug.c debug.h gpgme.c version.c error.c ath.c \
2297+ w32-io.c
2298 am_libgpgme_la_OBJECTS = $(am__objects_8) ath.lo $(am__objects_9)
2299 libgpgme_la_OBJECTS = $(am_libgpgme_la_OBJECTS)
2300 libgpgme_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
2301@@ -485,8 +491,9 @@
2302 # unresolved symbols to the thread module.
2303 main_sources = \
2304 util.h conversion.c get-env.c context.h ops.h \
2305+ parsetlv.c parsetlv.h \
2306 data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
2307- data-compat.c \
2308+ data-compat.c data-identify.c \
2309 signers.c sig-notation.c \
2310 wait.c wait-global.c wait-private.c wait-user.c wait.h \
2311 op-support.c \
2312@@ -500,7 +507,7 @@
2313 $(uiserver_components) \
2314 $(g13_components) vfs-mount.c vfs-create.c \
2315 gpgconf.c \
2316- sema.h priv-io.h $(system_components) dirinfo.c \
2317+ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \
2318 debug.c debug.h gpgme.c version.c error.c
2319
2320 libgpgme_la_SOURCES = $(main_sources) \
2321@@ -766,6 +773,7 @@
2322 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversion.Plo@am__quote@
2323 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-compat.Plo@am__quote@
2324 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-fd.Plo@am__quote@
2325+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-identify.Plo@am__quote@
2326 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-mem.Plo@am__quote@
2327 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-stream.Plo@am__quote@
2328 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-user.Plo@am__quote@
2329@@ -800,6 +808,7 @@
2330 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keylist.Plo@am__quote@
2331 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op-support.Plo@am__quote@
2332 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opassuan.Plo@am__quote@
2333+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsetlv.Plo@am__quote@
2334 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passphrase.Plo@am__quote@
2335 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Plo@am__quote@
2336 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-io.Plo@am__quote@
2337
2338=== added file 'src/data-identify.c'
2339--- src/data-identify.c 1970-01-01 00:00:00 +0000
2340+++ src/data-identify.c 2013-10-23 07:14:02 +0000
2341@@ -0,0 +1,247 @@
2342+/* data-identify.c - Try to identify the data
2343+ Copyright (C) 2013 g10 Code GmbH
2344+
2345+ This file is part of GPGME.
2346+
2347+ GPGME is free software; you can redistribute it and/or modify it
2348+ under the terms of the GNU Lesser General Public License as
2349+ published by the Free Software Foundation; either version 2.1 of
2350+ the License, or (at your option) any later version.
2351+
2352+ GPGME is distributed in the hope that it will be useful, but
2353+ WITHOUT ANY WARRANTY; without even the implied warranty of
2354+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2355+ Lesser General Public License for more details.
2356+
2357+ You should have received a copy of the GNU Lesser General Public
2358+ License along with this program; if not, see <http://www.gnu.org/licenses/>.
2359+ */
2360+
2361+#if HAVE_CONFIG_H
2362+# include <config.h>
2363+#endif
2364+
2365+#include <stdlib.h>
2366+#include <string.h>
2367+
2368+#include "gpgme.h"
2369+#include "data.h"
2370+#include "util.h"
2371+#include "parsetlv.h"
2372+
2373+/* The size of the sample data we take for detection. */
2374+#define SAMPLE_SIZE 2048
2375+
2376+
2377+
2378+/* Note that DATA may be binary but a final nul is required so that
2379+ string operations will find a terminator.
2380+
2381+ Returns: GPGME_DATA_TYPE_xxxx */
2382+static gpgme_data_type_t
2383+basic_detection (const char *data, size_t datalen)
2384+{
2385+ tlvinfo_t ti;
2386+ const char *s;
2387+ size_t n;
2388+ int maybe_p12 = 0;
2389+
2390+ if (datalen < 24) /* Object is probably too short for detection. */
2391+ return GPGME_DATA_TYPE_UNKNOWN;
2392+
2393+ /* This is a common example of a CMS object - it is obvious that we
2394+ only need to read a few bytes to get to the OID:
2395+ 30 82 0B 59 06 09 2A 86 48 86 F7 0D 01 07 02 A0 82 0B 4A 30 82 0B 46 02
2396+ ----------- ++++++++++++++++++++++++++++++++
2397+ SEQUENCE OID (signedData)
2398+ (2 byte len)
2399+
2400+ A PKCS#12 message is:
2401+
2402+ 30 82 08 59 02 01 03 30 82 08 1F 06 09 2A 86 48 86 F7 0D 01 07 01 A0 82
2403+ ----------- ++++++++ ----------- ++++++++++++++++++++++++++++++++
2404+ SEQUENCE INTEGER SEQUENCE OID (data)
2405+
2406+ A X.509 certificate is:
2407+
2408+ 30 82 05 B8 30 82 04 A0 A0 03 02 01 02 02 07 15 46 A0 BF 30 07 39 30 0D
2409+ ----------- +++++++++++ ----- ++++++++ --------------------------
2410+ SEQUENCE SEQUENCE [0] INTEGER INTEGER SEQU
2411+ (tbs) (version) (s/n) (Algo)
2412+
2413+ Thus we need to read at least 22 bytes, we add 2 bytes to cope with
2414+ length headers stored with 4 bytes.
2415+ */
2416+
2417+
2418+ s = data;
2419+ n = datalen;
2420+
2421+ if (parse_tlv (&s, &n, &ti))
2422+ goto try_pgp; /* Not properly BER encoded. */
2423+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
2424+ && ti.is_cons))
2425+ goto try_pgp; /* A CMS object always starts with a sequence. */
2426+
2427+ if (parse_tlv (&s, &n, &ti))
2428+ goto try_pgp; /* Not properly BER encoded. */
2429+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
2430+ && ti.is_cons && n >= ti.length)
2431+ {
2432+ if (parse_tlv (&s, &n, &ti))
2433+ goto try_pgp;
2434+ if (!(ti.cls == ASN1_CLASS_CONTEXT && ti.tag == 0
2435+ && ti.is_cons && ti.length == 3 && n >= ti.length))
2436+ goto try_pgp;
2437+
2438+ if (parse_tlv (&s, &n, &ti))
2439+ goto try_pgp;
2440+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
2441+ && !ti.is_cons && ti.length == 1 && n && (*s == 1 || *s == 2)))
2442+ goto try_pgp;
2443+ s++;
2444+ n--;
2445+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
2446+ && !ti.is_cons))
2447+ goto try_pgp;
2448+ /* Because the now following S/N may be larger than the sample
2449+ data we have, we stop parsing here and don't check for the
2450+ algorithm ID. */
2451+ return GPGME_DATA_TYPE_X509_CERT;
2452+ }
2453+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
2454+ && !ti.is_cons && ti.length == 1 && n && *s == 3)
2455+ {
2456+ maybe_p12 = 1;
2457+ s++;
2458+ n--;
2459+ if (parse_tlv (&s, &n, &ti))
2460+ goto try_pgp;
2461+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
2462+ && ti.is_cons))
2463+ goto try_pgp;
2464+ if (parse_tlv (&s, &n, &ti))
2465+ goto try_pgp;
2466+ }
2467+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_OBJECT_ID
2468+ && !ti.is_cons && ti.length && n >= ti.length)
2469+ {
2470+ if (ti.length == 9)
2471+ {
2472+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x01", 9))
2473+ {
2474+ /* Data. */
2475+ return (maybe_p12 ? GPGME_DATA_TYPE_PKCS12
2476+ /* */ : GPGME_DATA_TYPE_CMS_OTHER);
2477+ }
2478+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02", 9))
2479+ {
2480+ /* Signed Data. */
2481+ return (maybe_p12 ? GPGME_DATA_TYPE_PKCS12
2482+ /* */ : GPGME_DATA_TYPE_CMS_SIGNED);
2483+ }
2484+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x03", 9))
2485+ return GPGME_DATA_TYPE_CMS_ENCRYPTED; /* Enveloped Data. */
2486+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x05", 9))
2487+ return GPGME_DATA_TYPE_CMS_OTHER; /* Digested Data. */
2488+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x06", 9))
2489+ return GPGME_DATA_TYPE_CMS_OTHER; /* Encrypted Data. */
2490+ }
2491+ else if (ti.length == 11)
2492+ {
2493+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x10\x01\x02", 11))
2494+ return GPGME_DATA_TYPE_CMS_OTHER; /* Auth Data. */
2495+ }
2496+ }
2497+
2498+
2499+ try_pgp:
2500+ /* Check whether this might be a non-armored PGP message. We need
2501+ to do this before checking for armor lines, so that we don't get
2502+ fooled by armored messages inside a signed binary PGP message. */
2503+ if ((data[0] & 0x80))
2504+ {
2505+ /* That might be a binary PGP message. At least it is not plain
2506+ ASCII. Of course this might be certain lead-in text of
2507+ armored CMS messages. However, I am not sure whether this is
2508+ at all defined and in any case it is uncommon. Thus we don't
2509+ do any further plausibility checks but stupidly assume no CMS
2510+ armored data will follow. */
2511+ return GPGME_DATA_TYPE_UNKNOWN;
2512+ }
2513+
2514+ /* Now check whether there are armor lines. */
2515+ for (s = data; s && *s; s = (*s=='\n')?(s+1):((s=strchr (s,'\n'))?(s+1):s))
2516+ {
2517+ if (!strncmp (s, "-----BEGIN ", 11))
2518+ {
2519+ if (!strncmp (s+11, "SIGNED ", 7))
2520+ return GPGME_DATA_TYPE_CMS_SIGNED;
2521+ if (!strncmp (s+11, "ENCRYPTED ", 10))
2522+ return GPGME_DATA_TYPE_CMS_ENCRYPTED;
2523+ if (!strncmp (s+11, "PGP ", 4))
2524+ {
2525+ if (!strncmp (s+15, "SIGNATURE", 9))
2526+ return GPGME_DATA_TYPE_PGP_SIGNED;
2527+ if (!strncmp (s+15, "SIGNED MESSAGE", 14))
2528+ return GPGME_DATA_TYPE_PGP_SIGNED;
2529+ if (!strncmp (s+15, "PUBLIC KEY BLOCK", 16))
2530+ return GPGME_DATA_TYPE_PGP_KEY;
2531+ if (!strncmp (s+15, "PRIVATE KEY BLOCK", 17))
2532+ return GPGME_DATA_TYPE_PGP_KEY;
2533+ if (!strncmp (s+15, "SECRET KEY BLOCK", 16))
2534+ return GPGME_DATA_TYPE_PGP_KEY;
2535+ if (!strncmp (s+15, "ARMORED FILE", 12))
2536+ return GPGME_DATA_TYPE_UNKNOWN;
2537+ return GPGME_DATA_TYPE_PGP_OTHER; /* PGP MESSAGE */
2538+ }
2539+ if (!strncmp (s+11, "CERTIFICATE", 11))
2540+ return GPGME_DATA_TYPE_X509_CERT;
2541+ if (!strncmp (s+11, "PKCS12", 6))
2542+ return GPGME_DATA_TYPE_PKCS12;
2543+ return GPGME_DATA_TYPE_CMS_OTHER; /* Not PGP, thus we assume CMS. */
2544+ }
2545+ }
2546+
2547+ return GPGME_DATA_TYPE_UNKNOWN;
2548+}
2549+
2550+
2551+/* Try to detect the type of the data. Note that this function works
2552+ only on seekable data objects. The function tries to reset the
2553+ file pointer but there is no guarantee that it will work.
2554+
2555+ FIXME: We may want to add internal buffering so that this function
2556+ can be implemented for allmost all kind of data objects.
2557+ */
2558+gpgme_data_type_t
2559+gpgme_data_identify (gpgme_data_t dh, int reserved)
2560+{
2561+ gpgme_data_type_t result;
2562+ char *sample;
2563+ int n;
2564+ gpgme_off_t off;
2565+
2566+ /* Check whether we can seek the data object. */
2567+ off = gpgme_data_seek (dh, 0, SEEK_CUR);
2568+ if (off == (gpgme_off_t)(-1))
2569+ return GPGME_DATA_TYPE_INVALID;
2570+
2571+ /* Allocate a buffer and read the data. */
2572+ sample = malloc (SAMPLE_SIZE);
2573+ if (!sample)
2574+ return GPGME_DATA_TYPE_INVALID; /* Ooops. */
2575+ n = gpgme_data_read (dh, sample, SAMPLE_SIZE - 1);
2576+ if (n < 0)
2577+ {
2578+ free (sample);
2579+ return GPGME_DATA_TYPE_INVALID; /* Ooops. */
2580+ }
2581+ sample[n] = 0; /* (Required for our string functions.) */
2582+
2583+ result = basic_detection (sample, n);
2584+ free (sample);
2585+ gpgme_data_seek (dh, off, SEEK_SET);
2586+
2587+ return result;
2588+}
2589
2590=== modified file 'src/dirinfo.c'
2591--- src/dirinfo.c 2013-05-14 20:29:20 +0000
2592+++ src/dirinfo.c 2013-10-23 07:14:02 +0000
2593@@ -1,5 +1,5 @@
2594 /* dirinfo.c - Get directory information
2595- * Copyright (C) 2009 g10 Code GmbH
2596+ * Copyright (C) 2009, 2013 g10 Code GmbH
2597 *
2598 * This file is part of GPGME.
2599 *
2600@@ -29,6 +29,7 @@
2601 #include "priv-io.h"
2602 #include "debug.h"
2603 #include "sema.h"
2604+#include "sys-util.h"
2605
2606 DEFINE_STATIC_LOCK (dirinfo_lock);
2607
2608@@ -36,7 +37,11 @@
2609 enum
2610 {
2611 WANT_HOMEDIR,
2612- WANT_AGENT_SOCKET
2613+ WANT_AGENT_SOCKET,
2614+ WANT_GPG_NAME,
2615+ WANT_GPGSM_NAME,
2616+ WANT_G13_NAME,
2617+ WANT_UISRV_SOCKET
2618 };
2619
2620 /* Values retrieved via gpgconf and cached here. */
2621@@ -44,13 +49,18 @@
2622 int valid; /* Cached information is valid. */
2623 char *homedir;
2624 char *agent_socket;
2625+ char *gpg_name;
2626+ char *gpgsm_name;
2627+ char *g13_name;
2628+ char *uisrv_socket;
2629 } dirinfo;
2630
2631
2632 /* Parse the output of "gpgconf --list-dirs". This function expects
2633- that DIRINFO_LOCK is held by the caller. */
2634+ that DIRINFO_LOCK is held by the caller. If COMPONENTS is set, the
2635+ output of --list-components is expected. */
2636 static void
2637-parse_output (char *line)
2638+parse_output (char *line, int components)
2639 {
2640 char *value, *p;
2641
2642@@ -58,6 +68,14 @@
2643 if (!value)
2644 return;
2645 *value++ = 0;
2646+ if (components)
2647+ {
2648+ /* Skip the second field. */
2649+ value = strchr (value, ':');
2650+ if (!value)
2651+ return;
2652+ *value++ = 0;
2653+ }
2654 p = strchr (value, ':');
2655 if (p)
2656 *p = 0;
2657@@ -66,19 +84,45 @@
2658 if (!*value)
2659 return;
2660
2661- if (!strcmp (line, "homedir") && !dirinfo.homedir)
2662- dirinfo.homedir = strdup (value);
2663- else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
2664- dirinfo.agent_socket = strdup (value);
2665+ if (components)
2666+ {
2667+ if (!strcmp (line, "gpg") && !dirinfo.gpg_name)
2668+ dirinfo.gpg_name = strdup (value);
2669+ else if (!strcmp (line, "gpgsm") && !dirinfo.gpgsm_name)
2670+ dirinfo.gpgsm_name = strdup (value);
2671+ else if (!strcmp (line, "g13") && !dirinfo.g13_name)
2672+ dirinfo.g13_name = strdup (value);
2673+ }
2674+ else
2675+ {
2676+ if (!strcmp (line, "homedir") && !dirinfo.homedir)
2677+ {
2678+ const char name[] = "S.uiserver";
2679+
2680+ dirinfo.homedir = strdup (value);
2681+ if (dirinfo.homedir)
2682+ {
2683+ dirinfo.uisrv_socket = malloc (strlen (dirinfo
2684+ .homedir)
2685+ + 1 + strlen (name) + 1);
2686+ if (dirinfo.uisrv_socket)
2687+ strcpy (stpcpy (stpcpy (dirinfo.uisrv_socket, dirinfo.homedir),
2688+ DIRSEP_S), name);
2689+ }
2690+ }
2691+ else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
2692+ dirinfo.agent_socket = strdup (value);
2693+ }
2694 }
2695
2696
2697 /* Read the directory information from gpgconf. This function expects
2698- that DIRINFO_LOCK is held by the caller. */
2699+ that DIRINFO_LOCK is held by the caller. PGNAME is the name of the
2700+ gpgconf binary. If COMPONENTS is set, not the directories bit the
2701+ name of the componeNts are read. */
2702 static void
2703-read_gpgconf_dirs (void)
2704+read_gpgconf_dirs (const char *pgmname, int components)
2705 {
2706- const char *pgmname;
2707 char linebuf[1024] = {0};
2708 int linelen = 0;
2709 char * argv[3];
2710@@ -89,12 +133,8 @@
2711 int nread;
2712 char *mark = NULL;
2713
2714- pgmname = _gpgme_get_gpgconf_path ();
2715- if (!pgmname)
2716- return; /* No way. */
2717-
2718 argv[0] = (char *)pgmname;
2719- argv[1] = "--list-dirs";
2720+ argv[1] = components? "--list-components" : "--list-dirs";
2721 argv[2] = NULL;
2722
2723 if (_gpgme_io_pipe (rp, 1) < 0)
2724@@ -132,7 +172,7 @@
2725 else
2726 mark[0] = '\0';
2727
2728- parse_output (line);
2729+ parse_output (line, components);
2730 }
2731
2732 nused = lastmark? (lastmark + 1 - linebuf) : 0;
2733@@ -147,14 +187,38 @@
2734
2735
2736 static const char *
2737-get_gpgconf_dir (int what)
2738+get_gpgconf_item (int what)
2739 {
2740 const char *result = NULL;
2741
2742 LOCK (dirinfo_lock);
2743 if (!dirinfo.valid)
2744 {
2745- read_gpgconf_dirs ();
2746+ const char *pgmname;
2747+
2748+ pgmname = _gpgme_get_gpgconf_path ();
2749+ if (pgmname && access (pgmname, F_OK))
2750+ {
2751+ _gpgme_debug (DEBUG_INIT,
2752+ "gpgme_dinfo: gpgconf='%s' [not installed]\n", pgmname);
2753+ pgmname = NULL; /* Not available. */
2754+ }
2755+ else
2756+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgconf='%s'\n",
2757+ pgmname? pgmname : "[null]");
2758+ if (!pgmname)
2759+ {
2760+ /* Probably gpgconf is not installed. Assume we are using
2761+ GnuPG-1. */
2762+ pgmname = _gpgme_get_gpg_path ();
2763+ if (pgmname)
2764+ dirinfo.gpg_name = strdup (pgmname);
2765+ }
2766+ else
2767+ {
2768+ read_gpgconf_dirs (pgmname, 0);
2769+ read_gpgconf_dirs (pgmname, 1);
2770+ }
2771 /* Even if the reading of the directories failed (e.g. due to an
2772 too old version gpgconf or no gpgconf at all), we need to
2773 mark the entries as valid so that we won't try over and over
2774@@ -162,11 +226,33 @@
2775 the read values later because they are practically statically
2776 allocated. */
2777 dirinfo.valid = 1;
2778+ if (dirinfo.gpg_name)
2779+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpg='%s'\n",
2780+ dirinfo.gpg_name);
2781+ if (dirinfo.g13_name)
2782+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: g13='%s'\n",
2783+ dirinfo.g13_name);
2784+ if (dirinfo.gpgsm_name)
2785+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgsm='%s'\n",
2786+ dirinfo.gpgsm_name);
2787+ if (dirinfo.homedir)
2788+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: homedir='%s'\n",
2789+ dirinfo.homedir);
2790+ if (dirinfo.agent_socket)
2791+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: agent='%s'\n",
2792+ dirinfo.agent_socket);
2793+ if (dirinfo.uisrv_socket)
2794+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: uisrv='%s'\n",
2795+ dirinfo.uisrv_socket);
2796 }
2797 switch (what)
2798 {
2799 case WANT_HOMEDIR: result = dirinfo.homedir; break;
2800 case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break;
2801+ case WANT_GPG_NAME: result = dirinfo.gpg_name; break;
2802+ case WANT_GPGSM_NAME: result = dirinfo.gpgsm_name; break;
2803+ case WANT_G13_NAME: result = dirinfo.g13_name; break;
2804+ case WANT_UISRV_SOCKET: result = dirinfo.uisrv_socket; break;
2805 }
2806 UNLOCK (dirinfo_lock);
2807 return result;
2808@@ -177,13 +263,51 @@
2809 const char *
2810 _gpgme_get_default_homedir (void)
2811 {
2812- return get_gpgconf_dir (WANT_HOMEDIR);
2813+ return get_gpgconf_item (WANT_HOMEDIR);
2814 }
2815
2816 /* Return the default gpg-agent socket name. Returns NULL if not known. */
2817 const char *
2818 _gpgme_get_default_agent_socket (void)
2819 {
2820- return get_gpgconf_dir (WANT_AGENT_SOCKET);
2821-}
2822-
2823+ return get_gpgconf_item (WANT_AGENT_SOCKET);
2824+}
2825+
2826+/* Return the default gpg file name. Returns NULL if not known. */
2827+const char *
2828+_gpgme_get_default_gpg_name (void)
2829+{
2830+ return get_gpgconf_item (WANT_GPG_NAME);
2831+}
2832+
2833+/* Return the default gpgsm file name. Returns NULL if not known. */
2834+const char *
2835+_gpgme_get_default_gpgsm_name (void)
2836+{
2837+ return get_gpgconf_item (WANT_GPGSM_NAME);
2838+}
2839+
2840+/* Return the default g13 file name. Returns NULL if not known. */
2841+const char *
2842+_gpgme_get_default_g13_name (void)
2843+{
2844+ return get_gpgconf_item (WANT_G13_NAME);
2845+}
2846+
2847+/* Return the default gpgconf file name. Returns NULL if not known.
2848+ Because gpgconf is the binary used to retrieved all these default
2849+ names, this function is merely a simple wrapper around the function
2850+ used to locate this binary. */
2851+const char *
2852+_gpgme_get_default_gpgconf_name (void)
2853+{
2854+ return _gpgme_get_gpgconf_path ();
2855+}
2856+
2857+/* Return the default UI-server socket name. Returns NULL if not
2858+ known. */
2859+const char *
2860+_gpgme_get_default_uisrv_socket (void)
2861+{
2862+ return get_gpgconf_item (WANT_UISRV_SOCKET);
2863+}
2864
2865=== modified file 'src/engine-g13.c'
2866--- src/engine-g13.c 2013-05-14 20:29:20 +0000
2867+++ src/engine-g13.c 2013-10-23 07:14:02 +0000
2868@@ -100,7 +100,7 @@
2869 g13_get_version (const char *file_name)
2870 {
2871 return _gpgme_get_program_version (file_name ? file_name
2872- : _gpgme_get_g13_path ());
2873+ : _gpgme_get_default_g13_name ());
2874 }
2875
2876
2877@@ -251,11 +251,11 @@
2878
2879 #if USE_DESCRIPTOR_PASSING
2880 err = assuan_pipe_connect
2881- (g13->assuan_ctx, file_name ? file_name : _gpgme_get_g13_path (),
2882+ (g13->assuan_ctx, file_name ? file_name : _gpgme_get_default_g13_name (),
2883 argv, NULL, NULL, NULL, ASSUAN_PIPE_CONNECT_FDPASSING);
2884 #else
2885 err = assuan_pipe_connect
2886- (g13->assuan_ctx, file_name ? file_name : _gpgme_get_g13_path (),
2887+ (g13->assuan_ctx, file_name ? file_name : _gpgme_get_default_g13_name (),
2888 argv, NULL, NULL, NULL, 0);
2889 #endif
2890 if (err)
2891@@ -757,7 +757,7 @@
2892 struct engine_ops _gpgme_engine_ops_g13 =
2893 {
2894 /* Static functions. */
2895- _gpgme_get_g13_path,
2896+ _gpgme_get_default_g13_name,
2897 NULL,
2898 g13_get_version,
2899 g13_get_req_version,
2900
2901=== modified file 'src/engine-gpg.c'
2902--- src/engine-gpg.c 2013-05-29 18:33:42 +0000
2903+++ src/engine-gpg.c 2013-10-23 07:14:02 +0000
2904@@ -296,7 +296,7 @@
2905 gpg_get_version (const char *file_name)
2906 {
2907 return _gpgme_get_program_version (file_name ? file_name
2908- : _gpgme_get_gpg_path ());
2909+ : _gpgme_get_default_gpg_name ());
2910 }
2911
2912
2913@@ -1296,7 +1296,7 @@
2914 if (!gpg)
2915 return gpg_error (GPG_ERR_INV_VALUE);
2916
2917- if (!gpg->file_name && !_gpgme_get_gpg_path ())
2918+ if (!gpg->file_name && !_gpgme_get_default_gpg_name ())
2919 return trace_gpg_error (GPG_ERR_INV_ENGINE);
2920
2921 if (gpg->lc_ctype)
2922@@ -1352,7 +1352,7 @@
2923 fd_list[n].dup_to = -1;
2924
2925 status = _gpgme_io_spawn (gpg->file_name ? gpg->file_name :
2926- _gpgme_get_gpg_path (), gpg->argv,
2927+ _gpgme_get_default_gpg_name (), gpg->argv,
2928 IOSPAWN_FLAG_ALLOW_SET_FG,
2929 fd_list, NULL, NULL, &pid);
2930 {
2931@@ -2401,7 +2401,7 @@
2932 struct engine_ops _gpgme_engine_ops_gpg =
2933 {
2934 /* Static functions. */
2935- _gpgme_get_gpg_path,
2936+ _gpgme_get_default_gpg_name,
2937 NULL,
2938 gpg_get_version,
2939 gpg_get_req_version,
2940
2941=== modified file 'src/engine-gpgconf.c'
2942--- src/engine-gpgconf.c 2013-05-14 20:29:20 +0000
2943+++ src/engine-gpgconf.c 2013-10-23 07:14:02 +0000
2944@@ -61,7 +61,7 @@
2945 gpgconf_get_version (const char *file_name)
2946 {
2947 return _gpgme_get_program_version (file_name ? file_name
2948- : _gpgme_get_gpgconf_path ());
2949+ : _gpgme_get_default_gpgconf_name ());
2950 }
2951
2952
2953@@ -100,7 +100,7 @@
2954 return gpg_error_from_syserror ();
2955
2956 gpgconf->file_name = strdup (file_name ? file_name
2957- : _gpgme_get_gpgconf_path ());
2958+ : _gpgme_get_default_gpgconf_name ());
2959 if (!gpgconf->file_name)
2960 err = gpg_error_from_syserror ();
2961
2962@@ -923,7 +923,7 @@
2963 struct engine_ops _gpgme_engine_ops_gpgconf =
2964 {
2965 /* Static functions. */
2966- _gpgme_get_gpgconf_path,
2967+ _gpgme_get_default_gpgconf_name,
2968 NULL,
2969 gpgconf_get_version,
2970 gpgconf_get_req_version,
2971
2972=== modified file 'src/engine-gpgsm.c'
2973--- src/engine-gpgsm.c 2013-05-29 18:33:42 +0000
2974+++ src/engine-gpgsm.c 2013-10-23 07:14:02 +0000
2975@@ -120,7 +120,7 @@
2976 gpgsm_get_version (const char *file_name)
2977 {
2978 return _gpgme_get_program_version (file_name ? file_name
2979- : _gpgme_get_gpgsm_path ());
2980+ : _gpgme_get_default_gpgsm_name ());
2981 }
2982
2983
2984@@ -340,7 +340,8 @@
2985
2986 #if USE_DESCRIPTOR_PASSING
2987 err = assuan_pipe_connect
2988- (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
2989+ (gpgsm->assuan_ctx,
2990+ file_name ? file_name : _gpgme_get_default_gpgsm_name (),
2991 argv, NULL, NULL, NULL, ASSUAN_PIPE_CONNECT_FDPASSING);
2992 #else
2993 {
2994@@ -352,7 +353,8 @@
2995 achild_fds[i] = (assuan_fd_t) child_fds[i];
2996
2997 err = assuan_pipe_connect
2998- (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
2999+ (gpgsm->assuan_ctx,
3000+ file_name ? file_name : _gpgme_get_default_gpgsm_name (),
3001 argv, achild_fds, NULL, NULL, 0);
3002
3003 /* For now... */
3004@@ -1945,7 +1947,7 @@
3005 struct engine_ops _gpgme_engine_ops_gpgsm =
3006 {
3007 /* Static functions. */
3008- _gpgme_get_gpgsm_path,
3009+ _gpgme_get_default_gpgsm_name,
3010 NULL,
3011 gpgsm_get_version,
3012 gpgsm_get_req_version,
3013
3014=== modified file 'src/engine-uiserver.c'
3015--- src/engine-uiserver.c 2013-05-29 18:33:42 +0000
3016+++ src/engine-uiserver.c 2013-10-23 07:14:02 +0000
3017@@ -296,7 +296,7 @@
3018
3019 err = assuan_socket_connect (uiserver->assuan_ctx,
3020 file_name ?
3021- file_name : _gpgme_get_uiserver_socket_path (),
3022+ file_name : _gpgme_get_default_uisrv_socket (),
3023 0, ASSUAN_SOCKET_SERVER_FDPASSING);
3024 if (err)
3025 goto leave;
3026@@ -1302,7 +1302,7 @@
3027 struct engine_ops _gpgme_engine_ops_uiserver =
3028 {
3029 /* Static functions. */
3030- _gpgme_get_uiserver_socket_path,
3031+ _gpgme_get_default_uisrv_socket,
3032 NULL,
3033 uiserver_get_version,
3034 uiserver_get_req_version,
3035
3036=== modified file 'src/gpgme-tool.c'
3037--- src/gpgme-tool.c 2013-05-29 18:33:42 +0000
3038+++ src/gpgme-tool.c 2013-10-23 07:14:02 +0000
3039@@ -1435,7 +1435,8 @@
3040 STATUS_INCLUDE_CERTS,
3041 STATUS_KEYLIST_MODE,
3042 STATUS_RECIPIENT,
3043- STATUS_ENCRYPT_RESULT
3044+ STATUS_ENCRYPT_RESULT,
3045+ STATUS_IDENTIFY_RESULT
3046 } status_t;
3047
3048 const char *status_string[] =
3049@@ -1448,7 +1449,8 @@
3050 "INCLUDE_CERTS",
3051 "KEYLIST_MODE",
3052 "RECIPIENT",
3053- "ENCRYPT_RESULT"
3054+ "ENCRYPT_RESULT",
3055+ "IDENTIFY_RESULT"
3056 };
3057
3058 struct gpgme_tool
3059@@ -2065,11 +2067,6 @@
3060 }
3061
3062
3063-static const char hlp_passwd[] =
3064- "PASSWD <user-id>\n"
3065- "\n"
3066- "Ask the backend to change the passphrase for the key\n"
3067- "specified by USER-ID.";
3068 gpg_error_t
3069 gt_passwd (gpgme_tool_t gt, char *fpr)
3070 {
3071@@ -2086,6 +2083,29 @@
3072 }
3073
3074
3075+gpg_error_t
3076+gt_identify (gpgme_tool_t gt, gpgme_data_t data)
3077+{
3078+ const char *s = "?";
3079+
3080+ switch (gpgme_data_identify (data, 0))
3081+ {
3082+ case GPGME_DATA_TYPE_INVALID: return gpg_error (GPG_ERR_GENERAL);
3083+ case GPGME_DATA_TYPE_UNKNOWN : s = "unknown"; break;
3084+ case GPGME_DATA_TYPE_PGP_SIGNED : s = "PGP-signed"; break;
3085+ case GPGME_DATA_TYPE_PGP_OTHER : s = "PGP"; break;
3086+ case GPGME_DATA_TYPE_PGP_KEY : s = "PGP-key"; break;
3087+ case GPGME_DATA_TYPE_CMS_SIGNED : s = "CMS-signed"; break;
3088+ case GPGME_DATA_TYPE_CMS_ENCRYPTED: s = "CMS-encrypted"; break;
3089+ case GPGME_DATA_TYPE_CMS_OTHER : s = "CMS"; break;
3090+ case GPGME_DATA_TYPE_X509_CERT : s = "X.509"; break;
3091+ case GPGME_DATA_TYPE_PKCS12 : s = "PKCS12"; break;
3092+ }
3093+ gt_write_status (gt, STATUS_IDENTIFY_RESULT, s, NULL);
3094+ return 0;
3095+}
3096+
3097+
3098 #define GT_RESULT_ENCRYPT 0x1
3099 #define GT_RESULT_DECRYPT 0x2
3100 #define GT_RESULT_SIGN 0x4
3101@@ -3374,6 +3394,11 @@
3102 }
3103
3104
3105+static const char hlp_passwd[] =
3106+ "PASSWD <user-id>\n"
3107+ "\n"
3108+ "Ask the backend to change the passphrase for the key\n"
3109+ "specified by USER-ID.";
3110 static gpg_error_t
3111 cmd_passwd (assuan_context_t ctx, char *line)
3112 {
3113@@ -3430,6 +3455,39 @@
3114 }
3115
3116
3117+static const char hlp_identify[] =
3118+ "IDENTIY\n"
3119+ "\n"
3120+ "Identify the type of data set with the INPUT command.";
3121+static gpg_error_t
3122+cmd_identify (assuan_context_t ctx, char *line)
3123+{
3124+ struct server *server = assuan_get_pointer (ctx);
3125+ gpg_error_t err;
3126+ assuan_fd_t inp_fd;
3127+ char *inp_fn;
3128+ gpgme_data_t inp_data;
3129+
3130+ inp_fd = server->input_fd;
3131+ inp_fn = server->input_filename;
3132+ if (inp_fd == ASSUAN_INVALID_FD && !inp_fn)
3133+ return GPG_ERR_ASS_NO_INPUT;
3134+
3135+ err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data,
3136+ &server->input_stream);
3137+ if (err)
3138+ return err;
3139+
3140+ err = gt_identify (server->gt, inp_data);
3141+
3142+ gpgme_data_release (inp_data);
3143+ server_reset_fds (server);
3144+
3145+ return err;
3146+}
3147+
3148+
3149+
3150 /* Tell the assuan library about our commands. */
3151 static gpg_error_t
3152 register_commands (assuan_context_t ctx)
3153@@ -3488,6 +3546,7 @@
3154 { "PUBKEY_ALGO_NAME", cmd_pubkey_algo_name },
3155 { "HASH_ALGO_NAME", cmd_hash_algo_name },
3156 { "PASSWD", cmd_passwd, hlp_passwd },
3157+ { "IDENTIFY", cmd_identify, hlp_identify },
3158 { NULL }
3159 };
3160 int idx;
3161
3162=== modified file 'src/gpgme.def'
3163--- src/gpgme.def 2013-05-14 20:29:20 +0000
3164+++ src/gpgme.def 2013-10-23 07:14:02 +0000
3165@@ -209,5 +209,9 @@
3166 gpgme_set_pinentry_mode @158
3167 gpgme_get_pinentry_mode @159
3168
3169+ gpgme_signers_count @160
3170+
3171+ gpgme_data_identify @161
3172+
3173 ; END
3174
3175
3176=== modified file 'src/gpgme.h.in'
3177--- src/gpgme.h.in 2013-05-29 18:33:42 +0000
3178+++ src/gpgme.h.in 2013-10-23 07:14:02 +0000
3179@@ -210,6 +210,22 @@
3180 }
3181 gpgme_data_encoding_t;
3182
3183+/* Known data types. */
3184+typedef enum
3185+ {
3186+ GPGME_DATA_TYPE_INVALID = 0, /* Not detected. */
3187+ GPGME_DATA_TYPE_UNKNOWN = 1,
3188+ GPGME_DATA_TYPE_PGP_SIGNED = 0x10,
3189+ GPGME_DATA_TYPE_PGP_OTHER = 0x12,
3190+ GPGME_DATA_TYPE_PGP_KEY = 0x13,
3191+ GPGME_DATA_TYPE_CMS_SIGNED = 0x20,
3192+ GPGME_DATA_TYPE_CMS_ENCRYPTED= 0x21,
3193+ GPGME_DATA_TYPE_CMS_OTHER = 0x22,
3194+ GPGME_DATA_TYPE_X509_CERT = 0x23,
3195+ GPGME_DATA_TYPE_PKCS12 = 0x24,
3196+ }
3197+gpgme_data_type_t;
3198+
3199
3200
3201 /* Public key algorithms from libgcrypt. */
3202 typedef enum
3203@@ -934,6 +950,9 @@
3204 /* Add KEY to list of signers in CTX. */
3205 gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key);
3206
3207+/* Return the number of signers in CTX. */
3208+unsigned int gpgme_signers_count (const gpgme_ctx_t ctx);
3209+
3210 /* Return the SEQth signer's key in CTX. */
3211 gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq);
3212
3213@@ -1146,6 +1165,9 @@
3214 gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
3215 const char *file_name);
3216
3217+/* Try to identify the type of the data in DH. */
3218+gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved);
3219+
3220
3221 /* Create a new data buffer which retrieves the data from the callback
3222 function READ_CB. Deprecated, please use gpgme_data_new_from_cbs
3223
3224=== modified file 'src/libgpgme.vers'
3225--- src/libgpgme.vers 2013-05-14 20:29:20 +0000
3226+++ src/libgpgme.vers 2013-10-23 07:14:02 +0000
3227@@ -29,6 +29,7 @@
3228
3229 gpgme_data_set_file_name;
3230 gpgme_data_get_file_name;
3231+ gpgme_data_identify;
3232
3233 gpgme_sig_notation_clear;
3234 gpgme_sig_notation_add;
3235@@ -143,6 +144,7 @@
3236 gpgme_set_textmode;
3237 gpgme_signers_add;
3238 gpgme_signers_clear;
3239+ gpgme_signers_count;
3240 gpgme_signers_enum;
3241
3242 gpgme_key_ref;
3243
3244=== added file 'src/parsetlv.c'
3245--- src/parsetlv.c 1970-01-01 00:00:00 +0000
3246+++ src/parsetlv.c 2013-10-23 07:14:02 +0000
3247@@ -0,0 +1,103 @@
3248+/* parsetlv.c - ASN.1 TLV functions
3249+ * Copyright (C) 2005, 2007, 2008, 2012 g10 Code GmbH
3250+ *
3251+ * This file is free software; you can redistribute it and/or modify
3252+ * it under the terms of the GNU Lesser General Public License as
3253+ * published by the Free Software Foundation; either version 2.1 of
3254+ * the License, or (at your option) any later version.
3255+ *
3256+ * This file is distributed in the hope that it will be useful,
3257+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3258+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3259+ * GNU Lesser General Public License for more details.
3260+ *
3261+ * You should have received a copy of the GNU Lesser General Public License
3262+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
3263+ */
3264+
3265+#ifdef HAVE_CONFIG_H
3266+# include <config.h>
3267+#endif
3268+#include <stdio.h>
3269+#include <stdlib.h>
3270+#include <string.h>
3271+
3272+#include "parsetlv.h"
3273+
3274+
3275+/* Simple but pretty complete ASN.1 BER parser. Parse the data at the
3276+ address of BUFFER with a length given at the address of SIZE. On
3277+ success return 0 and update BUFFER and SIZE to point to the value.
3278+ Do not update them on error. The information about the object are
3279+ stored in the caller allocated TI structure. */
3280+int
3281+_gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti)
3282+{
3283+ int c;
3284+ unsigned long tag;
3285+ const unsigned char *buf = (const unsigned char *)(*buffer);
3286+ size_t length = *size;
3287+
3288+ ti->cls = 0;
3289+ ti->tag = 0;
3290+ ti->is_cons = 0;
3291+ ti->is_ndef = 0;
3292+ ti->length = 0;
3293+ ti->nhdr = 0;
3294+
3295+ if (!length)
3296+ return -1;
3297+ c = *buf++; length--; ++ti->nhdr;
3298+
3299+ ti->cls = (c & 0xc0) >> 6;
3300+ ti->is_cons = !!(c & 0x20);
3301+ tag = c & 0x1f;
3302+
3303+ if (tag == 0x1f)
3304+ {
3305+ tag = 0;
3306+ do
3307+ {
3308+ tag <<= 7;
3309+ if (!length)
3310+ return -1;
3311+ c = *buf++; length--; ++ti->nhdr;
3312+ tag |= c & 0x7f;
3313+ }
3314+ while (c & 0x80);
3315+ }
3316+ ti->tag = tag;
3317+
3318+ if (!length)
3319+ return -1;
3320+ c = *buf++; length--; ++ti->nhdr;
3321+
3322+ if ( !(c & 0x80) )
3323+ ti->length = c;
3324+ else if (c == 0x80)
3325+ ti->is_ndef = 1;
3326+ else if (c == 0xff)
3327+ return -1;
3328+ else
3329+ {
3330+ unsigned long len = 0;
3331+ int count = (c & 0x7f);
3332+
3333+ if (count > sizeof (len) || count > sizeof (size_t))
3334+ return -1;
3335+
3336+ for (; count; count--)
3337+ {
3338+ len <<= 8;
3339+ if (!length)
3340+ return -1;
3341+ c = *buf++; length--; ++ti->nhdr;
3342+ len |= c & 0xff;
3343+ }
3344+ ti->length = len;
3345+ }
3346+
3347+ *buffer = (void*)buf;
3348+ *size = length;
3349+ return 0;
3350+}
3351
3352=== added file 'src/parsetlv.h'
3353--- src/parsetlv.h 1970-01-01 00:00:00 +0000
3354+++ src/parsetlv.h 2013-10-23 07:14:02 +0000
3355@@ -0,0 +1,48 @@
3356+/* parsetlv.h - TLV functions defintions
3357+ * Copyright (C) 2012 g10 Code GmbH
3358+ *
3359+ * This file is free software; you can redistribute it and/or modify
3360+ * it under the terms of the GNU Lesser General Public License as
3361+ * published by the Free Software Foundation; either version 2.1 of
3362+ * the License, or (at your option) any later version.
3363+ *
3364+ * This file is distributed in the hope that it will be useful,
3365+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3366+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3367+ * GNU Lesser General Public License for more details.
3368+ *
3369+ * You should have received a copy of the GNU Lesser General Public License
3370+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
3371+ */
3372+
3373+#ifndef PARSETLV_H
3374+#define PARSETLV_H
3375+
3376+/* ASN.1 constants. */
3377+#define ASN1_CLASS_UNIVERSAL 0
3378+#define ASN1_CLASS_APPLICATION 1
3379+#define ASN1_CLASS_CONTEXT 2
3380+#define ASN1_CLASS_PRIVATE 3
3381+#define ASN1_TAG_INTEGER 2
3382+#define ASN1_TAG_OBJECT_ID 6
3383+#define ASN1_TAG_SEQUENCE 16
3384+
3385+
3386+/* Object used with parse_tlv. */
3387+struct tlvinfo_s
3388+{
3389+ int cls; /* The class of the tag. */
3390+ int tag; /* The tag. */
3391+ int is_cons; /* True if it is a constructed object. */
3392+ int is_ndef; /* True if the object has an indefinite length. */
3393+ size_t length; /* The length of the value. */
3394+ size_t nhdr; /* The number of octets in the header (tag,length). */
3395+};
3396+typedef struct tlvinfo_s tlvinfo_t;
3397+
3398+/*-- parsetlv.c --*/
3399+int _gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti);
3400+#define parse_tlv(a,b,c) _gpgme_parse_tlv ((a), (b), (c))
3401+
3402+
3403+#endif /*PARSETLV_H*/
3404
3405=== modified file 'src/posix-util.c'
3406--- src/posix-util.c 2013-05-14 20:29:20 +0000
3407+++ src/posix-util.c 2013-10-23 07:14:02 +0000
3408@@ -28,6 +28,7 @@
3409 #include <assert.h>
3410
3411 #include "util.h"
3412+#include "sys-util.h"
3413
3414 const char *
3415 _gpgme_get_gpg_path (void)
3416@@ -70,29 +71,6 @@
3417 }
3418
3419
3420-const char *
3421-_gpgme_get_uiserver_socket_path (void)
3422-{
3423- static char *socket_path;
3424- const char *homedir;
3425- const char name[] = "S.uiserver";
3426-
3427- if (socket_path)
3428- return socket_path;
3429-
3430- homedir = _gpgme_get_default_homedir ();
3431- if (! homedir)
3432- return NULL;
3433-
3434- socket_path = malloc (strlen (homedir) + 1 + strlen (name) + 1);
3435- if (! socket_path)
3436- return NULL;
3437-
3438- strcpy (stpcpy (stpcpy (socket_path, homedir), "/"), name);
3439- return socket_path;
3440-}
3441-
3442-
3443 /* See w32-util.c */
3444 int
3445 _gpgme_get_conf_int (const char *key, int *value)
3446
3447=== modified file 'src/signers.c'
3448--- src/signers.c 2013-05-14 20:29:20 +0000
3449+++ src/signers.c 2013-10-23 07:14:02 +0000
3450@@ -93,6 +93,14 @@
3451 }
3452
3453
3454+/* Return the number of signers in CTX. */
3455+unsigned int
3456+gpgme_signers_count (const gpgme_ctx_t ctx)
3457+{
3458+ return ctx? ctx->signers_len : 0;
3459+}
3460+
3461+
3462 /* Return the SEQth signer's key in CTX with one reference. */
3463 gpgme_key_t
3464 gpgme_signers_enum (const gpgme_ctx_t ctx, int seq)
3465
3466=== added file 'src/sys-util.h'
3467--- src/sys-util.h 1970-01-01 00:00:00 +0000
3468+++ src/sys-util.h 2013-10-23 07:14:02 +0000
3469@@ -0,0 +1,29 @@
3470+/* sys-util.h - System utilities not generally used.
3471+ * Copyright (C) 2013 g10 Code GmbH
3472+ *
3473+ * This file is part of GPGME.
3474+ *
3475+ * GPGME is free software; you can redistribute it and/or modify it
3476+ * under the terms of the GNU Lesser General Public License as
3477+ * published by the Free Software Foundation; either version 2.1 of
3478+ * the License, or (at your option) any later version.
3479+ *
3480+ * GPGME is distributed in the hope that it will be useful, but
3481+ * WITHOUT ANY WARRANTY; without even the implied warranty of
3482+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3483+ * Lesser General Public License for more details.
3484+ *
3485+ * You should have received a copy of the GNU Lesser General Public
3486+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
3487+ */
3488+
3489+#ifndef SYS_UTIL_H
3490+#define SYS_UTIL_H
3491+
3492+/*-- {posix,w32}-util.c --*/
3493+const char *_gpgme_get_gpg_path (void);
3494+const char *_gpgme_get_gpgsm_path (void);
3495+const char *_gpgme_get_gpgconf_path (void);
3496+const char *_gpgme_get_g13_path (void);
3497+
3498+#endif /* SYS_UTIL_H */
3499
3500=== modified file 'src/util.h'
3501--- src/util.h 2013-05-14 20:29:20 +0000
3502+++ src/util.h 2013-10-23 07:14:02 +0000
3503@@ -47,18 +47,17 @@
3504
3505
3506
3507 /*-- {posix,w32}-util.c --*/
3508-const char *_gpgme_get_gpg_path (void);
3509-const char *_gpgme_get_gpgsm_path (void);
3510-const char *_gpgme_get_gpgconf_path (void);
3511-const char *_gpgme_get_g13_path (void);
3512-const char *_gpgme_get_uiserver_socket_path (void);
3513-
3514 int _gpgme_get_conf_int (const char *key, int *value);
3515 void _gpgme_allow_set_foreground_window (pid_t pid);
3516
3517 /*-- dirinfo.c --*/
3518 const char *_gpgme_get_default_homedir (void);
3519 const char *_gpgme_get_default_agent_socket (void);
3520+const char *_gpgme_get_default_gpg_name (void);
3521+const char *_gpgme_get_default_gpgsm_name (void);
3522+const char *_gpgme_get_default_g13_name (void);
3523+const char *_gpgme_get_default_gpgconf_name (void);
3524+const char *_gpgme_get_default_uisrv_socket (void);
3525
3526
3527
3528
3529
3530=== modified file 'src/w32-util.c'
3531--- src/w32-util.c 2013-05-14 20:29:20 +0000
3532+++ src/w32-util.c 2013-10-23 07:14:02 +0000
3533@@ -1,24 +1,23 @@
3534 /* w32-util.c - Utility functions for the W32 API
3535- Copyright (C) 1999 Free Software Foundation, Inc
3536- Copyright (C) 2001 Werner Koch (dd9jn)
3537- Copyright (C) 2001, 2002, 2003, 2004, 2007 g10 Code GmbH
3538-
3539- This file is part of GPGME.
3540-
3541- GPGME is free software; you can redistribute it and/or modify it
3542- under the terms of the GNU Lesser General Public License as
3543- published by the Free Software Foundation; either version 2.1 of
3544- the License, or (at your option) any later version.
3545-
3546- GPGME is distributed in the hope that it will be useful, but
3547- WITHOUT ANY WARRANTY; without even the implied warranty of
3548- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3549- Lesser General Public License for more details.
3550-
3551- You should have received a copy of the GNU Lesser General Public
3552- License along with this program; if not, write to the Free Software
3553- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3554- 02111-1307, USA. */
3555+ * Copyright (C) 1999 Free Software Foundation, Inc
3556+ * Copyright (C) 2001 Werner Koch (dd9jn)
3557+ * Copyright (C) 2001, 2002, 2003, 2004, 2007, 2013 g10 Code GmbH
3558+ *
3559+ * This file is part of GPGME.
3560+ *
3561+ * GPGME is free software; you can redistribute it and/or modify it
3562+ * under the terms of the GNU Lesser General Public License as
3563+ * published by the Free Software Foundation; either version 2.1 of
3564+ * the License, or (at your option) any later version.
3565+ *
3566+ * GPGME is distributed in the hope that it will be useful, but
3567+ * WITHOUT ANY WARRANTY; without even the implied warranty of
3568+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3569+ * Lesser General Public License for more details.
3570+ *
3571+ * You should have received a copy of the GNU Lesser General Public
3572+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
3573+ **/
3574
3575 #ifdef HAVE_CONFIG_H
3576 #include <config.h>
3577@@ -63,6 +62,7 @@
3578 #include "ath.h"
3579 #include "sema.h"
3580 #include "debug.h"
3581+#include "sys-util.h"
3582
3583
3584 #ifndef HAVE_W32CE_SYSTEM
3585@@ -75,6 +75,12 @@
3586
3587 DEFINE_STATIC_LOCK (get_path_lock);
3588
3589+/* The module handle of this DLL. If we are linked statically,
3590+ dllmain does not exists and thus the value of my_hmodule will be
3591+ NULL. The effect is that a GetModuleFileName always returns the
3592+ file name of the DLL or executable which contains the gpgme code. */
3593+static HMODULE my_hmodule;
3594+
3595
3596 #ifdef HAVE_ALLOW_SET_FOREGROUND_WINDOW
3597
3598@@ -112,6 +118,39 @@
3599 }
3600 #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */
3601
3602+
3603+/* Return a malloced string encoded in UTF-8 from the wide char input
3604+ string STRING. Caller must free this value. Returns NULL and sets
3605+ ERRNO on failure. Calling this function with STRING set to NULL is
3606+ not defined. */
3607+static char *
3608+wchar_to_utf8 (const wchar_t *string)
3609+{
3610+ int n;
3611+ char *result;
3612+
3613+ n = WideCharToMultiByte (CP_UTF8, 0, string, -1, NULL, 0, NULL, NULL);
3614+ if (n < 0)
3615+ {
3616+ gpg_err_set_errno (EINVAL);
3617+ return NULL;
3618+ }
3619+
3620+ result = malloc (n+1);
3621+ if (!result)
3622+ return NULL;
3623+
3624+ n = WideCharToMultiByte (CP_UTF8, 0, string, -1, result, n, NULL, NULL);
3625+ if (n < 0)
3626+ {
3627+ free (result);
3628+ gpg_err_set_errno (EINVAL);
3629+ result = NULL;
3630+ }
3631+ return result;
3632+}
3633+
3634+
3635 void
3636 _gpgme_allow_set_foreground_window (pid_t pid)
3637 {
3638@@ -270,58 +309,94 @@
3639 }
3640
3641
3642-#if 0
3643-static char *
3644-find_program_in_registry (const char *name)
3645-{
3646- char *program = NULL;
3647-
3648- program = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", name);
3649- if (program)
3650- {
3651- int i;
3652-
3653- TRACE2 (DEBUG_CTX, "gpgme:find_program_in_registry", 0,
3654- "found %s in registry: `%s'", name, program);
3655- for (i = 0; program[i]; i++)
3656- {
3657- if (program[i] == '/')
3658- program[i] = '\\';
3659- }
3660- }
3661- return program;
3662-}
3663-#endif
3664-
3665-
3666-static char *
3667-find_program_in_inst_dir (const char *name)
3668-{
3669- char *result = NULL;
3670- char *tmp;
3671-
3672- tmp = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
3673+/* Return the name of the directory with the gpgme DLL or the EXE (if
3674+ statically linked). May return NULL on severe errors. */
3675+const char *
3676+_gpgme_get_inst_dir (void)
3677+{
3678+ static char *inst_dir;
3679+
3680+ LOCK (get_path_lock);
3681+ if (!inst_dir)
3682+ {
3683+ wchar_t *moddir;
3684+
3685+ moddir = malloc ((MAX_PATH+5) * sizeof *moddir);
3686+ if (moddir)
3687+ {
3688+ if (!GetModuleFileNameW (my_hmodule, moddir, MAX_PATH))
3689+ *moddir = 0;
3690+ if (!*moddir)
3691+ gpg_err_set_errno (ENOENT);
3692+ else
3693+ {
3694+ inst_dir = wchar_to_utf8 (moddir);
3695+ if (inst_dir)
3696+ {
3697+ char *p = strrchr (inst_dir, '\\');
3698+ if (p)
3699+ *p = 0;
3700+ }
3701+ }
3702+ free (moddir);
3703+ }
3704+ }
3705+ UNLOCK (get_path_lock);
3706+ return inst_dir;
3707+}
3708+
3709+
3710+static char *
3711+find_program_in_dir (const char *dir, const char *name)
3712+{
3713+ char *result;
3714+
3715+ result = malloc (strlen (dir) + 1 + strlen (name) + 1);
3716+ if (!result)
3717+ return NULL;
3718+
3719+ strcpy (stpcpy (stpcpy (result, dir), "\\"), name);
3720+ if (access (result, F_OK))
3721+ {
3722+ free (result);
3723+ return NULL;
3724+ }
3725+
3726+ return result;
3727+}
3728+
3729+
3730+static char *
3731+find_program_in_inst_dir (const char *inst_dir, const char *name)
3732+{
3733+ char *result;
3734+ char *dir;
3735+
3736+ /* If an installation directory has been passed, this overrides a
3737+ location given bu the registry. The idea here is that we prefer
3738+ a a program installed alongside with gpgme. We don't want the
3739+ registry to override this to have a better isolation of an gpgme
3740+ aware applications for other effects. Note that the "Install
3741+ Directory" registry item has been used for ages in Gpg4win and
3742+ earlier GnuPG windows installers. It is technically not anymore
3743+ required. */
3744+ if (inst_dir)
3745+ {
3746+ result = find_program_in_dir (inst_dir, name);
3747+ if (result)
3748+ return result;
3749+ }
3750+
3751+ dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
3752 "Software\\GNU\\GnuPG",
3753 "Install Directory");
3754- if (!tmp)
3755- return NULL;
3756-
3757- result = malloc (strlen (tmp) + 1 + strlen (name) + 1);
3758- if (!result)
3759- {
3760- free (tmp);
3761- return NULL;
3762- }
3763-
3764- strcpy (stpcpy (stpcpy (result, tmp), "\\"), name);
3765- free (tmp);
3766- if (access (result, F_OK))
3767- {
3768- free (result);
3769- return NULL;
3770- }
3771-
3772- return result;
3773+ if (dir)
3774+ {
3775+ result = find_program_in_dir (dir, name);
3776+ free (dir);
3777+ return result;
3778+ }
3779+ return NULL;
3780 }
3781
3782
3783@@ -353,14 +428,12 @@
3784 _gpgme_get_gpg_path (void)
3785 {
3786 static char *gpg_program;
3787+ const char *inst_dir;
3788
3789+ inst_dir = _gpgme_get_inst_dir ();
3790 LOCK (get_path_lock);
3791-#if 0
3792- if (!gpg_program)
3793- gpg_program = find_program_in_registry ("gpgProgram");
3794-#endif
3795- if (!gpg_program)
3796- gpg_program = find_program_in_inst_dir ("gpg.exe");
3797+ if (!gpg_program)
3798+ gpg_program = find_program_in_inst_dir (inst_dir, "gpg.exe");
3799 if (!gpg_program)
3800 gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
3801 UNLOCK (get_path_lock);
3802@@ -372,14 +445,12 @@
3803 _gpgme_get_gpgsm_path (void)
3804 {
3805 static char *gpgsm_program;
3806+ const char *inst_dir;
3807
3808+ inst_dir = _gpgme_get_inst_dir ();
3809 LOCK (get_path_lock);
3810-#if 0
3811- if (!gpgsm_program)
3812- gpgsm_program = find_program_in_registry ("gpgsmProgram");
3813-#endif
3814- if (!gpgsm_program)
3815- gpgsm_program = find_program_in_inst_dir ("gpgsm.exe");
3816+ if (!gpgsm_program)
3817+ gpgsm_program = find_program_in_inst_dir (inst_dir, "gpgsm.exe");
3818 if (!gpgsm_program)
3819 gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
3820 UNLOCK (get_path_lock);
3821@@ -391,14 +462,12 @@
3822 _gpgme_get_gpgconf_path (void)
3823 {
3824 static char *gpgconf_program;
3825+ const char *inst_dir;
3826
3827+ inst_dir = _gpgme_get_inst_dir ();
3828 LOCK (get_path_lock);
3829-#if 0
3830- if (!gpgconf_program)
3831- gpgconf_program = find_program_in_registry ("gpgconfProgram");
3832-#endif
3833- if (!gpgconf_program)
3834- gpgconf_program = find_program_in_inst_dir ("gpgconf.exe");
3835+ if (!gpgconf_program)
3836+ gpgconf_program = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
3837 if (!gpgconf_program)
3838 gpgconf_program
3839 = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
3840@@ -411,14 +480,12 @@
3841 _gpgme_get_g13_path (void)
3842 {
3843 static char *g13_program;
3844+ const char *inst_dir;
3845
3846+ inst_dir = _gpgme_get_inst_dir ();
3847 LOCK (get_path_lock);
3848-#if 0
3849- if (!g13_program)
3850- g13_program = find_program_in_registry ("g13Program");
3851-#endif
3852- if (!g13_program)
3853- g13_program = find_program_in_inst_dir ("g13.exe");
3854+ if (!g13_program)
3855+ g13_program = find_program_in_inst_dir (inst_dir, "g13.exe");
3856 if (!g13_program)
3857 g13_program = find_program_at_standard_place ("GNU\\GnuPG\\g13.exe");
3858 UNLOCK (get_path_lock);
3859@@ -427,36 +494,15 @@
3860
3861
3862 const char *
3863-_gpgme_get_uiserver_socket_path (void)
3864-{
3865- static char *socket_path;
3866- const char *homedir;
3867- const char name[] = "S.uiserver";
3868-
3869- if (socket_path)
3870- return socket_path;
3871-
3872- homedir = _gpgme_get_default_homedir ();
3873- if (! homedir)
3874- return NULL;
3875-
3876- socket_path = malloc (strlen (homedir) + 1 + strlen (name) + 1);
3877- if (! socket_path)
3878- return NULL;
3879-
3880- strcpy (stpcpy (stpcpy (socket_path, homedir), "\\"), name);
3881- return socket_path;
3882-}
3883-
3884-
3885-const char *
3886 _gpgme_get_w32spawn_path (void)
3887 {
3888 static char *w32spawn_program;
3889+ const char *inst_dir;
3890
3891+ inst_dir = _gpgme_get_inst_dir ();
3892 LOCK (get_path_lock);
3893 if (!w32spawn_program)
3894- w32spawn_program = find_program_in_inst_dir ("gpgme-w32spawn.exe");
3895+ w32spawn_program = find_program_in_inst_dir (inst_dir,"gpgme-w32spawn.exe");
3896 if (!w32spawn_program)
3897 w32spawn_program
3898 = find_program_at_standard_place ("GNU\\GnuPG\\gpgme-w32spawn.exe");
3899@@ -641,3 +687,18 @@
3900 return tmp;
3901 }
3902 #endif /*HAVE_W32CE_SYSTEM*/
3903+
3904+
3905+/* Entry point called by the DLL loader. */
3906+#ifdef DLL_EXPORT
3907+int WINAPI
3908+DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
3909+{
3910+ (void)reserved;
3911+
3912+ if (reason == DLL_PROCESS_ATTACH)
3913+ my_hmodule = hinst;
3914+
3915+ return TRUE;
3916+}
3917+#endif /*DLL_EXPORT*/
3918
3919=== added file 'tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F'
3920Binary files tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F 1970-01-01 00:00:00 +0000 and tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F 2013-10-23 07:14:02 +0000 differ
3921=== added file 'tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD'
3922Binary files tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD 1970-01-01 00:00:00 +0000 and tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD 2013-10-23 07:14:02 +0000 differ
3923=== added file 'tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66'
3924Binary files tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66 1970-01-01 00:00:00 +0000 and tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66 2013-10-23 07:14:02 +0000 differ
3925=== added file 'tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C'
3926Binary files tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C 1970-01-01 00:00:00 +0000 and tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C 2013-10-23 07:14:02 +0000 differ
3927=== added file 'tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD'
3928Binary files tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD 1970-01-01 00:00:00 +0000 and tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD 2013-10-23 07:14:02 +0000 differ
3929=== modified file 'tests/gpg/Makefile.am'
3930--- tests/gpg/Makefile.am 2013-05-14 20:29:20 +0000
3931+++ tests/gpg/Makefile.am 2013-10-23 07:14:02 +0000
3932@@ -1,18 +1,18 @@
3933 # Copyright (C) 2000 Werner Koch (dd9jn)
3934 # Copyright (C) 2001, 2004, 2005, 2009 g10 Code GmbH
3935-#
3936+#
3937 # This file is part of GPGME.
3938-#
3939+#
3940 # GPGME is free software; you can redistribute it and/or modify it
3941 # under the terms of the GNU Lesser General Public License as
3942 # published by the Free Software Foundation; either version 2.1 of the
3943 # License, or (at your option) any later version.
3944-#
3945+#
3946 # GPGME is distributed in the hope that it will be useful, but WITHOUT
3947 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3948 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
3949 # Public License for more details.
3950-#
3951+#
3952 # You should have received a copy of the GNU Lesser General Public
3953 # License along with this program; if not, write to the Free Software
3954 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
3955@@ -20,8 +20,9 @@
3956 ## Process this file with automake to produce Makefile.in
3957
3958 GPG = @GPG@
3959+GPG_AGENT = @GPG_AGENT@
3960
3961-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
3962+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=
3963
3964 # The keylist tests must come after the import and the edit test.
3965 noinst_HEADERS = t-support.h
3966@@ -32,17 +33,29 @@
3967 tests_unix = t-eventloop t-thread1
3968 endif
3969
3970-TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
3971+c_tests = \
3972+ t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
3973 t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
3974 t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
3975 t-encrypt-large t-file-name t-gpgconf $(tests_unix)
3976
3977+TESTS = initial.test $(c_tests) final.test
3978+
3979 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
3980 gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
3981- random_seed
3982-
3983-EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
3984- geheim.txt pubkey-1.asc seckey-1.asc pinentry
3985+ random_seed S.gpg-agent
3986+
3987+private_keys = \
3988+ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
3989+ 76F7E2B35832976B50A27A282D9B87E44577EB66 \
3990+ A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
3991+ 13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
3992+ 7A030357C0F253A5BBCD282FFC4E521B37558F5C
3993+
3994+
3995+EXTRA_DIST = start-stop-agent initial.test final.test \
3996+ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
3997+ geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
3998
3999 INCLUDES = -I$(top_builddir)/src
4000
4001@@ -51,17 +64,25 @@
4002 t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
4003
4004 # We don't run t-genkey in the test suite, because it takes too long
4005-noinst_PROGRAMS = $(TESTS) t-genkey
4006+noinst_PROGRAMS = $(c_tests) t-genkey
4007
4008 clean-local:
4009- -gpg-connect-agent KILLAGENT /bye
4010+ -$(srcdir)/start-stop-agent --stop
4011 -rm -fR private-keys-v1.d
4012
4013-all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg
4014+all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \
4015+ ./private-keys-v1.d/gpg-sample.stamp
4016
4017 export GNUPGHOME := $(abs_builddir)
4018
4019-export GPG_AGENT_INFO :=
4020+export GPG_AGENT_INFO :=
4021+
4022+./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
4023+ test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
4024+ for k in $(private_keys); do \
4025+ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
4026+ done
4027+ echo x > ./private-keys-v1.d/gpg-sample.stamp
4028
4029 ./pubring.gpg: $(srcdir)/pubdemo.asc
4030 -$(GPG) --no-permission-warning \
4031
4032=== modified file 'tests/gpg/Makefile.in'
4033--- tests/gpg/Makefile.in 2013-05-14 20:29:20 +0000
4034+++ tests/gpg/Makefile.in 2013-10-23 07:14:02 +0000
4035@@ -17,19 +17,19 @@
4036
4037 # Copyright (C) 2000 Werner Koch (dd9jn)
4038 # Copyright (C) 2001, 2004, 2005, 2009 g10 Code GmbH
4039-#
4040+#
4041 # This file is part of GPGME.
4042-#
4043+#
4044 # GPGME is free software; you can redistribute it and/or modify it
4045 # under the terms of the GNU Lesser General Public License as
4046 # published by the Free Software Foundation; either version 2.1 of the
4047 # License, or (at your option) any later version.
4048-#
4049+#
4050 # GPGME is distributed in the hope that it will be useful, but WITHOUT
4051 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
4052 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
4053 # Public License for more details.
4054-#
4055+#
4056 # You should have received a copy of the GNU Lesser General Public
4057 # License along with this program; if not, write to the Free Software
4058 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
4059@@ -71,14 +71,7 @@
4060 POST_UNINSTALL = :
4061 build_triplet = @build@
4062 host_triplet = @host@
4063-TESTS = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \
4064- t-encrypt-sign$(EXEEXT) t-sign$(EXEEXT) t-signers$(EXEEXT) \
4065- t-decrypt$(EXEEXT) t-verify$(EXEEXT) t-decrypt-verify$(EXEEXT) \
4066- t-sig-notation$(EXEEXT) t-export$(EXEEXT) t-import$(EXEEXT) \
4067- t-trustlist$(EXEEXT) t-edit$(EXEEXT) t-keylist$(EXEEXT) \
4068- t-keylist-sig$(EXEEXT) t-wait$(EXEEXT) \
4069- t-encrypt-large$(EXEEXT) t-file-name$(EXEEXT) \
4070- t-gpgconf$(EXEEXT) $(am__EXEEXT_1)
4071+TESTS = initial.test $(am__EXEEXT_2) final.test
4072 noinst_PROGRAMS = $(am__EXEEXT_2) t-genkey$(EXEEXT)
4073 subdir = tests/gpg
4074 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
4075@@ -388,18 +381,33 @@
4076 top_build_prefix = @top_build_prefix@
4077 top_builddir = @top_builddir@
4078 top_srcdir = @top_srcdir@
4079-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
4080+GPG_AGENT = @GPG_AGENT@
4081+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=
4082
4083 # The keylist tests must come after the import and the edit test.
4084 noinst_HEADERS = t-support.h
4085 @HAVE_W32_SYSTEM_FALSE@tests_unix = t-eventloop t-thread1
4086 @HAVE_W32_SYSTEM_TRUE@tests_unix =
4087+c_tests = \
4088+ t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
4089+ t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
4090+ t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
4091+ t-encrypt-large t-file-name t-gpgconf $(tests_unix)
4092+
4093 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
4094 gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
4095- random_seed
4096-
4097-EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
4098- geheim.txt pubkey-1.asc seckey-1.asc pinentry
4099+ random_seed S.gpg-agent
4100+
4101+private_keys = \
4102+ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
4103+ 76F7E2B35832976B50A27A282D9B87E44577EB66 \
4104+ A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
4105+ 13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
4106+ 7A030357C0F253A5BBCD282FFC4E521B37558F5C
4107+
4108+EXTRA_DIST = start-stop-agent initial.test final.test \
4109+ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
4110+ geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
4111
4112 INCLUDES = -I$(top_builddir)/src
4113 AM_CPPFLAGS = @GPG_ERROR_CFLAGS@
4114@@ -871,14 +879,22 @@
4115
4116
4117 clean-local:
4118- -gpg-connect-agent KILLAGENT /bye
4119+ -$(srcdir)/start-stop-agent --stop
4120 -rm -fR private-keys-v1.d
4121
4122-all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg
4123+all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \
4124+ ./private-keys-v1.d/gpg-sample.stamp
4125
4126 export GNUPGHOME := $(abs_builddir)
4127
4128-export GPG_AGENT_INFO :=
4129+export GPG_AGENT_INFO :=
4130+
4131+./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
4132+ test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
4133+ for k in $(private_keys); do \
4134+ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
4135+ done
4136+ echo x > ./private-keys-v1.d/gpg-sample.stamp
4137
4138 ./pubring.gpg: $(srcdir)/pubdemo.asc
4139 -$(GPG) --no-permission-warning \
4140
4141=== added file 'tests/gpg/final.test'
4142--- tests/gpg/final.test 1970-01-01 00:00:00 +0000
4143+++ tests/gpg/final.test 2013-10-23 07:14:02 +0000
4144@@ -0,0 +1,4 @@
4145+#!/bin/sh
4146+
4147+${srcdir}/start-stop-agent --stop
4148+exit 0
4149
4150=== added file 'tests/gpg/initial.test'
4151--- tests/gpg/initial.test 1970-01-01 00:00:00 +0000
4152+++ tests/gpg/initial.test 2013-10-23 07:14:02 +0000
4153@@ -0,0 +1,4 @@
4154+#!/bin/sh
4155+
4156+${srcdir}/start-stop-agent --start
4157+exit 0
4158
4159=== added file 'tests/gpg/start-stop-agent'
4160--- tests/gpg/start-stop-agent 1970-01-01 00:00:00 +0000
4161+++ tests/gpg/start-stop-agent 2013-10-23 07:14:02 +0000
4162@@ -0,0 +1,45 @@
4163+#!/bin/sh
4164+# Copyright (C) 2013 g10 Code GmbH
4165+#
4166+# This file is free software; as a special exception the author gives
4167+# unlimited permission to copy and/or distribute it, with or without
4168+# modifications, as long as this notice is preserved. This file is
4169+# distributed in the hope that it will be useful, but WITHOUT ANY
4170+# WARRANTY, to the extent permitted by law; without even the implied
4171+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4172+
4173+if [ -z "$(command -v gpg-connect-agent)" ]; then
4174+ echo "gpg-agent not installed and thus not started" >&2
4175+ exit 0;
4176+fi
4177+
4178+GPG_AGENT_INFO=
4179+export GPG_AGENT_INFO
4180+
4181+token=$(echo "gpgme-$(pwd)" | tr ' ' '_')
4182+
4183+if [ "$1" = "--stop" ]; then
4184+ if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
4185+ != "D set" ]; then
4186+ echo "gpg-agent not running" >&2
4187+ exit 0
4188+ fi
4189+ echo "stopping gpg-agent " >&2
4190+ gpg-connect-agent KILLAGENT /bye >/dev/null 2>&1
4191+ exit 0
4192+fi
4193+
4194+if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
4195+ = "D set" ]; then
4196+ echo "gpg-agent already running" >&2
4197+ exit 0
4198+fi
4199+
4200+echo "starting gpg-agent " >&2
4201+gpg-connect-agent putval\ $token\ set /bye >/dev/null 2>&1
4202+if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
4203+ != "D set" ]; then
4204+ echo "error starting gpg-agent" >&2
4205+ exit 1
4206+fi
4207+exit 0

Subscribers

People subscribed via source and target branches

to all changes: