aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2010-10-05 02:19:17 +0200
committerMatthias Andree <matthias.andree@gmx.de>2010-10-05 02:19:17 +0200
commitecc8edf91ce64d4c9f242fc425fe407a8acfaae6 (patch)
treeefff3e10faa0caddaaa5fdb000efc64e45ec69cd
parent33c07e0faee095585f6602d782a4fc10fbe8747a (diff)
downloadfetchmail-ecc8edf91ce64d4c9f242fc425fe407a8acfaae6.tar.gz
fetchmail-ecc8edf91ce64d4c9f242fc425fe407a8acfaae6.tar.bz2
fetchmail-ecc8edf91ce64d4c9f242fc425fe407a8acfaae6.zip
Fix prototype warnings, remove unused functions.
-rw-r--r--Makefile.am3
-rw-r--r--fetchmail.h12
-rw-r--r--fm_strl.h16
-rw-r--r--smbencrypt.c91
-rw-r--r--strlcat.c2
-rw-r--r--strlcpy.c2
6 files changed, 28 insertions, 98 deletions
diff --git a/Makefile.am b/Makefile.am
index 3f8f8ea0..211da3ae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,7 +38,8 @@ libfm_a_SOURCES= xmalloc.c base64.c rfc822.c report.c rfc2047e.c \
smbencrypt.h smbdes.c smbencrypt.c smbmd4.c smbutil.c \
libesmtp/gethostbyname.h libesmtp/gethostbyname.c \
smbtypes.h fm_getaddrinfo.c tls.c rfc822valid.c \
- xmalloc.h sdump.h sdump.c x509_name_match.c
+ xmalloc.h sdump.h sdump.c x509_name_match.c \
+ fm_strl.h
libfm_a_LIBADD= $(EXTRAOBJ)
libfm_a_DEPENDENCIES= $(EXTRAOBJ)
LDADD = libfm.a @LIBINTL@ $(LIBOBJS)
diff --git a/fetchmail.h b/fetchmail.h
index 9502d1e3..4ad810a2 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -44,6 +44,8 @@ struct addrinfo;
char *strstr(const char *, const char *);
#endif
+#include "fm_strl.h"
+
/* constants designating the various supported protocols */
#define P_AUTO 1
#define P_POP2 2
@@ -740,16 +742,6 @@ extern const char *program_name;
* <tab>;<newline>;<vertical-tab>;<form-feed>;<carriage-return>;<space> */
#define POSIX_space "\t\n\v\f\r "
-/* strlcpy/strlcat prototypes */
-#ifndef HAVE_STRLCAT
-size_t
-strlcat(char *dst, const char *src, size_t siz);
-#endif
-#ifndef HAVE_STRLCPY
-size_t
-strlcpy(char *dst, const char *src, size_t siz);
-#endif
-
/** Resolve the a TCP service name or a string containing only a decimal
* positive integer to a port number. Returns -1 for error. */
int servport(const char *service);
diff --git a/fm_strl.h b/fm_strl.h
new file mode 100644
index 00000000..fb7f9e23
--- /dev/null
+++ b/fm_strl.h
@@ -0,0 +1,16 @@
+#ifndef FM_STRL_H
+#define FM_STRL_H
+
+#include "config.h"
+
+/* strlcpy/strlcat prototypes */
+#ifndef HAVE_STRLCAT
+size_t
+strlcat(char *dst, const char *src, size_t siz);
+#endif
+#ifndef HAVE_STRLCPY
+size_t
+strlcpy(char *dst, const char *src, size_t siz);
+#endif
+
+#endif
diff --git a/smbencrypt.c b/smbencrypt.c
index 8d12f0ca..ad14707f 100644
--- a/smbencrypt.c
+++ b/smbencrypt.c
@@ -46,7 +46,7 @@ typedef int BOOL;
The variable n should always be one less than the available size.
****************************************************************************/
-char *StrnCpy(char *dest,const char *src, size_t n)
+static char *StrnCpy(char *dest,const char *src, size_t n)
{
char *d = dest;
if (!dest) return(NULL);
@@ -59,7 +59,7 @@ char *StrnCpy(char *dest,const char *src, size_t n)
return(dest);
}
-size_t skip_multibyte_char(char c)
+static size_t skip_multibyte_char(char c)
{
(void)c;
return 0;
@@ -71,35 +71,7 @@ safe string copy into a known length string. maxlength does not
include the terminating zero.
********************************************************************/
-char *safe_strcpy(char *dest,const char *src, size_t maxlength)
-{
- size_t len;
-
- if (!dest) {
- DEBUG(0,("ERROR: NULL dest in safe_strcpy\n"));
- return NULL;
- }
-
- if (!src) {
- *dest = 0;
- return dest;
- }
-
- len = strlen(src);
-
- if (len > maxlength) {
- DEBUG(0,("ERROR: string overflow by %d in safe_strcpy [%.50s]\n",
- (int)(len-maxlength), src));
- len = maxlength;
- }
-
- memcpy(dest, src, len);
- dest[len] = 0;
- return dest;
-}
-
-
-void strupper(char *s)
+static void strupper(char *s)
{
while (*s)
{
@@ -182,7 +154,7 @@ static int _my_mbstowcs(int16 *dst, uchar *src, int len)
* Creates the MD4 Hash of the users password in NT UNICODE.
*/
-void E_md4hash(uchar *passwd, uchar *p16)
+static void E_md4hash(uchar *passwd, uchar *p16)
{
int len;
int16 wpwd[129];
@@ -200,42 +172,6 @@ void E_md4hash(uchar *passwd, uchar *p16)
mdfour(p16, (unsigned char *)wpwd, len);
}
-/* Does both the NT and LM owfs of a user's password */
-void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16])
-{
- char passwd[130];
-
- memset(passwd,'\0',130);
- safe_strcpy( passwd, pwd, sizeof(passwd)-1);
-
- /* Calculate the MD4 hash (NT compatible) of the password */
- memset(nt_p16, '\0', 16);
- E_md4hash((uchar *)passwd, nt_p16);
-
-#ifdef DEBUG_PASSWORD
- DEBUG(100,("nt_lm_owf_gen: pwd, nt#\n"));
- dump_data(120, passwd, strlen(passwd));
- dump_data(100, (char *)nt_p16, 16);
-#endif
-
- /* Mangle the passwords into Lanman format */
- passwd[14] = '\0';
- strupper(passwd);
-
- /* Calculate the SMB (lanman) hash functions of the password */
-
- memset(p16, '\0', 16);
- E_P16((uchar *) passwd, (uchar *)p16);
-
-#ifdef DEBUG_PASSWORD
- DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n"));
- dump_data(120, passwd, strlen(passwd));
- dump_data(100, (char *)p16, 16);
-#endif
- /* clear out local copy of user's password (just being paranoid). */
- memset(passwd, '\0', sizeof(passwd));
-}
-
/* Does the des encryption from the NT or LM MD4 hash. */
void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24])
{
@@ -247,25 +183,6 @@ void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24])
E_P24(p21, c8, p24);
}
-/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */
-void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
-{
- uchar p21[21];
-
- memset(p21,'\0',21);
- memcpy(p21, passwd, 8);
- memset(p21 + 8, 0xbd, 8);
-
- E_P24(p21, ntlmchalresp, p24);
-#ifdef DEBUG_PASSWORD
- DEBUG(100,("NTLMSSPOWFencrypt: p21, c8, p24\n"));
- dump_data(100, (char *)p21, 21);
- dump_data(100, (char *)ntlmchalresp, 8);
- dump_data(100, (char *)p24, 24);
-#endif
-}
-
-
/* Does the NT MD4 hash then des encryption. */
void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24)
diff --git a/strlcat.c b/strlcat.c
index 259500f8..22428d68 100644
--- a/strlcat.c
+++ b/strlcat.c
@@ -21,6 +21,8 @@
#include <assert.h>
#include <string.h>
+#include "fm_strl.h"
+
#ifndef HAVE_STRLCAT
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
diff --git a/strlcpy.c b/strlcpy.c
index bb7d4096..5963dfe3 100644
--- a/strlcpy.c
+++ b/strlcpy.c
@@ -21,6 +21,8 @@
#include <assert.h>
#include <string.h>
+#include "fm_strl.h"
+
#ifndef HAVE_STRLCPY
/*
* Copy src to string dst of size siz. At most siz-1 characters