[PATCH 5/7] wmbiff: fix `print_info` prototypes in test sources

2 views
Skip to first unread message

Jeremy Sowden

unread,
May 16, 2024, 7:46:26 AMMay 16
to Window Maker Dev, Eli Schwartz
They should match the real `print_info` in gnutls-common.c.

Make sure all stubbed functions are declared in headers and those headers
are included where the functions are definitions.

Reported-by: Eli Schwartz <eschw...@gmail.com>
Link: https://bugs.gentoo.org/864855
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmbiff/wmbiff/Makefile.am | 9 +++++++--
wmbiff/wmbiff/test_tlscomm.c | 19 ++++++++++++++++---
wmbiff/wmbiff/test_wmbiff.c | 9 ++++++++-
wmbiff/wmbiff/tlsComm.c | 7 ++-----
wmbiff/wmbiff/wmbiff.c | 5 +++--
wmbiff/wmbiff/wmbiff.h | 7 +++++++
6 files changed, 43 insertions(+), 13 deletions(-)
create mode 100644 wmbiff/wmbiff/wmbiff.h

diff --git a/wmbiff/wmbiff/Makefile.am b/wmbiff/wmbiff/Makefile.am
index 7c978ea58abf..4b9f9b84bf87 100644
--- a/wmbiff/wmbiff/Makefile.am
+++ b/wmbiff/wmbiff/Makefile.am
@@ -4,6 +4,7 @@ bin_PROGRAMS = wmbiff

wmbiff_SOURCES = \
wmbiff.c \
+ wmbiff.h \
socket.c \
Pop3Client.c \
mboxClient.c \
@@ -49,9 +50,9 @@ test_wmbiff_SOURCES = \
Pop3Client.c \
tlsComm.c \
tlsComm.h \
+ wmbiff.h \
socket.c
EXTRA_test_wmbiff_SOURCES = \
- gnutls-common.c \
gnutls-common.h
test_wmbiff_LDADD = \
$(LIBGCRYPT_LIBS) \
@@ -59,8 +60,12 @@ test_wmbiff_LDADD = \

test_tlscomm_SOURCES = \
test_tlscomm.c \
+ Client.h \
tlsComm.c \
- tlsComm.h
+ tlsComm.h \
+ wmbiff.h
+EXTRA_test_tlscomm_SOURCES = \
+ gnutls-common.h
test_tlscomm_LDADD = \
$(LIBGNUTLS_LIBS)

diff --git a/wmbiff/wmbiff/test_tlscomm.c b/wmbiff/wmbiff/test_tlscomm.c
index fec63f7c44fd..7370b5ba7207 100644
--- a/wmbiff/wmbiff/test_tlscomm.c
+++ b/wmbiff/wmbiff/test_tlscomm.c
@@ -1,17 +1,27 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
-#include <tlsComm.h>
+#ifdef USE_GNUTLS
+#include <gnutls/gnutls.h>
+#endif
+
+#include "Client.h"
+#include "tlsComm.h"
+#include "wmbiff.h"

int debug_default = 2;
int SkipCertificateCheck = 0;
const char *certificate_filename = NULL;
const char *tls = "NORMAL";

-int exists(const char *filename __attribute__ ((unused)))
+int exists(UNUSED(const char *filename))
{
return (0);
}
@@ -25,10 +35,13 @@ int x_socket(void)
return (0);
}

-int print_info(void *state __attribute__((unused)))
+#ifdef USE_GNUTLS
+#include "gnutls-common.h"
+int print_info(UNUSED(gnutls_session_t state), UNUSED(const char* hostname))
{
return (0);
}
+#endif

int Relax = 1;

diff --git a/wmbiff/wmbiff/test_wmbiff.c b/wmbiff/wmbiff/test_wmbiff.c
index a908d42f3cc7..10ecbbb71458 100644
--- a/wmbiff/wmbiff/test_wmbiff.c
+++ b/wmbiff/wmbiff/test_wmbiff.c
@@ -17,11 +17,15 @@
#endif

#include <unistd.h>
+#ifdef USE_GNUTLS
+#include <gnutls/gnutls.h>
+#endif

#include "Client.h"
#include "passwordMgr.h"
#include "tlsComm.h"
#include "charutil.h"
+#include "wmbiff.h"

void ProcessPendingEvents(void)
{
@@ -393,10 +397,13 @@ int test_sock_connect(void)
}


-int print_info(UNUSED(void *state))
+#ifdef USE_GNUTLS
+#include "gnutls-common.h"
+int print_info(UNUSED(gnutls_session_t state), UNUSED(const char* hostname))
{
return (0);
}
+#endif
const char *certificate_filename = NULL;
const char *tls = "NORMAL";
int SkipCertificateCheck = 0;
diff --git a/wmbiff/wmbiff/tlsComm.c b/wmbiff/wmbiff/tlsComm.c
index ea2ef90895c8..bbf3e718a148 100644
--- a/wmbiff/wmbiff/tlsComm.c
+++ b/wmbiff/wmbiff/tlsComm.c
@@ -28,9 +28,9 @@
#include <dmalloc.h>
#endif

-#include "tlsComm.h"
-
#include "Client.h" /* debugging messages */
+#include "tlsComm.h"
+#include "wmbiff.h"

/* if non-null, set to a file for certificate verification */
extern const char *certificate_filename;
@@ -100,9 +100,6 @@ void tlscomm_close(struct connection_state *scs)
free(scs);
}

-extern int x_socket(void);
-extern void ProcessPendingEvents(void);
-
/* this avoids blocking without using non-blocking i/o */
static int wait_for_it(int sd, int timeoutseconds)
{
diff --git a/wmbiff/wmbiff/wmbiff.c b/wmbiff/wmbiff/wmbiff.c
index 0e208d9b3969..724ed7885697 100644
--- a/wmbiff/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff/wmbiff.c
@@ -34,6 +34,7 @@
#include "Client.h"
#include "charutil.h"
#include "MessageList.h"
+#include "wmbiff.h"

#ifdef USE_DMALLOC
#include <dmalloc.h>
@@ -1014,11 +1015,11 @@ static void restart_wmbiff(int sig
fprintf(stderr, "Unable to restart wmbiff: missing restart arguments (NULL)!\n");
}

-extern int x_socket(void)
+int x_socket(void)
{
return ConnectionNumber(display);
}
-extern void ProcessPendingEvents(void)
+void ProcessPendingEvents(void)
{
static int but_pressed_region = -1; /* static so click can be determined */
int but_released_region = -1;
diff --git a/wmbiff/wmbiff/wmbiff.h b/wmbiff/wmbiff/wmbiff.h
new file mode 100644
index 000000000000..025a02cefc56
--- /dev/null
+++ b/wmbiff/wmbiff/wmbiff.h
@@ -0,0 +1,7 @@
+#ifndef WMBIFF_H_INCLUDED
+#define WMBIFF_H_INCLUDED
+
+int x_socket(void);
+void ProcessPendingEvents(void);
+
+#endif /* !defined (WMBIFF_H_INCLUDED) */
--
2.43.0

Reply all
Reply to author
Forward
0 new messages