[Pkg-wmaker-commits] [wmbiff] 58/84: handle new gnutls/gnutls.h convention, release 0.4.7
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:01:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_10
in repository wmbiff.
commit 7f108706cf822ab8b67f153730cad3c45b9fa9d1
Author: bluehal <bluehal>
Date: Fri Aug 16 07:55:03 2002 +0000
handle new gnutls/gnutls.h convention, release 0.4.7
---
ChangeLog | 16 +++++-
NEWS | 5 +-
autoconf/libgnutls.m4 | 4 +-
configure.ac | 10 ++--
wmbiff/Imap4Client.c | 2 +-
wmbiff/gnutls-common.c | 150 ++++++++++++++++++++++++++++++++++++-------------
wmbiff/gnutls-common.h | 9 +--
wmbiff/tlsComm.c | 15 ++---
8 files changed, 150 insertions(+), 61 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6e105d4..e3f7407 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,14 +6,26 @@ The latest changelog entry is in a different format, because it's inserted by
CVS on commit.
$Log: ChangeLog,v $
- Revision 1.38 2002/07/19 18:51:18 bluehal
- release version 0.4.6
+ Revision 1.39 2002/08/16 07:55:03 bluehal
+ handle new gnutls/gnutls.h convention, release 0.4.7
Revision 1.1 2002/04/07 05:08:23 bluehal
use automake / autoconf; after checkout run ./FromCVS.sh
+2002-08-06 Tuesday 08:05 UTC -- Neil Spring <nspring at cs.washington.edu>
+
+ * FromCVS.sh: seek out and use athe underrated automake 1.6.
+
+2002-07-27 Saturday 17:50 UTC -- Neil Spring <nspring at cs.washington.edu>
+
+ * wmbiff/: Imap4Client.c, tlsComm.c: trivial formatting fixes
+
+2002-07-19 Friday 18:51 UTC -- Neil Spring <nspring at cs.washington.edu>
+
+ * ChangeLog, NEWS, configure.ac: release version 0.4.6
+
2002-07-18 Thursday 02:55 UTC -- Neil Spring <nspring at cs.washington.edu>
* wmbiff/wmbiff.c: ignore sigpipe, possible bugfix for abnormal
diff --git a/NEWS b/NEWS
index 1324894..71dfb47 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
Release Notes
~~~~~~~~~~~~~
+Release 0.4.7 - August 16, 2002
+ * GNUTLS v0.5.1, gcrypt v1.1.8 required. (no other changes)
+
Release 0.4.6 - July 19, 2002
* Ignore sigpipe so that apm suspend works with IMAP/TLS.
* Memory handling bugfixes to appease valgrind.
@@ -345,4 +348,4 @@ Release 0.1 - Wed, 17 Nov 1999 00:00:00 +0000
* Initial release by Gennady Belyakov <gb at ccat.elect.ru>.
-$Id: NEWS,v 1.27 2002/07/19 18:51:18 bluehal Exp $
+$Id: NEWS,v 1.28 2002/08/16 07:55:03 bluehal Exp $
diff --git a/autoconf/libgnutls.m4 b/autoconf/libgnutls.m4
index d554c9d..9786074 100644
--- a/autoconf/libgnutls.m4
+++ b/autoconf/libgnutls.m4
@@ -49,7 +49,7 @@ dnl
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <gnutls.h>
+#include <gnutls/gnutls.h>
int
main ()
@@ -129,7 +129,7 @@ main ()
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <gnutls.h>
+#include <gnutls/gnutls.h>
], [ return !!gnutls_check_version(NULL); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
diff --git a/configure.ac b/configure.ac
index 9855fec..3585fdc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,9 +7,9 @@ dnl and configure:
dnl installation prefix
dnl version
-AC_INIT(wmbiff, 0.4.6, wmbiff-devel at lists.sourceforge.net)
+AC_INIT(wmbiff, 0.4.7, wmbiff-devel at lists.sourceforge.net)
AC_CONFIG_AUX_DIR(autoconf)
-AM_INIT_AUTOMAKE(wmbiff, 0.4.6)
+AM_INIT_AUTOMAKE(wmbiff, 0.4.7)
dnl AUTOHEADER="$AUTOHEADER -l \\\\\\\$\(srcdir)/autoconf"
AM_CONFIG_HEADER(config.h)
dnl make sure autoheader finds version, implicitly defined above.
@@ -43,17 +43,17 @@ dnl between them makes this turn redundant
GNUTLS_MAN_STATUS="This copy of WMBiff was not compiled with GNUTLS."
if test "$gnutls" = "ok"; then
- AM_PATH_LIBGNUTLS(0.4.3, [LIBS="$LIBS $LIBGNUTLS_LIBS"
+ AM_PATH_LIBGNUTLS(0.5.1, [LIBS="$LIBS $LIBGNUTLS_LIBS"
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
GNUTLS_COMMON_O="gnutls-common.o"
GNUTLS_MAN_STATUS="This copy of WMBiff was compiled with GNUTLS."
- AC_CHECK_HEADERS(gnutls.h) ])
+ AC_CHECK_HEADERS(gnutls/gnutls.h) ])
else
AC_MSG_RESULT(GNUTLS support requires libz.a and libgdbm.a, so will be disabled)
fi
GCRYPT_MAN_STATUS="This copy of WMBiff was not compiled with gcrypt."
-AM_PATH_LIBGCRYPT(1.1.7, [CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
+AM_PATH_LIBGCRYPT(1.1.8, [CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS"
GCRYPT_MAN_STATUS="This copy of WMBiff was compiled with gcrypt."
AC_CHECK_HEADERS(gcrypt.h) ] )
diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index a705618..c2797cc 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -313,7 +313,7 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
/* IMAP4 format: imap:user:password at server/mailbox[:port] */
/* If 'str' line is badly formatted, wmbiff won't display the mailbox. */
if (strncmp("sslimap:", str, 8) == 0 || strncmp("imaps:", str, 6) == 0) {
-#ifdef HAVE_GNUTLS_H
+#ifdef HAVE_GNUTLS_GNUTLS_H
static int haveBeenWarned;
PCU.dossl = 1;
if (!haveBeenWarned) {
diff --git a/wmbiff/gnutls-common.c b/wmbiff/gnutls-common.c
index 8dcb130..9b0397d 100644
--- a/wmbiff/gnutls-common.c
+++ b/wmbiff/gnutls-common.c
@@ -1,13 +1,6 @@
-/* taken from gnutls 0.4.3's distribution, tiny edit
- for including the system gnutls. define EXTRA_BROKEN
- so long as it's inconvenient to include gnutls-extra.h
- and link with -lgnutls-extra */
-#define EXTRA_BROKEN
#include <stdio.h>
-#include <gnutls.h>
-#ifndef EXTRA_BROKEN
-#include <gnutls-extra.h>
-#endif
+#include <gnutls/gnutls.h>
+#include <gnutls/extra.h>
#include <time.h>
#define PRINTX(x,y) if (y[0]!=0) printf(" # %s %s\n", x, y)
@@ -21,15 +14,14 @@
#define PRINT_PGP_NAME(X) PRINTX( "NAME:", X.name); \
PRINTX( "EMAIL:", X.email)
-static const char *my_ctime(time_t * tv)
-{
- static char buf[256];
- struct tm *tp;
+static const char* my_ctime( time_t* tv) {
+static char buf[256];
+struct tm* tp;
- tp = localtime(tv);
- strftime(buf, sizeof buf, "%a %b %e %H:%M:%S %Z %Y\n", tp);
+tp = localtime(tv);
+strftime(buf, sizeof buf, "%a %b %e %H:%M:%S %Z %Y\n", tp);
- return buf;
+return buf;
}
@@ -55,16 +47,15 @@ void print_x509_info(GNUTLS_STATE state)
if (cert_list_size <= 0)
return;
-
printf(" - Certificate info:\n");
- printf(" # Certificate is valid since: %s", my_ctime(&activet));
- printf(" # Certificate expires: %s", my_ctime(&expiret));
+ printf(" # Certificate is valid since: %s", my_ctime( &activet));
+ printf(" # Certificate expires: %s", my_ctime( &expiret));
/* Print the fingerprint of the certificate
*/
if (gnutls_x509_fingerprint
- (GNUTLS_DIG_MD5, &cert_list[0], digest, &digest_size) >= 0) {
+ (GNUTLS_DIG_MD5, &cert_list[0], digest, &digest_size) >= 0) {
print = printable;
for (i = 0; i < digest_size; i++) {
sprintf(print, "%.2x ", (unsigned char) digest[i]);
@@ -77,7 +68,7 @@ void print_x509_info(GNUTLS_STATE state)
*/
if (gnutls_x509_extract_certificate_serial
- (&cert_list[0], serial, &serial_size) >= 0) {
+ (&cert_list[0], serial, &serial_size) >= 0) {
print = printable;
for (i = 0; i < serial_size; i++) {
sprintf(print, "%.2x ", (unsigned char) serial[i]);
@@ -90,16 +81,15 @@ void print_x509_info(GNUTLS_STATE state)
* certificate.
*/
printf(" # Certificate version: #%d\n",
- gnutls_x509_extract_certificate_version(&cert_list[0]));
+ gnutls_x509_extract_certificate_version(&cert_list[0]));
- algo =
- gnutls_x509_extract_certificate_pk_algorithm(&cert_list[0], &bits);
+ algo = gnutls_x509_extract_certificate_pk_algorithm( &cert_list[0], &bits);
printf(" # Certificate public key algorithm: ");
- if (algo == GNUTLS_PK_RSA) {
+ if (algo==GNUTLS_PK_RSA) {
printf("RSA\n");
printf(" # Modulus: %d bits\n", bits);
- } else if (algo == GNUTLS_PK_DSA) {
+ } else if (algo==GNUTLS_PK_DSA) {
printf("DSA\n");
printf(" # Exponent: %d bits\n", bits);
} else {
@@ -115,6 +105,70 @@ void print_x509_info(GNUTLS_STATE state)
}
+#ifdef undef_wmbiff_dont_need_no_extra
+void print_openpgp_info(GNUTLS_STATE state)
+{
+
+ gnutls_openpgp_name pgp_name;
+ char digest[20];
+ int digest_size = sizeof(digest), i;
+ char printable[120];
+ char *print;
+ const gnutls_datum *cert_list;
+ int cert_list_size = 0;
+ time_t expiret = gnutls_certificate_expiration_time_peers(state);
+ time_t activet = gnutls_certificate_activation_time_peers(state);
+
+ cert_list = gnutls_certificate_get_peers(state, &cert_list_size);
+
+ if (cert_list_size > 0) {
+ int algo, bits;
+
+ printf(" # Key was created at: %s", my_ctime( &activet));
+ printf(" # Key expires: ");
+ if (expiret != 0)
+ printf("%s", my_ctime( &expiret));
+ else
+ printf("Never\n");
+
+ if (gnutls_openpgp_fingerprint
+ (&cert_list[0], digest, &digest_size) >= 0) {
+ print = printable;
+ for (i = 0; i < digest_size; i++) {
+ sprintf(print, "%.2x ",
+ (unsigned char) digest[i]);
+ print += 3;
+ }
+
+ printf(" # PGP Key version: %d\n",
+ gnutls_openpgp_extract_key_version(&cert_list[0]));
+
+ algo = gnutls_openpgp_extract_key_pk_algorithm( &cert_list[0], &bits);
+
+ printf(" # PGP Key public key algorithm: ");
+
+ if (algo==GNUTLS_PK_RSA) {
+ printf("RSA\n");
+ printf(" # Modulus: %d bits\n", bits);
+ } else if (algo==GNUTLS_PK_DSA) {
+ printf("DSA\n");
+ printf(" # Exponent: %d bits\n", bits);
+ } else {
+ printf("UNKNOWN\n");
+ }
+
+ printf(" # PGP Key fingerprint: %s\n",
+ printable);
+
+ gnutls_openpgp_extract_key_name(&cert_list
+ [0], 0, &pgp_name);
+ PRINT_PGP_NAME(pgp_name);
+
+ }
+
+ }
+}
+#endif
void print_cert_vrfy(GNUTLS_STATE state)
{
@@ -158,34 +212,36 @@ int print_info(GNUTLS_STATE state)
switch (cred) {
case GNUTLS_CRD_ANON:
printf("- Anonymous DH using prime of %d bits, secret key "
- "of %d bits, and peer's public key is %d bits.\n",
- gnutls_dh_get_prime_bits(state),
- gnutls_dh_get_secret_bits(state),
- gnutls_dh_get_peers_public_bits(state));
+ "of %d bits, and peer's public key is %d bits.\n",
+ gnutls_dh_get_prime_bits(state), gnutls_dh_get_secret_bits(state),
+ gnutls_dh_get_peers_public_bits(state));
break;
case GNUTLS_CRD_SRP:
-#ifndef EXTRA_BROKEN
+#ifdef undef_wmbiff_dont_need_no_extra
/* This should be only called in server
* side.
*/
if (gnutls_srp_server_get_username(state) != NULL)
printf("- SRP authentication. Connected as '%s'\n",
- gnutls_srp_server_get_username(state));
+ gnutls_srp_server_get_username(state));
#endif
break;
case GNUTLS_CRD_CERTIFICATE:
switch (gnutls_cert_type_get(state)) {
case GNUTLS_CRT_X509:
- printf("- Peer requested X.509 certificate authentication.\n");
+ printf
+ ("- Peer requested X.509 certificate authentication.\n");
print_x509_info(state);
break;
case GNUTLS_CRT_OPENPGP:{
printf
- ("- Peer requested OpenPGP certificate authentication.\n");
+ ("- Peer requested OpenPGP certificate authentication.\n");
- /* print_openpgp_info(state); */
+#ifdef undef_wmbiff_dont_need_no_extra
+ print_openpgp_info(state);
+#endif
break;
}
@@ -197,10 +253,9 @@ int print_info(GNUTLS_STATE state)
*/
if (kx == GNUTLS_KX_DHE_RSA || kx == GNUTLS_KX_DHE_DSS) {
printf("- Ephemeral DH using prime of %d bits, secret key "
- "of %d bits, and peer's public key is %d bits.\n",
- gnutls_dh_get_prime_bits(state),
- gnutls_dh_get_secret_bits(state),
- gnutls_dh_get_peers_public_bits(state));
+ "of %d bits, and peer's public key is %d bits.\n",
+ gnutls_dh_get_prime_bits(state), gnutls_dh_get_secret_bits(state),
+ gnutls_dh_get_peers_public_bits(state));
}
}
@@ -259,3 +314,20 @@ void print_list(void)
return;
}
+
+void print_license(void)
+{
+ fprintf(stdout,
+ "\nCopyright (C) 2001-2002 Nikos Mavroyanopoulos\n"
+ "This program is free software; you can redistribute it and/or modify \n"
+ "it under the terms of the GNU General Public License as published by \n"
+ "the Free Software Foundation; either version 2 of the License, or \n"
+ "(at your option) any later version. \n" "\n"
+ "This program is distributed in the hope that it will be useful, \n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of \n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n"
+ "GNU General Public License for more details. \n" "\n"
+ "You should have received a copy of the GNU General Public License \n"
+ "along with this program; if not, write to the Free Software \n"
+ "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n");
+}
diff --git a/wmbiff/gnutls-common.h b/wmbiff/gnutls-common.h
index c52c304..f0e4652 100644
--- a/wmbiff/gnutls-common.h
+++ b/wmbiff/gnutls-common.h
@@ -1,6 +1,7 @@
-/* taken from gnutls 0.4.3's distribution, tiny edit
- for including the system gnutls. */
-#include <gnutls.h>
+#define PORT 5556
+#define SERVER "127.0.0.1"
-int print_info(GNUTLS_STATE state);
+#include <gnutls/gnutls.h>
+
+int print_info( GNUTLS_STATE state);
int print_list(void);
diff --git a/wmbiff/tlsComm.c b/wmbiff/tlsComm.c
index 4ccddd4..e865099 100644
--- a/wmbiff/tlsComm.c
+++ b/wmbiff/tlsComm.c
@@ -19,8 +19,9 @@
#include <string.h>
#include <stdlib.h>
#include <assert.h>
-#ifdef HAVE_GNUTLS_H
-#include <gnutls.h>
+#ifdef HAVE_GNUTLS_GNUTLS_H
+#define USE_GNUTLS
+#include <gnutls/gnutls.h>
#endif
#ifdef USE_DMALLOC
#include <dmalloc.h>
@@ -48,7 +49,7 @@ extern const char *certificate_filename;
struct connection_state {
int sd;
char *name;
-#ifdef HAVE_GNUTLS_H
+#ifdef USE_GNUTLS
GNUTLS_STATE state;
GNUTLS_CERTIFICATE_CLIENT_CREDENTIALS xcred;
#else
@@ -71,7 +72,7 @@ void tlscomm_close(struct connection_state *scs)
/* not ok to call this more than once */
if (scs->state) {
-#ifdef HAVE_GNUTLS_H
+#ifdef USE_GNUTLS
gnutls_bye(scs->state, GNUTLS_SHUT_RDWR);
gnutls_certificate_free_sc(scs->xcred);
gnutls_deinit(scs->state);
@@ -162,7 +163,7 @@ int tlscomm_expect(struct connection_state *scs,
memset(linebuf, 0, buflen);
TDM(DEBUG_INFO, "%s: expecting: %s\n", scs->name, prefix);
while (wait_for_it(scs->sd, EXPECT_TIMEOUT)) {
-#ifdef HAVE_GNUTLS_H
+#ifdef USE_GNUTLS
if (scs->state) {
/* BUF_SIZE - 1 leaves room for trailing \0 */
readbytes =
@@ -242,7 +243,7 @@ void tlscomm_printf(struct connection_state *scs, const char *format, ...)
va_end(args);
if (scs->sd != -1) {
-#ifdef HAVE_GNUTLS_H
+#ifdef USE_GNUTLS
if (scs->state) {
int written = gnutls_write(scs->state, buf, bytes);
if (written < bytes) {
@@ -263,7 +264,7 @@ void tlscomm_printf(struct connection_state *scs, const char *format, ...)
}
/* most of this file only makes sense if using TLS. */
-#ifdef HAVE_GNUTLS_H
+#ifdef USE_GNUTLS
#include "gnutls-common.h"
/* a start of a hack at verifying certificates. does not
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list