From 2bea3d42e0d64a18c5ae4e58e3868a6fb23e6c42 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 30 Nov 2016 21:16:45 -0500 Subject: [PATCH] wmbiff: Use unsigned data type for port number. --- wmbiff/wmbiff/Client.h | 7 ++++--- wmbiff/wmbiff/socket.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wmbiff/wmbiff/Client.h b/wmbiff/wmbiff/Client.h index b3a048c..cd89496 100644 --- a/wmbiff/wmbiff/Client.h +++ b/wmbiff/wmbiff/Client.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #ifdef HAVE_GCRYPT_H @@ -78,8 +79,8 @@ typedef struct _mbox_t { char password[BUF_SMALL]; char userName[BUF_BIG]; char serverName[BUF_BIG]; - int serverPort; - int localPort; + uint16_t serverPort; + uint16_t localPort; char authList[100]; unsigned int dossl:1; /* use tls. */ /* prompt the user if we can't login / password is empty */ @@ -113,7 +114,7 @@ int shellCreate( /*@notnull@ */ Pop3 pc, const char *str); int mboxCreate( /*@notnull@ */ Pop3 pc, const char *str); int maildirCreate( /*@notnull@ */ Pop3 pc, const char *str); -int sock_connect(const char *hostname, int port); +int sock_connect(const char *hostname, uint16_t port); FILE *openMailbox(Pop3 pc, const char *mbox_filename); /* backtickExpand returns null on failure */ diff --git a/wmbiff/wmbiff/socket.c b/wmbiff/wmbiff/socket.c index 7f7a9ec..87d0732 100644 --- a/wmbiff/wmbiff/socket.c +++ b/wmbiff/wmbiff/socket.c @@ -48,7 +48,7 @@ static int sanity_check_hostname(const char *hostname) || inet_aton(hostname, &dummy)); } -static int ipv4_sock_connect(struct in_addr *address, short port) +static int ipv4_sock_connect(struct in_addr *address, uint16_t port) { struct sockaddr_in addr; int fd, i; @@ -82,7 +82,7 @@ static int ipv4_sock_connect(struct in_addr *address, short port) /* 1 June 2002; incorporated IPv6 support by Jun-ichiro itojun Hagino , thanks! */ -int sock_connect(const char *hostname, int port) +int sock_connect(const char *hostname, uint16_t port) { #ifdef HAVE_GETADDRINFO struct addrinfo hints, *res, *res0;