void to64frombits(char *out, const void *in_, int inlen)
/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
{
- const unsigned char *in = in_;
+ const unsigned char *in = (const unsigned char *)in_;
for (; inlen >= 3; inlen -= 3)
{
{
int len = 0;
register unsigned char digit1, digit2, digit3, digit4;
- unsigned char *out = out_;
+ unsigned char *out = (unsigned char *)out_;
if (in[0] == '+' && in[1] == ' ')
in += 2;
/* Time to allocate memory to store the sizes */
xfree(*msgsizes);
- *msgsizes = xmalloc(sizeof(int) * fetchsizelimit);
+ *msgsizes = (int *)xmalloc(sizeof(int) * fetchsizelimit);
}
/*
{
xfree(ctl->server.truename);
ctl->server.truename = xstrdup(res->ai_canonname);
- ctl->server.trueaddr = xmalloc(res->ai_addrlen);
+ ctl->server.trueaddr = (struct sockaddr *)xmalloc(res->ai_addrlen);
ctl->server.trueaddr_len = res->ai_addrlen;
memcpy(ctl->server.trueaddr, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
!(proto->getpartialsizes && NUM_NONZERO(ctl->fetchsizelimit)))
{
xfree(msgsizes);
- msgsizes = xmalloc(sizeof(int) * count);
+ msgsizes = (int *)xmalloc(sizeof(int) * count);
for (i = 0; i < count; i++)
msgsizes[i] = 0;
return(err);
}
-int do_protocol(ctl, proto)
-/* retrieve messages from server using given protocol method table */
-struct query *ctl; /* parsed options with merged-in defaults */
-const struct method *proto; /* protocol method table */
+/** retrieve messages from server using given protocol method table */
+int do_protocol(struct query *ctl /** parsed options with merged-in defaults */,
+ const struct method *proto /** protocol method table */)
{
int err;
static void restore_tty_state(void);
static RETSIGTYPE sigint_handler(int);
-char *fm_getpassword(prompt)
-char *prompt;
+char *fm_getpassword(char *prompt)
{
#if !(defined(HAVE_TCSETATTR) || defined(HAVE_TERMIO_H) || defined(HAVE_STTY))
#if defined(HAVE_GETPASS)
{
if (unseen_messages)
free(unseen_messages);
- unseen_messages = xmalloc(count * sizeof(unsigned int));
+ unseen_messages = (unsigned int *)xmalloc(count * sizeof(unsigned int));
memset(unseen_messages, 0, count * sizeof(unsigned int));
unseen = 0;
memset (ctx, 0, sizeof (struct ghbnctx));
ctx->hostbuf_len = 2048;
- if ((ctx->hostbuf = malloc (ctx->hostbuf_len)) == NULL)
+ if ((ctx->hostbuf = (char *)malloc (ctx->hostbuf_len)) == NULL)
{
errno = ENOMEM;
return NULL;
&hp, &ctx->h_err)) == ERANGE)
{
ctx->hostbuf_len += 1024;
- if ((tmp = realloc (ctx->hostbuf, ctx->hostbuf_len)) == NULL)
+ if ((tmp = (char *)realloc (ctx->hostbuf, ctx->hostbuf_len)) == NULL)
{
errno = ENOMEM;
return NULL;
*/
void MD5Update(struct MD5Context *ctx, const void *buf_, unsigned len)
{
- const unsigned char *buf = buf_;
+ const unsigned char *buf = (const unsigned char *)buf_;
register uint32 t;
/* Update bitcount */
list of entries. NULL is returned if the file could not be
parsed. */
netrc_entry *
-parse_netrc (file)
- char *file;
+parse_netrc (char *file)
{
FILE *fp;
char buf[POPBUFSIZE+1], *p, *tok;
/* Return the netrc entry from LIST corresponding to HOST. NULL is
returned if no such entry exists. */
netrc_entry *
-search_netrc (list, host, login)
- netrc_entry *list;
- char *host, *login;
+search_netrc (netrc_entry *list, char *host, char *login)
{
/* Look for the HOST in LIST. */
while (list)
/* ntlm.h -- interface declarations for SMB authentication code */
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef unsigned char uint8;
-
+#include "smbtypes.h"
/*
* These structures are byte-order dependant, and should not
#include "md5.h"
#ifdef OPIE_ENABLE
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <opie.h>
+#ifdef __cplusplus
+}
+#endif
int do_otp(int sock, char *command, struct query *ctl)
{
#endif
}
-int parsecmdline (argc, argv, rctl, ctl)
-/* parse and validate the command line options */
-int argc; /* argument count */
-char **argv; /* argument strings */
-struct runctl *rctl; /* global run controls to modify */
-struct query *ctl; /* option record to be initialized */
+/** parse and validate the command line options */
+int parsecmdline (int argc /** argument count */,
+ char **argv /** argument strings */,
+ struct runctl *rctl /** global run controls to modify */,
+ struct query *ctl /** option record to initialize */)
{
/*
* return value: if positive, argv index of last parsed option + 1
#include "i18n.h"
#ifdef OPIE_ENABLE
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <opie.h>
+#ifdef __cplusplus
+}
+#endif
#endif /* OPIE_ENABLE */
/* global variables: please reinitialize them explicitly for proper
if ((challenge = strstr(lastok, "otp-"))) {
char response[OPIE_RESPONSE_MAX+1];
int i;
+ char *n = xstrdup("");
- i = opiegenerator(challenge, !strcmp(ctl->password, "opie") ? "" : ctl->password, response);
+ i = opiegenerator(challenge, !strcmp(ctl->password, "opie") ? n : ctl->password, response);
+ free(n);
if ((i == -2) && !run.poll_interval) {
char secret[OPIE_SECRET_MAX+1];
fprintf(stderr, GT_("Secret pass phrase: "));
%%
-void escapes(cp, tp)
-/* process standard C-style escape sequences in a string,
+/** process standard C-style escape sequences in a string,
* this can never lengthen the output, so cp and tp may overlap as long
* as cp >= tp. */
-const char *cp; /* source string with escapes */
-char *tp; /* target buffer for digested string */
+void escapes(const char *cp /** source string with escapes */,
+ char *tp /** target buffer for digested string */)
{
while (*cp)
{
current.server = save;
}
-struct query *hostalloc(init)
-/* append a host record to the host list */
-struct query *init; /* pointer to block containing initial values */
+/** append a host record to the host list */
+struct query *hostalloc(struct query *init /** pointer to block containing
+ initial values */)
{
struct query *node;
count++;
r += strspn(r, ws);
}
- words = xmalloc(sizeof(char *) * (count + 1));
+ words = (char **)xmalloc(sizeof(char *) * (count + 1));
idx = 0;
r = string;
unsigned char* rbuf, int unicodeit);
static void CompUserResp();
static int CheckUserAuth();
- static void md5(void* in, int len, unsigned char* out);
+ static void md5(const void* in, int len, unsigned char* out);
#endif
/* RPA protocol definitions */
globals: reads outlevel.
*********************************************************************/
-static int POP3_rpa_resp (argbuf,socket)
-char *argbuf;
-int socket;
+static int POP3_rpa_resp (char *argbuf, int socket)
{
int ok;
char buf [POPBUFSIZE];
globals: none
*********************************************************************/
-static void LenAppend(pptr_,len)
-char **pptr_;
-int len;
+static void LenAppend(char **pptr_, int len)
{
unsigned char **pptr = (unsigned char **)pptr_;
globals: reads outlevel.
*********************************************************************/
-int LenSkip(pptr,rxlen)
-char **pptr;
-int rxlen;
+int LenSkip(char **pptr, int rxlen)
{
int len;
char *save;
globals: reads outlevel.
*********************************************************************/
-static int DecBase64(bufp)
-char *bufp;
+static int DecBase64(char *bufp)
{
unsigned int newx, bits=0, cnt=0, i, part=0;
unsigned char ch;
globals: reads outlevel;
*********************************************************************/
-static void EncBase64(bufp,len)
-char *bufp;
-int len;
+static void EncBase64(char *bufp, int len)
{
char* outp;
unsigned char c1,c2,c3;
globals: reads outlevel
*********************************************************************/
-static void md5(void *in_,int len,unsigned char *out)
+static void md5(const void *in_,int len,unsigned char *out)
{
int i;
MD5_CTX md5context;
- unsigned char *in = in_;
+ const unsigned char *in = (const unsigned char *)in_;
if (outlevel >= O_DEBUG)
{
for (idp = msg->recipients; idp; idp = idp->next)
total_addresses++;
#ifdef EXPLICIT_BOUNCE_ON_BAD_ADDRESS
- from_responses = xmalloc(sizeof(char *) * total_addresses);
+ from_responses = (char **)xmalloc(sizeof(char *) * total_addresses);
#endif /* EXPLICIT_BOUNCE_ON_BAD_ADDRESS */
for (idp = msg->recipients; idp; idp = idp->next)
if (idp->val.status.mark == XMIT_ACCEPT)
char **responses;
/* eat the RFC2033-required responses, saving errors */
- responses = xmalloc(sizeof(char *) * lmtp_responses);
+ responses = (char **)xmalloc(sizeof(char *) * lmtp_responses);
for (errors = i = 0; i < lmtp_responses; i++)
{
if ((smtp_err = SMTP_ok(ctl->smtp_socket, ctl->smtphostmode))
-typedef unsigned short uint16;
-typedef unsigned uint32;
-typedef unsigned char uint8;
+#include "smbtypes.h"
typedef struct
{
*out++ = *in2++;
}
-static void xor(char *out, char *in1, char *in2, int n)
+static void exor(char *out, char *in1, char *in2, int n)
{
int i;
for (i=0;i<n;i++)
permute(er, r, perm4, 48);
- xor(erk, er, ki[forw ? i : 15 - i], 48);
+ exor(erk, er, ki[forw ? i : 15 - i], 48);
for (j=0;j<8;j++)
for (k=0;k<6;k++)
cb[j*4+k] = b[j][k];
permute(pcb, cb, perm5, 32);
- xor(r2, l, pcb, 32);
+ exor(r2, l, pcb, 32);
for (j=0;j<32;j++)
l[j] = r[j];
#include <ctype.h>
#include "smbbyteorder.h"
#include "smbdes.h"
+#include "smbencrypt.h"
#include "smbmd4.h"
#ifndef _AIX
typedef unsigned char uchar;
#endif
typedef signed short int16;
-typedef unsigned short uint16;
typedef int BOOL;
#define False 0
#define True 1
-void SMBencrypt(char *passwd, uint8 *c8, uint8 *p24);
-void SMBNTencrypt(char *passwd, uint8 *c8, uint8 *p24);
+#ifndef SMBENCRYPT_H
+#define SMBENCRYPT_H
+
+#include "smbtypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void SMBencrypt(uint8 *passwd, uint8 *c8, uint8 *p24);
+void SMBNTencrypt(uint8 *passwd, uint8 *c8, uint8 *p24);
+#ifdef __cplusplus
+}
+
+#endif
+#endif
*p = '\0';
}
- SMBencrypt(password, challenge->challengeData, lmRespData);
- SMBNTencrypt(password, challenge->challengeData, ntRespData);
+ SMBencrypt((uint8*)password, challenge->challengeData, lmRespData);
+ SMBNTencrypt((uint8*)password, challenge->challengeData, ntRespData);
response->bufIndex = 0;
memcpy(response->ident,"NTLMSSP\0\0\0",8);
}
plugin_copy_len = plugin_len + host_len * host_count + service_len * service_count;
- plugin_copy = malloc(plugin_copy_len + 1);
+ plugin_copy = (char *)malloc(plugin_copy_len + 1);
if (!plugin_copy)
{
report(stderr, GT_("fetchmail: malloc failed\n"));
}
plugin_copy[plugin_copy_len] = 0;
- argvec = malloc(s);
+ argvec = (const char **)malloc(s);
if (!argvec)
{
report(stderr, GT_("fetchmail: malloc failed\n"));
#ifdef FORCE_STUFFING
maxavailable = n;
#endif
- if ((newline = memchr(bp, '\n', n)) != NULL)
+ if ((newline = (char *)memchr(bp, '\n', n)) != NULL)
n = newline - bp + 1;
#ifndef __BEOS__
if ((n = fm_read(sock, bp, n)) == -1)
* If retval >= siz, truncation occurred.
*/
size_t
-strlcat(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
+strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
-strlcpy(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
+strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
|| !strncasecmp("Bcc:", line, 4)
|| !strncasecmp("Apparently-To:", line, 14))
{
- *to_chainptr = xmalloc(sizeof(struct addrblk));
+ *to_chainptr = (struct addrblk *)xmalloc(sizeof(struct addrblk));
(*to_chainptr)->offset = (line - msgblk.headers);
to_chainptr = &(*to_chainptr)->next;
*to_chainptr = NULL;
|| !strncasecmp("Resent-Cc:", line, 10)
|| !strncasecmp("Resent-Bcc:", line, 11))
{
- *resent_to_chainptr = xmalloc(sizeof(struct addrblk));
+ *resent_to_chainptr = (struct addrblk *)xmalloc(sizeof(struct addrblk));
(*resent_to_chainptr)->offset = (line - msgblk.headers);
resent_to_chainptr = &(*resent_to_chainptr)->next;
*resent_to_chainptr = NULL;
}
}
-int gen_recv(sock, buf, size)
-/* get one line of input from the server */
-int sock; /* socket to which server is connected */
-char *buf; /* buffer to receive input */
-int size; /* length of buffer */
+/** get one line of input from the server */
+int gen_recv(int sock /** socket to which server is connected */,
+ char *buf /* buffer to receive input */,
+ int size /* length of buffer */)
{
int oldphase = phase; /* we don't have to be re-entrant */