From cvs at cvs.gnupg.org Wed Sep 19 21:55:54 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 19 Sep 2012 21:55:54 +0200 Subject: [git] GnuPG - branch, website, created. 5ee4be2dd30cd595d2542619a9a5904d013b7f3e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, website has been created at 5ee4be2dd30cd595d2542619a9a5904d013b7f3e (commit) - Log ----------------------------------------------------------------- commit 5ee4be2dd30cd595d2542619a9a5904d013b7f3e Author: Werner Koch Date: Wed Sep 19 18:49:13 2012 +0200 Initial checkin for the new website diff --git a/README b/README new file mode 100644 index 0000000..f9e6022 --- /dev/null +++ b/README @@ -0,0 +1,6 @@ +This is a separated branch for the gnupg.org website. + +The old website was tracked in a CVS repository but we +want to start the new website form scratch using only the texts data +from the generated HTML files. + diff --git a/web/index.org b/web/index.org new file mode 100644 index 0000000..0e4adbd --- /dev/null +++ b/web/index.org @@ -0,0 +1 @@ +#+STARTUP: showall ----------------------------------------------------------------------- hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Sep 25 20:42:53 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 25 Sep 2012 20:42:53 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.3.2-9-gdb33945 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via db33945ab3b8c173a3fc2dd1a0d22d7fc15d8730 (commit) from c62b79a1d6e576d94e08cb81c2f5dbcb42ecf8cf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit db33945ab3b8c173a3fc2dd1a0d22d7fc15d8730 Author: Werner Koch Date: Tue Sep 25 19:19:13 2012 +0200 Document contribution rules. * doc/HACKING (License policy): New. * doc/DCO: New. * AUTHORS: Change maintainer address. diff --git a/AUTHORS b/AUTHORS index 142b81a..707c106 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,5 @@ Package: gpgme -Maintainer: Marcus Brinkmann +Maintainer: Werner Koch Bug reports: bug-gpgme at gnupg.org Security related bug reports: security at gnupg.org License (software): LGPLv2.1+ @@ -7,7 +7,10 @@ License (manual): GPLv3+ FSF - - Code taken from GnuPG 1.0: gpgme/w32-util.c, GnuPG 1.1: jnlib/. + - Code taken from GnuPG 1.0: src/w32-util.c. + - Other from FSF projects: src/setenv.c, src/vasprintf.c, + src/stpcpy.c, src/w32-ce.c. + g10 Code GmbH - All stuff since mid march 2001. @@ -19,7 +22,7 @@ Wojciech Polak - gpgme.spec - Copyright 2001, 2002 g10 Code GmbH + Copyright 2001, 2002, 2012 g10 Code GmbH This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/README b/README index 7c97791..8b0cc36 100644 --- a/README +++ b/README @@ -111,3 +111,5 @@ in the tests/gpg/ directory may also prove useful. Please subscribe to the gnupg-devel at gnupg.org mailing list if you want to do serious work. + +For hacking on GPGME, please have a look at doc/HACKING. diff --git a/doc/HACKING b/doc/HACKING index 6149d25..aedcf09 100644 --- a/doc/HACKING +++ b/doc/HACKING @@ -2,7 +2,8 @@ #+TITLE: Hacking notes for GPGME #+STARTUP: showall -* No more ChangeLog files +* How to contribute +** No more ChangeLog files Do not modify any of the ChangeLog files in GPGME. Starting on December 1st, 2011 we put change information only in the GIT @@ -12,7 +13,7 @@ be renamed to ChangeLog-2011 -* Commit log requirements +** Commit log requirements Your commit log should always start with a one-line summary, the second line should be blank, and the remaining lines are usually @@ -26,3 +27,54 @@ Note that ./autogen.sh installs a git hook to do some basic syntax checking on the commit log message. + +** License policy + + GPGME is currently licensed under the LGPLv2.1+ with tools and the + manual being under the GPLv3+. We may eventually update to a newer + version of the licenses or a combination of them. It is thus + important, that all contributed code allows for an update of the + license; for example we can't accept code under the LGPLv2(only). + + If you want to contribute code or documentation to GPGME you are + asked to assert that the contribution is in accordance to the "GPGME + Developer's Certificate of Origin" as found in the file "DCO". + Except for a slight wording change, this DCO is identical to the one + used by the Linux kernel. Please take these simple steps: + + - Decide which mail address you want to use. Please have your real + name in the address and not a pseudonym. Anonymous contributions + can only be done if you find a proxy who certifies for you. + + - If your employer or school might claim ownership of code written + by you; you need to talk to them to make sure that you have the + right to contribute under the DCO. + + - Send an OpenPGP signed mail to the gnupg-devel at gnupg.org public + mailing list from your mail address. Include a copy of the DCO as + found in the official master branch. Insert your name and email + address into the DCO in the same way you want to use it later. + Example: + + Signed-off-by: Joe R. Hacker + + If you need it, you may perform simple transformations on the mail + address: Replacing "@" by " at " or "." by " dot ".) + + - That's it. From now on you only need to add a "Signed-off-by:" + line with your name and mail address to the GIT commit message. + It is recommended to send the patches using a PGP/MIME signed + mail. + +** Coding standards + + Please follow the GNU coding standards. If you are in doubt consult + the existing code as an example. Do no re-indent code without a + need. If you really need to do it, use a separate commit for such a + change. + +* Debug hints + + - Use gpgme-tool for manual tests. + - The envvar GPGME_DEBUG enables debugging; see debug.[ch] for + details. diff --git a/doc/Makefile.am b/doc/Makefile.am index 93afc06..19b8c82 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -21,7 +21,7 @@ DISTCLEANFILES = gpgme.tmp -EXTRA_DIST = module-overview.sk HACKING ChangeLog-2011 +EXTRA_DIST = module-overview.sk HACKING DCO ChangeLog-2011 info_TEXINFOS = gpgme.texi gpgme_TEXINFOS = uiserver.texi lesser.texi gpl.texi ----------------------------------------------------------------------- Summary of changes: AUTHORS | 9 +++++-- README | 2 + doc/HACKING | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++- doc/Makefile.am | 2 +- 4 files changed, 63 insertions(+), 6 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Sep 25 20:44:13 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 25 Sep 2012 20:44:13 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.3.2-10-gd230b7c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via d230b7c2f9ad5964c92ee22dc9532d9ac119600a (commit) from db33945ab3b8c173a3fc2dd1a0d22d7fc15d8730 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d230b7c2f9ad5964c92ee22dc9532d9ac119600a Author: Werner Koch Date: Tue Sep 25 19:21:00 2012 +0200 Add DCO file -- diff --git a/doc/DCO b/doc/DCO new file mode 100644 index 0000000..fa62342 --- /dev/null +++ b/doc/DCO @@ -0,0 +1,29 @@ +GPGME Developer's Certificate of Origin. Version 1.0 +===================================================== + +By making a contribution to the GPGME project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the free software license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the + best of my knowledge, is covered under an appropriate free + software license and I have the right under that license to + submit that work with modifications, whether created in whole + or in part by me, under the same free software license + (unless I am permitted to submit under a different license), + as indicated in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including + all personal information I submit with it, including my + sign-off) is maintained indefinitely and may be redistributed + consistent with this project or the free software license(s) + involved. + +Signed-off-by: [Your name and mail address] ----------------------------------------------------------------------- Summary of changes: doc/DCO | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) create mode 100644 doc/DCO hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Sep 26 18:42:07 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 26 Sep 2012 18:42:07 +0200 Subject: [git] KSBA - branch, master, updated. libksba-1.2.0-8-g3776ae8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "KSBA is a library to access X.509 certificates and CMS data.". The branch, master has been updated via 3776ae8f4ea642ad6ac0af726e90492e6f82eb5f (commit) via 120d58757d43d10278d4f5ec4126bc18d2ccd28a (commit) from d4333eefc945750613ac9483a41793b5971e3cfe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3776ae8f4ea642ad6ac0af726e90492e6f82eb5f Author: Werner Koch Date: Wed Sep 26 17:17:21 2012 +0200 Allow building with w64-mingw32 * autogen.sh <--build-w32>: Support the w64-mingw32 toolchain. Also prepare for 64 bit building. diff --git a/autogen.sh b/autogen.sh index 86d0f95..17c3380 100755 --- a/autogen.sh +++ b/autogen.sh @@ -64,6 +64,10 @@ case "$1" in myhost="w32" myhostsub="ce" ;; + --build-w64) + myhost="w32" + myhostsub="64" + ;; --build*) echo "**Error**: invalid build option $1" >&2 exit 1 @@ -91,9 +95,14 @@ if [ "$myhost" = "w32" ]; then [ -z "$w32root" ] && w32root="$HOME/w32ce_root" toolprefixes="arm-mingw32ce" ;; + 64) + w32root="$w64root" + [ -z "$w32root" ] && w32root="$HOME/w64root" + toolprefixes="amd64-mingw32msvc" + ;; *) [ -z "$w32root" ] && w32root="$HOME/w32root" - toolprefixes="i586-mingw32msvc i386-mingw32msvc" + toolprefixes="i586-mingw32msvc i386-mingw32msvc i686-w64-mingw32" ;; esac echo "Using $w32root as standard install directory" >&2 commit 120d58757d43d10278d4f5ec4126bc18d2ccd28a Author: Werner Koch Date: Wed Sep 26 17:09:33 2012 +0200 Switch to the new automagic beta numbering scheme. * configure.ac: Add all the required m4 magic. diff --git a/configure.ac b/configure.ac index 1a932b5..9f6fef7 100644 --- a/configure.ac +++ b/configure.ac @@ -22,20 +22,28 @@ AC_PREREQ(2.61) min_automake_version="1.10" -# Remember to change the version number immediately *after* a release. -# Set my_issvn to "yes" for non-released code. Remember to run an -# "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [1.3.0]) -m4_define([my_issvn], [yes]) - -m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ - | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) -m4_define([git_revision], m4_esyscmd([git branch -v 2>/dev/null \ +# To build a release you need to create a tag with the version number +# (git tag -s libksba-n.m.k) and run "./autogen.sh --force". Please +# bump the version number immediately after the release and do another +# commit and push so that the git magic is able to work. See below +# for the LT versions. +m4_define(mym4_version, [1.3.0]) + +# Below is m4 magic to extract and compute the revision number, the +# decimalized short revision number, a beta version string, and a flag +# indicating a development version (mym4_isgit). Note that the m4 +# processing is done by autoconf and not during the configure run. +m4_define([mym4_revision], m4_esyscmd([git branch -v 2>/dev/null \ | awk '/^\* / {printf "%s",$3}'])) -m4_define([my_full_version], [my_version[]m4_if(my_issvn,[yes], - [m4_if(git_revision,[],[-svn[]svn_revision],[-git[]git_revision])])]) +m4_define([mym4_revision_dec], + m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))])) +m4_define([mym4_betastring], + m4_esyscmd_s([git describe --match 'libksba-[0-9].*[0-9]' --long|\ + awk -F- '$3!=0{print"-beta"$3}'])) +m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes])) +m4_define([mym4_full_version],[mym4_version[]mym4_betastring]) -AC_INIT([libksba],[my_full_version],[http://bugs.gnupg.org]) +AC_INIT([libksba],[mym4_full_version],[http://bugs.gnupg.org]) # LT Version numbers: Remember to change them just *before* a release. # (Interfaces removed: CURRENT++, AGE=0, REVISION=0) @@ -53,8 +61,6 @@ KSBA_CONFIG_API_VERSION=1 NEED_GPG_ERROR_VERSION=1.8 -m4_define([git_brevis],m4_esyscmd(printf "%u" 0x[]m4_substr(git_revision,0,4))) -BUILD_REVISION=m4_if(git_revision,[],[svn_revision],[git_brevis]) PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION @@ -376,13 +382,15 @@ if test "$have_w32_system" = yes; then changequote(,)dnl BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` changequote([,])dnl - BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}" + BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec" fi AC_SUBST(BUILD_REVISION) AC_SUBST(BUILD_TIMESTAMP) AC_SUBST(BUILD_FILEVERSION) +BUILD_REVISION="mym4_revision" +AC_SUBST(BUILD_REVISION) AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION", - [Subversion revision used to build this package]) + [GIT commit id revision used to build this package]) AC_CONFIG_FILES([ diff --git a/src/versioninfo.rc.in b/src/versioninfo.rc.in index 182e195..9828456 100644 --- a/src/versioninfo.rc.in +++ b/src/versioninfo.rc.in @@ -18,7 +18,7 @@ VS_VERSION_INFO VERSIONINFO - FILEVERSION @LIBKSBA_LT_CURRENT@, at LIBKSBA_LT_AGE@, at LIBKSBA_LT_REVISION@, at BUILD_REVISION@ + FILEVERSION @BUILD_FILEVERSION@ PRODUCTVERSION @BUILD_FILEVERSION@ FILEFLAGSMASK 0x3fL #ifdef _DEBUG ----------------------------------------------------------------------- Summary of changes: autogen.sh | 11 ++++++++++- configure.ac | 40 ++++++++++++++++++++++++---------------- src/versioninfo.rc.in | 2 +- 3 files changed, 35 insertions(+), 18 deletions(-) hooks/post-receive -- KSBA is a library to access X.509 certificates and CMS data. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Sep 27 18:05:18 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 27 Sep 2012 18:05:18 +0200 Subject: [git] KSBA - branch, master, updated. libksba-1.2.0-12-gea84874 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "KSBA is a library to access X.509 certificates and CMS data.". The branch, master has been updated via ea8487406ecafbcf190008b6c8a5c8e7c63ed6b8 (commit) from 1533a9662128fca669eeb661308939cdc8e5d74b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ea8487406ecafbcf190008b6c8a5c8e7c63ed6b8 Author: Werner Koch Date: Thu Sep 27 16:20:54 2012 +0200 Release 1.3.0 * configure.ac: Set LT version to C19/A11/R1. diff --git a/NEWS b/NEWS index 16b56a4..f0c6f37 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,10 @@ -Noteworthy changes in version 1.3.0 (unreleased) +Noteworthy changes in version 1.3.0 (2012-09-27) ------------------------------------------------ - * Changed the license of the library from GPLv3 to a LGPLv3/GPLv2; - see the file AUTHORS for details. + * Changed the license of the library from GPLv3 to LGPLv3/GPLv2; see + the file AUTHORS for details. - * Minor bug fixes + * Minor bug fixes. Noteworthy changes in version 1.2.0 (2011-03-01) diff --git a/README.SVN b/README.GIT similarity index 82% rename from README.SVN rename to README.GIT index ae17923..ee2c638 100644 --- a/README.SVN +++ b/README.GIT @@ -1,9 +1,11 @@ -If you are building from CVS, run the script +If you are building from GIT, run the script ./autogen.sh first, to make sure that you have all the necessary maintainer tools -are installed and to build the actual configuration files. Then run +are installed and to build the actual configuration files. If you +have just checked out from GIT, you should add the option "--force" to +autogen.sh so that meta data is noticed by autom4te.cache. Then run ./configure --enable-maintainer-mode @@ -14,7 +16,7 @@ tools, or the tools are not installed, you may use environment variables to override the default tool names: AUTOMAKE_SUFFIX is used as a suffix for all tools from the automake - package. For example + package. For example AUTOMAKE_SUFFIX="-1.7" ./autogen.sh uses "automake-1.7" and "aclocal-1.7. AUTOMAKE_PREFIX is used as a prefix for all tools from the automake @@ -35,17 +37,13 @@ It is also possible to use the variable name AUTOMAKE, AUTOCONF, ACLOCAL, AUTOHEADER, GETTEXT and MSGMERGE to directly specify the name of the programs to run. It is however better to use the suffix and prefix forms as described above because that does not require -knowledge about the actual tools used by autgen.sh. +knowledge about the actual tools used by autogen.sh. Please don't use autopoint, libtoolize or autoreconf unless you are the current maintainer and want to update the standard configuration -files. All those files should be in the CVS and only updated manually +files. All those files should be in GIT and only updated manually if the maintainer decides that newer versions are required. The maintainer should also make sure that the required version of automake et al. are properly indicated at the top of configure.ac and take care to copy the files and not merely use symlinks. - - - - diff --git a/configure.ac b/configure.ac index 5ae69b6..08a2552 100644 --- a/configure.ac +++ b/configure.ac @@ -52,7 +52,7 @@ AC_INIT([libksba],[mym4_full_version],[http://bugs.gnupg.org]) # Please remember to document interface changes in the NEWS file. LIBKSBA_LT_CURRENT=19 LIBKSBA_LT_AGE=11 -LIBKSBA_LT_REVISION=0 +LIBKSBA_LT_REVISION=1 #------------------- # If the API is changed in an incompatible way: increment the next counter. KSBA_CONFIG_API_VERSION=1 ----------------------------------------------------------------------- Summary of changes: NEWS | 8 ++++---- README.SVN => README.GIT | 16 +++++++--------- configure.ac | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) rename README.SVN => README.GIT (82%) hooks/post-receive -- KSBA is a library to access X.509 certificates and CMS data. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Sep 27 18:08:17 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 27 Sep 2012 18:08:17 +0200 Subject: [git] KSBA - branch, master, updated. libksba-1.3.0-1-g31f4cbe Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "KSBA is a library to access X.509 certificates and CMS data.". The branch, master has been updated via 31f4cbeb71b463a80f6d7842ac5e4df4f5c9d829 (commit) from ea8487406ecafbcf190008b6c8a5c8e7c63ed6b8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 31f4cbeb71b463a80f6d7842ac5e4df4f5c9d829 Author: Werner Koch Date: Thu Sep 27 16:45:02 2012 +0200 Post release updates -- diff --git a/NEWS b/NEWS index f0c6f37..d8bf107 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.3.1 (unreleased) +------------------------------------------------ + + Noteworthy changes in version 1.3.0 (2012-09-27) ------------------------------------------------ diff --git a/configure.ac b/configure.ac index 08a2552..e6de2a2 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ min_automake_version="1.10" # bump the version number immediately after the release and do another # commit and push so that the git magic is able to work. See below # for the LT versions. -m4_define(mym4_version, [1.3.0]) +m4_define(mym4_version, [1.3.1]) # Below is m4 magic to extract and compute the revision number, the # decimalized short revision number, a beta version string, and a flag ----------------------------------------------------------------------- Summary of changes: NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) hooks/post-receive -- KSBA is a library to access X.509 certificates and CMS data. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Sep 28 09:56:53 2012 From: cvs at cvs.gnupg.org (by W. Trevor King) Date: Fri, 28 Sep 2012 09:56:53 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.3.2-13-g3d69b51 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 3d69b51f7f083193db28f364da4590c33b5e44e6 (commit) via dda3702a9024a08da7bb949e15b63a47d23d59f5 (commit) via 193eb62538b9413e0dfbd04c075f871d5aa9130b (commit) from d230b7c2f9ad5964c92ee22dc9532d9ac119600a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3d69b51f7f083193db28f364da4590c33b5e44e6 Author: W. Trevor King Date: Fri Sep 28 08:31:13 2012 +0200 gpgme-tool: Return more detailed XML from KEYLIST src/gpgme-tool.c (cmd_keylist): Convert output from a list of to more detailed XML. (xml_preamble1, xml_preamble2, xml_end): Make global. (result_add_protocol, result_add_validity): New functions for generating XML from GPGME types. (result_add_string): Treat NULL strings as "". (result_xml_tag_data): Make 'data' a 'const char' so we can use the value returned by gpgme_get_protocol_name directly. -- This is a first pass at returning most of the gpgme_key_t data from the KEYLIST call. Signed-off-by: W. Trevor King diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 19dedb6..23122e8 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -565,6 +565,12 @@ skip_options (char *line) typedef gpg_error_t (*result_xml_write_cb_t) (void *hook, const void *buf, size_t len); +static char xml_preamble1[] = "\n"; +static const char xml_preamble2[] = "\n"; +static const char xml_end[] = "\n"; + + struct result_xml_state { int indent; @@ -653,7 +659,7 @@ result_xml_tag_start (struct result_xml_state *state, char *name, ...) gpg_error_t -result_xml_tag_data (struct result_xml_state *state, char *data) +result_xml_tag_data (struct result_xml_state *state, const char *data) { result_xml_write_cb_t cb = state->cb; void *hook = state->hook; @@ -813,6 +819,60 @@ result_add_sig_mode (struct result_xml_state *state, char *name, gpg_error_t +result_add_protocol (struct result_xml_state *state, char *name, + gpgme_protocol_t protocol) +{ + const char *str; + char code[20]; + + snprintf (code, sizeof (code) - 1, "%i", protocol); + str = gpgme_get_protocol_name(protocol); + if (!str) + str = "invalid"; + result_xml_tag_start (state, name, "value", code, NULL); + result_xml_tag_data (state, str); + result_xml_tag_end (state); + return 0; +} + + +gpg_error_t +result_add_validity (struct result_xml_state *state, char *name, + gpgme_validity_t validity) +{ + const char *str; + char code[20]; + + snprintf (code, sizeof (code) - 1, "%i", validity); + switch (validity) + { + case GPGME_VALIDITY_UNDEFINED: + str ="undefined"; + break; + case GPGME_VALIDITY_NEVER: + str ="never"; + break; + case GPGME_VALIDITY_MARGINAL: + str ="marginal"; + break; + case GPGME_VALIDITY_FULL: + str ="full"; + break; + case GPGME_VALIDITY_ULTIMATE: + str ="ultimate"; + break; + default: + str ="unknown"; + } + + result_xml_tag_start (state, name, "value", code, NULL); + result_xml_tag_data (state, str); + result_xml_tag_end (state); + return 0; +} + + +gpg_error_t result_add_value (struct result_xml_state *state, char *name, unsigned int val) { @@ -829,6 +889,8 @@ gpg_error_t result_add_string (struct result_xml_state *state, char *name, char *str) { + if (!str) + str = ""; result_xml_tag_start (state, name, NULL); result_xml_tag_data (state, str); result_xml_tag_end (state); @@ -1820,10 +1882,6 @@ gt_passwd (gpgme_tool_t gt, char *fpr) gpg_error_t gt_result (gpgme_tool_t gt, unsigned int flags) { - static const char xml_preamble1[] = "\n"; - static const char xml_preamble2[] = "\n"; - static const char xml_end[] = "\n"; int indent = 2; gt_write_data (gt, xml_preamble1, sizeof (xml_preamble1)); @@ -2840,9 +2898,11 @@ cmd_keylist (assuan_context_t ctx, char *line) { #define MAX_CMD_KEYLIST_PATTERN 20 struct server *server = assuan_get_pointer (ctx); + gpgme_tool_t gt = server->gt; + struct result_xml_state state; gpg_error_t err; int secret_only = 0; - int idx; + int idx, indent=2; const char *pattern[MAX_CMD_KEYLIST_PATTERN+1]; const char optstr[] = "--secret-only"; char *p; @@ -2872,10 +2932,19 @@ cmd_keylist (assuan_context_t ctx, char *line) } pattern[idx] = NULL; + gt_write_data (gt, xml_preamble1, sizeof (xml_preamble1)); + gt_write_data (gt, NULL, 0); + gt_write_data (gt, xml_preamble2, sizeof (xml_preamble2)); + gt_write_data (gt, NULL, 0); + result_init (&state, indent, (result_xml_write_cb_t) gt_write_data, gt); + result_xml_tag_start (&state, "keylist", NULL); + err = gt_keylist_start (server->gt, pattern, secret_only); while (! err) { gpgme_key_t key; + gpgme_subkey_t subkey; + gpgme_user_id_t uid; err = gt_keylist_next (server->gt, &key); if (gpg_err_code (err) == GPG_ERR_EOF) @@ -2885,18 +2954,55 @@ cmd_keylist (assuan_context_t ctx, char *line) } else if (! err) { - char buf[100]; - /* FIXME: More data. */ - snprintf (buf, sizeof (buf), "key:%s\n", key->subkeys->fpr); - /* Write data and flush so that we see one D line for each - key. This does not change the semantics but is easier to - read by organic eyes. */ - if (!assuan_send_data (ctx, buf, strlen (buf))) - assuan_send_data (ctx, NULL, 0); + result_xml_tag_start (&state, "key", NULL); + result_add_value (&state, "revoked", key->revoked); + result_add_value (&state, "expired", key->expired); + result_add_value (&state, "disabled", key->disabled); + result_add_value (&state, "invalid", key->invalid); + result_add_value (&state, "can-encrypt", key->can_encrypt); + result_add_value (&state, "can-sign", key->can_sign); + result_add_value (&state, "can-certify", key->can_certify); + result_add_value (&state, "can-authenticate", key->can_authenticate); + result_add_value (&state, "is-qualified", key->is_qualified); + result_add_value (&state, "secret", key->secret); + result_add_protocol (&state, "protocol", key->protocol); + result_xml_tag_start (&state, "issuer", NULL); + result_add_string (&state, "serial", key->issuer_serial); + result_add_string (&state, "name", key->issuer_name); + result_xml_tag_end (&state); /* issuer */ + result_add_string (&state, "chain_id", key->chain_id); + result_add_validity (&state, "owner-trust", key->owner_trust); + result_xml_tag_start (&state, "subkeys", NULL); + subkey = key->subkeys; + while (subkey) { + result_xml_tag_start (&state, "subkey", NULL); + /* FIXME: more data */ + result_add_fpr (&state, "fpr", subkey->fpr); + result_xml_tag_end (&state); /* subkey */ + subkey = subkey->next; + } + result_xml_tag_end (&state); /* subkeys */ + result_xml_tag_start (&state, "uids", NULL); + uid = key->uids; + while (uid) { + result_xml_tag_start (&state, "uid", NULL); + /* FIXME: more data */ + result_add_string (&state, "uid", uid->uid); + result_add_string (&state, "name", uid->name); + result_add_string (&state, "email", uid->email); + result_add_string (&state, "comment", uid->comment); + result_xml_tag_end (&state); /* uid */ + uid = uid->next; + } + result_xml_tag_end (&state); /* uids */ + result_xml_tag_end (&state); /* key */ gpgme_key_unref (key); } } + result_xml_tag_end (&state); /* keylist */ + gt_write_data (gt, xml_end, sizeof (xml_end)); + server_reset_fds (server); return err; commit dda3702a9024a08da7bb949e15b63a47d23d59f5 Author: W. Trevor King Date: Wed Sep 26 19:26:00 2012 -0400 gpgme-tool: Initialize input_fd and output_fd * src/gpgme-tool.c (gpgme_server): Initialize input_fd and output_fd. Signed-off-by: W. Trevor King diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 3a02065..19dedb6 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -3121,6 +3121,8 @@ gpgme_server (gpgme_tool_t gt) static const char hello[] = ("GPGME-Tool " VERSION " ready"); memset (&server, 0, sizeof (server)); + server.input_fd = ASSUAN_INVALID_FD; + server.output_fd = ASSUAN_INVALID_FD; server.message_fd = ASSUAN_INVALID_FD; server.input_enc = GPGME_DATA_ENCODING_NONE; server.output_enc = GPGME_DATA_ENCODING_NONE; commit 193eb62538b9413e0dfbd04c075f871d5aa9130b Author: Werner Koch Date: Wed Sep 26 09:37:22 2012 +0200 gpgme-tool: Fix handling of file descriptors * src/gpgme-tool.c (server_reset_fds): Use close/CloseHandle instead of the assuan close functions. (_cmd_decrypt_verify, _cmd_sign_encrypt, cmd_verify, cmd_import) (cmd_export, cmd_genkey, cmd_getauditlog): Use SERVER object instead of assuan_get_*_fd functions. -- Although we used our own handlers for INPUT and OUTPUT, we still used assuan_get_input_fd, assuan_get_output_fd and their close functions. That clearly can't work because libassuan does not have any values for them. diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 75b7c9e..3a02065 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -1900,7 +1900,10 @@ server_write_data (void *hook, const void *buf, size_t len) } - +/* Wrapper around assuan_command_parse_fd to also handle a + "file=FILENAME" argument. On success either a filename is returned + at FILENAME or a file descriptor at RFD; the other one is set to + NULL respective ASSUAN_INVALID_FD. */ static gpg_error_t server_parse_fd (assuan_context_t ctx, char *line, assuan_fd_t *rfd, char **filename) @@ -1974,8 +1977,24 @@ server_reset_fds (struct server *server) /* assuan closes the input and output FDs for us when doing a RESET, but we use this same function after commands, so repeat it here. */ - assuan_close_input_fd (server->assuan_ctx); - assuan_close_output_fd (server->assuan_ctx); + if (server->input_fd != ASSUAN_INVALID_FD) + { +#if HAVE_W32_SYSTEM + CloseHandle (server->input_fd); +#else + close (server->input_fd); +#endif + server->input_fd = ASSUAN_INVALID_FD; + } + if (server->output_fd != ASSUAN_INVALID_FD) + { +#if HAVE_W32_SYSTEM + CloseHandle (server->output_fd); +#else + close (server->output_fd); +#endif + server->output_fd = ASSUAN_INVALID_FD; + } if (server->message_fd != ASSUAN_INVALID_FD) { /* FIXME: Assuan should provide a close function. */ @@ -2331,11 +2350,11 @@ _cmd_decrypt_verify (assuan_context_t ctx, char *line, int verify) gpgme_data_t inp_data; gpgme_data_t out_data; - inp_fd = assuan_get_input_fd (ctx); + inp_fd = server->input_fd; inp_fn = server->input_filename; if (inp_fd == ASSUAN_INVALID_FD && !inp_fn) return GPG_ERR_ASS_NO_INPUT; - out_fd = assuan_get_output_fd (ctx); + out_fd = server->output_fd; out_fn = server->output_filename; if (out_fd == ASSUAN_INVALID_FD && !out_fn) return GPG_ERR_ASS_NO_OUTPUT; @@ -2411,9 +2430,9 @@ _cmd_sign_encrypt (assuan_context_t ctx, char *line, int sign) if (strstr (line, "--expect-sign")) flags |= GPGME_ENCRYPT_EXPECT_SIGN; - inp_fd = assuan_get_input_fd (ctx); + inp_fd = server->input_fd; inp_fn = server->input_filename; - out_fd = assuan_get_output_fd (ctx); + out_fd = server->output_fd; out_fn = server->output_filename; if (inp_fd != ASSUAN_INVALID_FD || inp_fn) { @@ -2502,11 +2521,11 @@ cmd_sign (assuan_context_t ctx, char *line) if (strstr (line, "--detach")) mode = GPGME_SIG_MODE_DETACH; - inp_fd = assuan_get_input_fd (ctx); + inp_fd = server->input_fd; inp_fn = server->input_filename; if (inp_fd == ASSUAN_INVALID_FD && !inp_fn) return GPG_ERR_ASS_NO_INPUT; - out_fd = assuan_get_output_fd (ctx); + out_fd = server->output_fd; out_fn = server->output_filename; if (out_fd == ASSUAN_INVALID_FD && !out_fn) return GPG_ERR_ASS_NO_OUTPUT; @@ -2555,13 +2574,13 @@ cmd_verify (assuan_context_t ctx, char *line) gpgme_data_t msg_data = NULL; gpgme_data_t out_data = NULL; - inp_fd = assuan_get_input_fd (ctx); + inp_fd = server->input_fd; inp_fn = server->input_filename; if (inp_fd == ASSUAN_INVALID_FD && !inp_fn) return GPG_ERR_ASS_NO_INPUT; msg_fd = server->message_fd; msg_fn = server->message_filename; - out_fd = assuan_get_output_fd (ctx); + out_fd = server->output_fd; out_fn = server->output_filename; err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data, @@ -2628,7 +2647,7 @@ cmd_import (assuan_context_t ctx, char *line) char *inp_fn; gpgme_data_t inp_data; - inp_fd = assuan_get_input_fd (ctx); + inp_fd = server->input_fd; inp_fn = server->input_filename; if (inp_fd == ASSUAN_INVALID_FD && !inp_fn) return GPG_ERR_ASS_NO_INPUT; @@ -2664,7 +2683,7 @@ cmd_export (assuan_context_t ctx, char *line) gpgme_export_mode_t mode = 0; const char *pattern[2]; - out_fd = assuan_get_output_fd (ctx); + out_fd = server->output_fd; out_fn = server->output_filename; if (out_fd == ASSUAN_INVALID_FD && !out_fn) return GPG_ERR_ASS_NO_OUTPUT; @@ -2724,11 +2743,11 @@ cmd_genkey (assuan_context_t ctx, char *line) gpgme_data_t parms_data = NULL; const char *parms; - inp_fd = assuan_get_input_fd (ctx); + inp_fd = server->input_fd; inp_fn = server->input_filename; if (inp_fd == ASSUAN_INVALID_FD && !inp_fn) return GPG_ERR_ASS_NO_INPUT; - out_fd = assuan_get_output_fd (ctx); + out_fd = server->output_fd; out_fn = server->output_filename; err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data, @@ -2899,7 +2918,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line) gpgme_data_t out_data; unsigned int flags = 0; - out_fd = assuan_get_output_fd (ctx); + out_fd = server->output_fd; out_fn = server->output_filename; if (out_fd == ASSUAN_INVALID_FD && !out_fn) return GPG_ERR_ASS_NO_OUTPUT; ----------------------------------------------------------------------- Summary of changes: src/gpgme-tool.c | 187 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 157 insertions(+), 30 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org