Page MenuHome GnuPG

No OneTemporary

diff --git a/ChangeLog b/ChangeLog
index 8eace55..dc5507d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,132 +1,138 @@
+2010-04-20 Marcus Brinkmann <marcus@g10code.de>
+
+ * configure.ac: Bump version to 0.9.6.
+ (NEED_LIBASSUAN_API): Bump to 2.
+ (NEED_LIBASSAUN_VERSION): Bump to 2.0.0.
+
2010-04-20 Emanuel Schütze <emanuel@intevation.de>
* po/de.po: Use "pruefen" instead "ueberpruefen" for signatures.
2010-01-08 Marcus Brinkmann <marcus@g10code.de>
* Release 0.9.5.
2009-12-26 Marcus Brinkmann <marcus@g10code.de>
* Release 0.9.4.
2009-08-04 Marcus Brinkmann <marcus@g10code.de>
* doc/gpgex-en.html, doc/gpgex-de.html: Add link to Kleo manual.
2009-07-31 Emanuel Schütze <emanuel@intevation.de>
* doc/gpgex-de.html, doc/gpgex-en.html: Remove checksum text,
improve documentation for debug message.
2009-03-24 Werner Koch <wk@g10code.com>
Release 0.9.3.
2009-03-10 Marcus Brinkmann <marcus@g10code.de>
* po/de.po, po/es.po, po/ru.po, po/ar.po: Change encrypt&sign to
sign&encrypt everywhere.
2009-01-28 Werner Koch <wk@g10code.com>
Release 0.9.2.
2009-01-22 Werner Koch <wk@g10code.com>
* po/de.po: Change "verifizeren" to "überprüfen".
2008-06-04 Werner Koch <wk@g10code.com>
* doc/gpgex.texi (Assuan Protocol): Replace the spec by a
reference to the gpgme manual.
2008-03-26 Marcus Brinkmann <marcus@g10code.de>
Released 0.9.0.
* po/LINGUAS: Add ar, es, ru.
* Makefile.am (AUTOMAKE_OPTIONS): Add no-dist-gzip.
* configure.ac: Prepare for release of 0.9.0.
* po/ar.po, po/es.po, po/ru.po: New files.
* po/de.po: Fix newline.
2007-11-26 Marcus Brinkmann <marcus@g10code.de>
* doc/gpgex-de.html, doc/gpgex-en.html: Add FIXME entries for
missing hyperlinks.
2007-11-12 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (WINVER): New symbol.
2007-11-08 Marcus Brinkmann <marcus@g10code.de>
* po/de.po: Update.
* doc/gpgex-de.html, doc/gpgex-en.html: New files.
* doc/Makefile.am (dist_doc_DATA): New variable.
* doc/gpgex.texi: Complete protocol change from INPUT FILE to
FILE. Also from IMPORT to IMPORT_FILES.
2007-11-02 Werner Koch <wk@g10code.com>
* autogen.sh: Add --force option.
* doc/gpgex.texi: Protocol change s/"INPUT FILE"/"FILE"/.
2007-10-08 Marcus Brinkmann <marcus@g10code.de>
* doc/gpgex.texi (Certificate management): New section
* po/de.po: Convert to UTF-8.
* autogen.sh: Add --add-missing to automake invocation.
* configure.ac (AC_CONFIG_FILES): Add doc/Makefile.
* Makefile.am (SUBDIRS): Add doc.
* doc/: New directory.
2007-10-05 Marcus Brinkmann <marcus@g10code.de>
* po/de.po: Fix translation.
* po/de.po: Update.
2007-09-11 Marcus Brinkmann <marcus@g10code.de>
* po/de.po: Update.
* po/de.po: New file.
* po/LINGUAS: Add de.
* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Add
--with-libassuan-prefix and --with-gpg-error-prefix.
2007-09-04 Marcus Brinkmann <marcus@g10code.de>
* m4/libassuan.m4, m4/gpg-error.m4: New files.
* configure.ac: Check for libgpg-error and libassuan.
* po/POTFILES.in: Add src/client.cc, src/gpgex.h and src/gpgex.cc.
2007-09-03 Marcus Brinkmann <marcus@g10code.de>
* m4/Makefile.am (EXTRA_DIST): Remove gpgme.m4 and gpg-error.m4.
2007-08-23 Marcus Brinkmann <marcus@g10code.de>
* Initial commit.
Copyright 2007 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
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/configure.ac b/configure.ac
index f546bda..53ccd7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,246 +1,246 @@
# configure.ac - for GpgEX
# Copyright (C) 2005, 2006, 2007 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
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
min_automake_version="1.9.4"
# 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], [0.9.5])
+m4_define([my_version], [0.9.6])
m4_define([my_issvn], [no])
m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \
|| echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
AC_INIT([gpgex], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
[bug-gpgex@g10code.com])
SVN_REVISION=svn_revision
PACKAGE=$PACKAGE_NAME
PACKAGE_GT=${PACKAGE_NAME}
VERSION=$PACKAGE_VERSION
NEED_GPG_ERROR_VERSION=1.4
-NEED_LIBASSUAN_API=1
-NEED_LIBASSUAN_VERSION=0.9.3
+NEED_LIBASSUAN_API=2
+NEED_LIBASSUAN_VERSION=2.0.0
AC_CONFIG_SRCDIR(src/gpgex.def)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_GNU_SOURCE
have_gpg_error=no
have_libassuan=no
AC_SUBST(PACKAGE)
AC_SUBST(PACKAGE_GT)
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
[Name of this package for gettext])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
[Bug report address])
BUILD_TIMESTAMP=`date --iso-8601=minutes`
AC_SUBST(BUILD_TIMESTAMP)
changequote(,)dnl
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}${SVN_REVISION}"
AC_SUBST(BUILD_FILEVERSION)
AH_BOTTOM([
/* Some global constants. */
/* Force using of NLS for W32 even if no libintl has been found. This is
okay because we have our own gettext implementation for W32. */
#if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
#define ENABLE_NLS 1
#endif
])
AM_MAINTAINER_MODE
# Checks for programs.
AC_PROG_MAKE_SET
AM_SANITY_CHECK
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_CHECK_TOOL(AR, ar, :)
AC_CHECK_TOOL(DLLTOOL, dlltool, :)
AC_CHECK_TOOL(WINDRES, windres, :)
have_dosish_system=no
have_w32_system=no
case "${host}" in
*-mingw32*)
# special stuff for Windoze NT
AC_DEFINE(HAVE_DRIVE_LETTERS,1,
[defined if we must run on a stupid file system])
have_dosish_system=yes
have_w32_system=yes
;;
*)
AC_MSG_ERROR([[
***
*** This software my only be build for W32 systems. Use
*** ./autogen.sh --build-w32
*** to prepare it for such a build.
***]])
;;
esac
if test "$have_dosish_system" = yes; then
AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
[Defined if we run on some of the PCDOS like systems
(DOS, Windoze. OS/2) with special properties like
no file modes])
fi
AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
#
# Checks for libraries.
#
# Note, that autogen.sh greps for the next line.
AM_GNU_GETTEXT_VERSION(0.12.1)
AM_GNU_GETTEXT([external])
# We always want NLs, despite what the above macro figures out.
USE_NLS=yes
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
AC_CHECK_FUNCS(stpcpy)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
# Add some extra libs here so that previous tests don't fail for
# mysterious reasons - the final link step should bail out.
if test "$have_w32_system" = yes; then
W32LIBS="-lwsock32"
fi
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -mms-bitfields"
CXXFLAGS="$CXXFLAGS -Wall -mms-bitfields"
if test "$USE_MAINTAINER_MODE" = "yes"; then
CFLAGS="$CFLAGS -Wcast-align -Wshadow -Wstrict-prototypes"
CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security"
CXXFLAGS="$CXXFLAGS -Wcast-align -Wshadow"
CXXFLAGS="$CXXFLAGS -Wno-format-y2k -Wformat-security"
fi
fi
AC_SUBST(W32LIBS)
#
# libgpg-error is a library with error codes shared between GnuPG
# related projects.
#
AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
have_gpg_error=yes,have_gpg_error=no)
AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_USER_1,
[The default error source for GpgEX.])
# We need the declaration for the function GetUserDefaultUILanguage
# and AllowSetForegroundWindow.
AC_DEFINE(WINVER, 0x500, [Version of Windows API])
#
# libassuan is used for IPC
#
AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
have_libassuan=yes,have_libassuan=no)
AH_BOTTOM([
/* We don't want the old assuan codes anymore. */
#define _ASSUAN_ONLY_GPG_ERRORS 1
])
#
# Print errors here so that they are visible all
# together and the user can acquire them all together.
#
die=no
if test "$have_gpg_error" = "no"; then
die=yes
AC_MSG_NOTICE([[
***
*** You need libgpg-error to build this program.
** This library is for example available at
*** ftp://ftp.gnupg.org/pub/gcrypt/libgpg-error
*** (at least version $NEED_GPG_ERROR_VERSION is required.)
***]])
fi
if test "$have_libassuan" = "no"; then
die=yes
AC_MSG_NOTICE([[
***
*** You need libassuan to build this program.
*** This library is for example available at
*** ftp://ftp.gnupg.org/pub/gcrypt/libassuan/
*** (at least version $NEED_LIBASSUAN_VERSION is required).
***]])
fi
if test "$die" = "yes"; then
AC_MSG_ERROR([[
***
*** Required libraries not found. Please consult the above messages
*** and install them before running configure again.
***]])
fi
AC_CONFIG_FILES([ Makefile
doc/Makefile
src/Makefile
src/versioninfo.rc
po/Makefile.in
m4/Makefile
])
AC_OUTPUT
diff --git a/src/ChangeLog b/src/ChangeLog
index b5a306b..074718e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,297 +1,303 @@
+2010-04-20 Marcus Brinkmann <marcus@g10code.de>
+
+ * client.cc (getinfo_pid_cb): Return gpg_error_t.
+ (uiserver_connect): Port to new assuan interface.
+ * main.cc (DllMain): Likewise.
+
2010-02-10 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (gpgex_t::Initialize): Default to sign/encrypt if a
file or directory name has no suffix.
2010-01-08 Marcus Brinkmann <marcus@g10code.de>
* icon-lock-12.bmp, icon-lock-16.bmp: Update.
2009-12-26 Marcus Brinkmann <marcus@g10code.de>
* icon-lock-12.bmp, icon-lock-16.bmp: New files.
* Makefile.am (ICON_NAMES): Add lock.
* icons.rc: Add lock icons.
* gpgex.h (class gpgex_t): Use "Lock" icon instead of "Key".
2009-07-17 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (start_help): Do not cripple the browser window.
2009-03-10 Marcus Brinkmann <marcus@g10code.de>
* client.h, client.cc, gpgex.cc: Change encrypt&sign to
sign&encrypt everywhere (except in the protocol, of course).
2009-02-11 Marcus Brinkmann <marcus@g10code.de>
* bitmaps.cc (load_bitmap): Change minus to underscore.
* icons.rc: Likewise in identifiers.
2008-09-01 Marcus Brinkmann <marcus@g10code.com>
* gpgex.cc (Initialize): Also pay attention to endings pem, p7m
and p7s.
2008-03-26 Marcus Brinkmann <marcus@g10code.de>
* client.cc (default_uiserver_cmdline): Fall back to GPA if
Kleopatra is not installed.
2008-02-19 Marcus Brinkmann <marcus@g10code.de>
* client.cc (default_uiserver_cmdline): Change default uiserver
path and remove work-around.
2008-02-05 Marcus Brinkmann <marcus@g10code.de>
* debug.h: Include <stdio.h>.
(debug_file, debug_flags): New prototypes.
* main.cc (debug_file, debug_flags): Make not static.
* client.cc (uiserver_connect): Fix last change. Set debug log
stream.
2008-02-04 Marcus Brinkmann <marcus@g10code.de>
* client.cc (send_one_option, getinfo_pid_cb, send_options): New
functions.
(uiserver_connect): Take new argument HWND. Call send_options.
(client_t::call_assuan): Pass window handle to uiserver_connect.
2008-01-07 Marcus Brinkmann <marcus@g10code.de>
* client.cc (default_uiserver_cmdline): Invoke GUI server with
--daemon.
(replace_dollar_s): Remove obsolete function.
2007-11-30 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (start_help): Fix URL string format.
2007-11-16 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (start_help): Fix URL for Windows Exploder.
2007-11-12 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (get_lang_name): Fix last change.
* gpgex.cc (get_lang_name): Get preferred language.
(start_help): Invoke language specific help.
2007-11-08 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc: Include registry.h.
(start_help): Launch gpgex help from install directory.
* client.cc (client_t::call_assuan): Fix bug in last change.
* client.cc (client_t::call_assuan): Fix FILE command and rename
all commands to the protocol version.
(client_t::call_assuan): Report the actual error and remove log
file reference.
2007-11-02 Werner Koch <wk@g10code.com>
* w32-gettext.c (SUBLANG_BENGALI_BANGLADESH): Fix to 2 as per MSDN.
(SUBLANG_PUNJABI_PAKISTAN): Remove as it is not in MSDN.
(SUBLANG_ROMANIAN_MOLDOVA): Remove as it is not in MSDN.
(SUBLANG_ROMANIAN_ROMANIA): Change to value 1 as per MSDN.
* client.cc (call_assuan): Now use "FILE" instead of "INPUT FILE".
2007-10-22 Marcus Brinkmann <marcus@g10code.de>
* exechelp.h (gpgex_spawn_detached): Change signature to just a
command line.
* exechelp.c: Rewritten.
* client.cc (replace_dollar_s): New function.
(default_uiserver_cmdline): Use it.
(uiserver_connect): Change caller of gpgex_spawn_detached.
2007-10-17 Marcus Brinkmann <marcus@g10code.de>
* client.cc (default_uiserver_name): Fix check for dirty hack.
2007-10-16 Marcus Brinkmann <marcus@g10code.de>
* client.cc (default_uiserver_name): Fall back to HKLM for UI Server.
* client.cc (default_uiserver_name): Get UI Server from HKCU.
2007-10-15 Marcus Brinkmann <marcus@g10code.de>
(client_t::call_assuan): Call uiserver_connect.
* registry.c: Include assert.h. Check return value of malloc.
* exechelp.h, exechelp.c: New files.
* Makefile.am (gpgex_SOURCES): Add exechelp.h and exechelp.c.
* main.h (REGKEY): Move to ...
* registry.h (REGKEY): ... here.
* main.cc (_gpgme_debug): Put into extern C.
* main.h: Move debug stuff into ...
* debug.h: ... this new file.
* client.cc (default_uiserver_name, uiserver_connect): New functions.
2007-10-05 Marcus Brinkmann <marcus@g10code.de>
* main.cc (DllMain): Call WSACleanup.
* main.cc (DllMain): Initialize winsock.
* client.cc (percent_escape): Also escape ':' again.
* gpgex.cc (start_help): Do not sleep.
* client.h (class client_t): Two new member functions
create_checksums and verify_checksums.
* client.cc (client_t::create_checksums, client_t::verify_checksums): New functions.
(client_t::encrypt_sign, client_t::encrypt): Fix spelling.
* gpgex.cc (ID_CMD_CREATE_CHECKSUMS, ID_CMD_VERIFY_CHECKSUMS,
ID_CMD_STR_CREATE_CHECKSUMS, ID_CMD_STR_VERIFY_CHECKSUMS): New macros.
(gpgex_t::QueryContextMenu): Add create and verify checksums menu entries.
(gpgex_t::GetCommandString): Support these here as well. Translate all strings.
2007-10-03 Marcus Brinkmann <marcus@g10code.de>
* client.cc (percent_escape, escape): New functions.
(client_t::call_assuan): Fix INPUT command.
2007-09-21 Werner Koch <wk@g10code.com>
* registry.c (default_homedir): Make registry works. Reported by
Marc Mutz.
2007-09-16 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (gpgex_t::QueryContextMenu): Implement popup menu
correctly, such that the explorer can clean up correctly (in the
file dialog).
(gpgex_t::GetCommandString): Implement help texts.
(start_help): New function.
(gpgex_t::InvokeCommand): Call start_help.
* Makefile.am (gpgex_LDADD): Add -loleaut32.
2007-09-11 Marcus Brinkmann <marcus@g10code.de>
* client.cc (client_t::call_assuan): Send --nohup as argument to
command.
* client.h (class client_t): New members decrypt, verify, encrypt,
and sign.
* client.cc: Add implementations for these.
* gpgex.h: Move all ID_CMD_* macros to ...
* gpgex.cc: ... here. Add new macros for new commands.
(gpgex_t::InvokeCommand, gpgex_t::QueryContextMenu): Implement new
commands.
* Makefile.am (libgpg-error.a, libassuan.a): Use -f flag with ln.
* registry.h (default_dir): New prototype.
* registry.c (default_dir, standard_homedir): New functions.
* client.cc (default_socket_name): Use default home dir instead
install directory.
2007-09-05 Marcus Brinkmann <marcus@g10code.de>
* gpgex.h (class gpgex_t): Make destructor virtual to silence
compiler warning.
* Makefile.am (ICON_NAMES, ICON_SIZES, ICONS): New variables.
(gpgex_SOURCES): Add $(ICONS).
* Makefile.am (gpgex_LDADD): More -lws2_32 after ./libassuan.a.
2007-09-04 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Remove $(GPGME_CFLAGS),
add $(LIBASSUAN_CFLAGS) and $(GPG_ERROR_CFLAGS).
(gpgex_SOURCES): Add client.h and client.cc.
(libgpg-error.a, libassuan.a, clean-local): New targets.
(gpgex_LDADD): Add ./libassuan.a and ./libgpg-error.a.
* client.h, client.cc: New files.
* gpgex.cc: Include client.h.
(gpgex_t::InvokeCommand): Use client class to implement bunch of
functionality.
* main.h: Include <gpg-error.h>.
(DEBUG_ASSUAN, REGKEY, TRACE_GPGERR): New macros.
* main.cc: Include <gpg-error.h> and <assuan.h>.
(REGKEY): Deleted.
(debug_init): Free filename and add DEBUG_ASSUAN to debug flags.
(DllMain): Set assuan log stream and prefix, and the error source.
2007-09-03 Marcus Brinkmann <marcus@g10code.de>
* bitmaps.h, bitmaps.cc, icons.rc, icon-key-12.bmp,
icon-key-16.bmp: New files.
* Makefile.am (gpgex_SOURCES): Add icons.rc, bitmaps.h and
bitmaps.cc.
(noinst_gpgex_SOURCES): Add versioninfo.rc.
(gpgex_LDADD): Add -lgdi32.
(resource.o): Remove target.
* gpgex.h: Include bitmaps.h.
(class gpgex_t): New member key_bitmap.
(gpgex_t::gpgex_t, gpgex_t::~gpgex_t): Initialize and deinitialize
it.
* gpgex.cc (gpgex_t::QueryContextMenu): Add dummy bitmap for menu.
2007-08-31 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (gpgex_t::QueryContextMenu): Fix menu separators.
2007-08-30 Marcus Brinkmann <marcus@g10code.de>
* gpgex.h (ID_CMD_HELP, ID_CMD_VERIFY_DECRYPT)
(ID_CMD_SIGN_ENCRYPT, ID_CMD_IMPORT, ID_CMD_MAX)
(ID_CMD_STR_HELP, ID_CMD_STR_VERIFY_DECRYPT)
(ID_CMD_STR_SIGN_ENCRYPT, ID_CMD_STR_IMPORT): New macros.
(class gpgex_t): New member ALL_FILES_GPG.
* gpgex.cc (gpgex_t::reset): Initialize THIS->all_files_gpg.
(gpgex_t::Initialize): Check ending of added files.
(gpgex_t::QueryContextMenu): Create a more involved dummy menu.
(gpgex_t::InvokeCommand): Show different commands being invoked.
* gpgex-class.cc (gpgex_class::init): Also register the shell
extension for directories.
(gpgex_class::deinit): Unregister shell extension for directories.
2007-08-28 Marcus Brinkmann <marcus@g10code.de>
* main.cc (DllRegisterServer): Do not trash gpgex_server::instance.
* gpgex-class.cc (gpgex_class::init): Now that DllMain loads, we
can access the DLL file name.
* main.cc (DllMain): Change return type to "STADPI" to get an
extern "C" declaration.
(_gpgex_debug): Remove lazy initialization cruft. DllMain is
called now, and initialization works properly.
* Makefile.am (gpgex_LDADD): Add -lole32.
* gpgex.def: Rename functions to not carry the @NR thingie.
* main.h: Many TRACE macros added.
(DEBUG_INIT, DEBUG_CONTEXT_MENU, STRINGIFY, GUID_FMT, GUID_ARG):
New macros.
(_gpgex_debug): New prototype.
* main.cc: Include <stdarg.h>, <stdio.h> and <shlobj.h>. Add
debugging traces.
(debug_lock, debug_flags, debug_file): New statics.
(get_debug_file, debug_init, debug_deinit): New static functions.
(_gpgex_debug): New function.
(DllMain): Call debug_init.
(DllRegisterServer, DllUnregisterServer): Call SHChangeNotify.
* gpgex.h: Include <vector> and <string>. Use std::vector and
std::string namespaces.
(class gpgex_t): New member filenames, and new method reset.
* gpgex.cc: Include <vector>, <string>, <stdexcept> and use
std::vector and std::string namespaces. Add debugging traces.
(gpgex_t::reset): New function.
(gpgex_t::Initialize): Implement dummy function.
(gpgex_t::QueryContextMenu): Implement dummy function.
(gpgex_t::GetCommandString): Implement dummy function.
(gpgex_t::InvokeCommand): Implement dummy function.
* gpgex-factory.cc: Add debugging traces.
* gpgex-class.cc (gpgex_class::init): Implement registration of
shell extension.
(gpgex_class::deinit): Implement corresponding unregistration.
2007-08-23 Marcus Brinkmann <marcus@g10code.de>
* Initial commit.
diff --git a/src/client.cc b/src/client.cc
index 5773ecb..80982e5 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -1,419 +1,426 @@
/* client.cc - gpgex assuan client implementation
Copyright (C) 2007, 2008 g10 Code GmbH
This file is part of GpgEX.
GpgEX is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GpgEX is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <vector>
#include <string>
#include <stdexcept>
using std::vector;
using std::string;
#include <windows.h>
#include <assuan.h>
#include "main.h"
#include "registry.h"
#include "exechelp.h"
#include "client.h"
static const char *
default_socket_name (void)
{
static string name;
if (name.size () == 0)
{
char *dir = NULL;
dir = default_homedir ();
if (dir)
{
try { name = ((string) dir) + "\\S.uiserver"; } catch (...) {}
free ((void *) dir);
}
}
return name.c_str ();
}
static const char *
default_uiserver_cmdline (void)
{
static string name;
if (name.size () == 0)
{
char *dir = NULL;
dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE", REGKEY,
"Install Directory");
if (dir)
{
char *uiserver = NULL;
int uiserver_malloced = 1;
uiserver = read_w32_registry_string (NULL, REGKEY, "UI Server");
if (! uiserver)
{
string fname;
uiserver_malloced = 0;
try { fname = ((string) dir) + "\\"
+ "kleopatra.exe"; } catch (...) {}
/* The option --use-standard-socket is the default on
windows, so we can omit it here. */
if (! access (fname.c_str (), F_OK))
uiserver = "kleopatra.exe --daemon";
else
uiserver = "gpa.exe --daemon";
}
try { name = ((string) dir) + "\\" + uiserver; } catch (...) {}
if (uiserver_malloced)
free (uiserver);
free ((void *) dir);
}
}
return name.c_str ();
}
#define tohex_lower(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'a'))
/* Percent-escape the string STR by replacing colons with '%3a'. If
EXTRA is not NULL all characters in it are also escaped. */
static char *
percent_escape (const char *str, const char *extra)
{
int i, j;
char *ptr;
if (!str)
return NULL;
for (i=j=0; str[i]; i++)
if (str[i] == ':' || str[i] == '%' || (extra && strchr (extra, str[i])))
j++;
ptr = (char *) malloc (i + 2 * j + 1);
i = 0;
while (*str)
{
/* FIXME: Work around a bug in Kleo. */
if (*str == ':')
{
ptr[i++] = '%';
ptr[i++] = '3';
ptr[i++] = 'a';
}
else
if (*str == '%')
{
ptr[i++] = '%';
ptr[i++] = '2';
ptr[i++] = '5';
}
else if (extra && strchr (extra, *str))
{
ptr[i++] = '%';
ptr[i++] = tohex_lower ((*str >> 4) & 15);
ptr[i++] = tohex_lower (*str & 15);
}
else
ptr[i++] = *str;
str++;
}
ptr[i] = '\0';
return ptr;
}
static string
escape (string str)
{
char *arg_esc = percent_escape (str.c_str (), "+= ");
if (arg_esc == NULL)
throw std::bad_alloc ();
string res = arg_esc;
free (arg_esc);
return res;
}
/* Send options to the UI server and return the server's PID. */
static gpg_error_t
send_one_option (assuan_context_t ctx, const char *name, const char *value)
{
gpg_error_t err;
char buffer[1024];
if (! value || ! *value)
err = 0; /* Avoid sending empty strings. */
else
{
snprintf (buffer, sizeof (buffer), "OPTION %s=%s", name, value);
err = assuan_transact (ctx, buffer, NULL, NULL, NULL, NULL, NULL, NULL);
}
return err;
}
-static int
+static gpg_error_t
getinfo_pid_cb (void *opaque, const void *buffer, size_t length)
{
pid_t *pid = (pid_t *) opaque;
*pid = (pid_t) strtoul ((char *) buffer, NULL, 10);
return 0;
}
static gpg_error_t
send_options (assuan_context_t ctx, HWND hwnd, pid_t *r_pid)
{
gpg_error_t rc = 0;
char numbuf[50];
TRACE_BEG (DEBUG_ASSUAN, "client_t::send_options", ctx);
*r_pid = (pid_t) (-1);
rc = assuan_transact (ctx, "GETINFO pid", getinfo_pid_cb, r_pid,
NULL, NULL, NULL, NULL);
if (! rc && *r_pid == (pid_t) (-1))
{
(void) TRACE_LOG ("server did not return a PID");
rc = gpg_error (GPG_ERR_ASSUAN_SERVER_FAULT);
}
if (! rc && *r_pid != (pid_t) (-1)
&& ! AllowSetForegroundWindow (*r_pid))
{
(void) TRACE_LOG ("AllowSetForegroundWindow (%u) failed");
TRACE_RES (HRESULT_FROM_WIN32 (GetLastError ()));
/* Ignore the error, though. */
}
if (! rc && hwnd)
{
snprintf (numbuf, sizeof (numbuf), "%lx", (unsigned long) hwnd);
rc = send_one_option (ctx, "window-id", numbuf);
}
return TRACE_GPGERR (rc);
}
-static int
+static gpg_error_t
uiserver_connect (assuan_context_t *ctx, HWND hwnd)
{
- int rc;
+ gpg_error_t rc;
const char *socket_name = NULL;
pid_t pid;
TRACE_BEG (DEBUG_ASSUAN, "client_t::uiserver_connect", ctx);
socket_name = default_socket_name ();
if (! socket_name || ! *socket_name)
{
(void) TRACE_LOG ("invalid socket name");
return TRACE_GPGERR (gpg_error (GPG_ERR_INV_ARG));
}
(void) TRACE_LOG1 ("socket name: %s", socket_name);
- rc = assuan_socket_connect (ctx, socket_name, -1);
+ rc = assuan_new (ctx);
+ if (rc)
+ {
+ (void) TRACE_LOG ("could not allocate context");
+ return TRACE_GPGERR (rc);
+ }
+
+ rc = assuan_socket_connect (*ctx, socket_name, -1, 0);
if (rc)
{
int count;
(void) TRACE_LOG ("UI server not running, starting it");
rc = gpgex_spawn_detached (default_uiserver_cmdline ());
if (rc)
return TRACE_GPGERR (rc);
/* Give it a bit of time to start up and try a couple of
times. */
for (count = 0; count < 10; count++)
{
Sleep (1000);
- rc = assuan_socket_connect (ctx, socket_name, -1);
+ rc = assuan_socket_connect (*ctx, socket_name, -1, 0);
if (!rc)
break;
}
}
if (! rc)
{
if (debug_flags & DEBUG_ASSUAN)
assuan_set_log_stream (*ctx, debug_file);
rc = send_options (*ctx, hwnd, &pid);
if (rc)
{
- assuan_disconnect (*ctx);
+ assuan_release (*ctx);
*ctx = NULL;
}
}
return TRACE_GPGERR (rc);
}
bool
client_t::call_assuan (const char *cmd, vector<string> &filenames)
{
int rc = 0;
assuan_context_t ctx = NULL;
string msg;
TRACE_BEG2 (DEBUG_ASSUAN, "client_t::call_assuan", this,
"%s on %u files", cmd, filenames.size ());
rc = uiserver_connect (&ctx, this->window);
if (rc)
goto leave;
try
{
/* Set the input files. We don't specify the output files. */
for (unsigned int i = 0; i < filenames.size (); i++)
{
msg = "FILE " + escape (filenames[i]);
(void) TRACE_LOG1 ("sending cmd: %s", msg.c_str ());
rc = assuan_transact (ctx, msg.c_str (),
NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)
goto leave;
}
/* Set the --nohup option, so that the operation continues and
completes in the background. */
msg = ((string) cmd) + " --nohup";
(void) TRACE_LOG1 ("sending cmd: %s", msg.c_str ());
rc = assuan_transact (ctx, msg.c_str (),
NULL, NULL, NULL, NULL, NULL, NULL);
}
catch (std::bad_alloc)
{
rc = gpg_error (GPG_ERR_ENOMEM);
}
catch (...)
{
rc = gpg_error (GPG_ERR_GENERAL);
}
/* Fall-through. */
leave:
TRACE_GPGERR (rc);
if (ctx)
- assuan_disconnect (ctx);
+ assuan_release (ctx);
if (rc)
{
char buf[256];
snprintf (buf, sizeof (buf), _("Can not access Kleopatra:\r\n%s"),
gpg_strerror (rc));
MessageBox (this->window, buf, "GpgEX", MB_ICONINFORMATION);
}
return rc ? false : true;
}
void
client_t::decrypt_verify (vector<string> &filenames)
{
this->call_assuan ("DECRYPT_VERIFY_FILES", filenames);
}
void
client_t::verify (vector<string> &filenames)
{
this->call_assuan ("VERIFY_FILES", filenames);
}
void
client_t::decrypt (vector<string> &filenames)
{
this->call_assuan ("DECRYPT_FILES", filenames);
}
void
client_t::sign_encrypt (vector<string> &filenames)
{
this->call_assuan ("ENCRYPT_SIGN_FILES", filenames);
}
void
client_t::encrypt (vector<string> &filenames)
{
this->call_assuan ("ENCRYPT_FILES", filenames);
}
void
client_t::sign (vector<string> &filenames)
{
this->call_assuan ("SIGN_FILES", filenames);
}
void
client_t::import (vector<string> &filenames)
{
this->call_assuan ("IMPORT_FILES", filenames);
}
void
client_t::create_checksums (vector<string> &filenames)
{
this->call_assuan ("CHECKSUM_CREATE_FILES", filenames);
}
void
client_t::verify_checksums (vector<string> &filenames)
{
this->call_assuan ("CHECKSUM_VERIFY_FILES", filenames);
}
diff --git a/src/main.cc b/src/main.cc
index 2a86daf..102c931 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -1,310 +1,310 @@
/* main.cc - DLL entry point
Copyright (C) 2007 g10 Code GmbH
This file is part of GpgEX.
GpgEX is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.
GpgEX is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with GpgEX; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <windows.h>
#include <shlobj.h>
#include <gpg-error.h>
#include <assuan.h>
#include "registry.h"
#include "gpgex-class.h"
#include "gpgex-factory.h"
#include "main.h"
/* This is the main part of the COM server component. The component
is an in-process server DLL. */
/* The instance of this DLL. */
HINSTANCE gpgex_server::instance;
/* The number of references to this component. */
LONG gpgex_server::refcount;
static char *
get_locale_dir (void)
{
char *instdir;
char *p;
char *dname;
instdir = read_w32_registry_string ("HKEY_LOCAL_MACHINE", REGKEY,
"Install Directory");
if (!instdir)
return NULL;
/* Build the key: "<instdir>/share/locale". */
#define SLDIR "\\share\\locale"
dname = static_cast<char *> (malloc (strlen (instdir) + strlen (SLDIR) + 1));
if (!dname)
{
free (instdir);
return NULL;
}
p = dname;
strcpy (p, instdir);
p += strlen (instdir);
strcpy (p, SLDIR);
free (instdir);
return dname;
}
static void
drop_locale_dir (char *locale_dir)
{
free (locale_dir);
}
static void
i18n_init (void)
{
char *locale_dir;
#ifdef ENABLE_NLS
# ifdef HAVE_LC_MESSAGES
setlocale (LC_TIME, "");
setlocale (LC_MESSAGES, "");
# else
setlocale (LC_ALL, "" );
# endif
#endif
locale_dir = get_locale_dir ();
if (locale_dir)
{
bindtextdomain (PACKAGE_GT, locale_dir);
drop_locale_dir (locale_dir);
}
textdomain (PACKAGE_GT);
}
static CRITICAL_SECTION debug_lock;
/* No flags on means no debugging. */
unsigned int debug_flags = 0;
/* Debug log file. */
FILE *debug_file;
/* Get the filename of the debug file, if any. */
static char *
get_debug_file (void)
{
return read_w32_registry_string ("HKEY_LOCAL_MACHINE", REGKEY,
"GpgEX Debug File");
}
static void
debug_init (void)
{
char *filename;
/* Sanity check. */
if (debug_file)
return;
InitializeCriticalSection (&debug_lock);
filename = get_debug_file ();
if (!filename)
return;
debug_file = fopen (filename, "a");
free (filename);
if (!debug_file)
return;
/* FIXME: Make this configurable eventually. */
debug_flags = DEBUG_INIT | DEBUG_CONTEXT_MENU | DEBUG_ASSUAN;
}
static void
debug_deinit (void)
{
if (debug_file)
{
fclose (debug_file);
debug_file = NULL;
}
}
#ifdef __cplusplus
extern "C" {
#if 0
}
#endif
#endif
/* Log the formatted string FORMAT at debug level LEVEL or higher. */
extern
void
_gpgex_debug (unsigned int flags, const char *format, ...)
{
va_list arg_ptr;
int saved_errno;
saved_errno = errno;
if (! (debug_flags & flags))
return;
va_start (arg_ptr, format);
EnterCriticalSection (&debug_lock);
vfprintf (debug_file, format, arg_ptr);
va_end (arg_ptr);
if (format && *format && format[strlen (format) - 1] != '\n')
putc ('\n', debug_file);
LeaveCriticalSection (&debug_lock);
fflush (debug_file);
errno = saved_errno;
}
#ifdef __cplusplus
#if 0
{
#endif
}
#endif
/* Entry point called by DLL loader. */
STDAPI
DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
{
if (reason == DLL_PROCESS_ATTACH)
{
gpgex_server::instance = hinst;
/* Early initializations of our subsystems. */
i18n_init ();
debug_init ();
if (debug_flags & DEBUG_ASSUAN)
{
assuan_set_assuan_log_stream (debug_file);
assuan_set_assuan_log_prefix ("gpgex:assuan");
}
- assuan_set_assuan_err_source (GPG_ERR_SOURCE_DEFAULT);
+ assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
(void) TRACE0 (DEBUG_INIT, "DllMain", hinst,
"reason=DLL_PROCESS_ATTACH");
{
WSADATA wsadat;
WSAStartup (0x202, &wsadat);
}
}
else if (reason == DLL_PROCESS_DETACH)
{
WSACleanup ();
(void) TRACE0 (DEBUG_INIT, "DllMain", hinst,
"reason=DLL_PROCESS_DETACH");
debug_deinit ();
}
return TRUE;
}
/* Check if the server component, the DLL, can be unloaded. This is
called by the client of this in-process server (for example through
CoFreeUnusedLibrary) whenever it is considered to unload this
server component. */
STDAPI
DllCanUnloadNow (void)
{
(void) TRACE (DEBUG_INIT, "DllCanUnloadNow", gpgex_server::refcount);
return (gpgex_server::refcount == 0 ? S_OK : S_FALSE);
}
/* Registry handling. The DLL is registered with regsvr32.exe. */
/* Register the DLL. */
STDAPI
DllRegisterServer (void)
{
gpgex_class::init ();
/* Notify the shell about the change. */
SHChangeNotify (SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
return S_OK;
}
/* Unregister the DLL. */
STDAPI
DllUnregisterServer (void)
{
gpgex_class::deinit ();
/* Notify the shell about the change. */
SHChangeNotify (SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
return S_OK;
}
/* Acquire a reference for the class factory of object class RCLSID
with the interface RIID (typically IID_IClassFactory) and return it
in PPVOUT. Typically called by CoGetClassObject for in-process
server components. */
STDAPI
DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
/* We have to evaluate the arguments first. */
#define _TRACE_BEG22(a,b,c,d,e,f) TRACE_BEG22(a,b,c,d,e,f)
_TRACE_BEG22 (DEBUG_INIT, "DllGetClassObject", ppv,
"rclsid=" GUID_FMT ", riid=" GUID_FMT,
GUID_ARG (rclsid), GUID_ARG (riid));
if (rclsid == CLSID_gpgex)
{
HRESULT err = gpgex_factory.QueryInterface (riid, ppv);
return TRACE_RES (err);
}
/* Be nice to broken software. */
*ppv = NULL;
return TRACE_RES (CLASS_E_CLASSNOTAVAILABLE);
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Feb 26, 7:10 PM (16 h, 38 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a9/85/0ebc252958980f47966c18a10f36

Event Timeline