$Log$
+ Revision 580.64 2001/10/17 19:40:38 nbryant
+ warning fixes and cleanups for 64-bit machines
+
Revision 580.63 2001/10/16 20:47:37 nbryant
- backed out -export-dynamic, it doesn't do anything and i've found the real
problem
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
#include "citadel.h"
#include "config.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
+
static void make_message(FILE *fp, char *target_room, char *author)
{
int a;
#include "control.h"
#include "tools.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
struct CitContext *ContextList = NULL;
char *unique_session_numbers;
int ScheduledShutdown = 0;
dnl Set up system-dependent compiler flags.
if test "$GCC" = yes; then
case "$host" in
- *-*-solaris*)
- CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
+ *-*-solaris*|alpha*-dec-osf*)
+ CFLAGS="$CFLAGS -Wall -Wcast-align -Wno-char-subscripts"
;;
*)
- CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
+ CFLAGS="$CFLAGS -Wall -Wcast-align -Wstrict-prototypes"
;;
esac
fi
#include "tools.h"
#include "room_ops.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
struct CitControl CitControl;
struct config config;
FILE *control_fp = NULL;
*
*/
int getmx(char *mxbuf, char *dest) {
- char answer[1024];
+ union {
+ u_char bytes[1024];
+ HEADER header;
+ } answer;
int ret;
unsigned char *startptr, *endptr, *ptr;
char expanded_buf[1024];
unsigned short pref, type;
int n = 0;
- HEADER *hp;
int qdcount;
struct mx *mxrecs = NULL;
*/
ret = res_query(
dest,
- C_IN, T_MX, (unsigned char *)answer, sizeof(answer) );
+ C_IN, T_MX, (unsigned char *)answer.bytes, sizeof(answer) );
if (ret < 0) {
mxrecs = mallok(sizeof(struct mx));
if (ret > sizeof(answer))
ret = sizeof(answer);
- hp = (HEADER *)&answer[0];
- startptr = &answer[0]; /* start and end of buffer */
- endptr = &answer[ret];
+ startptr = &answer.bytes[0]; /* start and end of buffer */
+ endptr = &answer.bytes[ret];
ptr = startptr + HFIXEDSZ; /* advance past header */
- for (qdcount = ntohs(hp->qdcount); qdcount--; ptr += ret + QFIXEDSZ) {
+ for (qdcount = ntohs(answer.header.qdcount); qdcount--; ptr += ret + QFIXEDSZ) {
if ((ret = dn_skipname(ptr, endptr)) < 0) {
lprintf(9, "dn_skipname error\n");
return(0);
#include "tools.h"
#include "citserver.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
/*
* network_talking_to() -- concurrency checker
}
fprintf(imfp->output_fp, "\r\n");
}
- fprintf(imfp->output_fp, "Content-Length: %d\r\n", length);
+ fprintf(imfp->output_fp, "Content-Length: %ld\r\n", (long)length);
fprintf(imfp->output_fp, "\r\n");
}
#include "imap_tools.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
/*
* Output a string to the IMAP client, either as a literal or quoted.
* (We do a literal if it has any double-quotes or backslashes.)
#include "parsedate.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
+
struct trynamebuf {
char buffer1[SIZ];
char buffer2[SIZ];
}
memcpy(p, buf, t);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (cit_uint32_t *) ctx->in);
+ MD5Transform(ctx->buf, ctx->in);
buf += t;
len -= t;
}
while (len >= 64) {
memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (cit_uint32_t *) ctx->in);
+ MD5Transform(ctx->buf, ctx->in);
buf += 64;
len -= 64;
}
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
- p = ctx->in + count;
+ p = ((unsigned char*)ctx->in) + count;
*p++ = 0x80;
/* Bytes of padding needed to make 64 bytes */
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (cit_uint32_t *) ctx->in);
+ MD5Transform(ctx->buf, ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
* md5 string
*/
-char *make_apop_string(char *realpass, char *nonce, u_char *buffer)
+char *make_apop_string(char *realpass, char *nonce, char *buffer)
{
struct MD5Context ctx;
u_char rawdigest[MD5_DIGEST_LEN];
MD5Init(&ctx);
// printf("MD5@@: Adding nonce: %s\n", nonce);
- MD5Update(&ctx, nonce, strlen(nonce));
+ MD5Update(&ctx, (u_char*)nonce, strlen(nonce));
// printf("MD5@@: Adding password %s\n", realpass);
- MD5Update(&ctx, realpass, strlen(realpass));
+ MD5Update(&ctx, (u_char*)realpass, strlen(realpass));
MD5Final(rawdigest, &ctx);
for (i=0; i<MD5_DIGEST_LEN; i++)
{
struct MD5Context {
cit_uint32_t buf[4];
cit_uint32_t bits[2];
- unsigned char in[64];
+ cit_uint32_t in[16];
};
void MD5Init(struct MD5Context *context);
unsigned len);
void MD5Final(unsigned char digest[16], struct MD5Context *context);
void MD5Transform(cit_uint32_t buf[4], cit_uint32_t const in[16]);
-char *make_apop_string(char *realpass, char *nonce, u_char *buffer);
+char *make_apop_string(char *realpass, char *nonce, char *buffer);
/*
* This is needed to make RSAREF happy on some MS-DOS compilers.
*/
if (msg->cm_fields['T'] == NULL) {
lprintf(9, "Generating timestamp\n");
- sprintf(aaa, "%ld", time(NULL));
+ sprintf(aaa, "%ld", (long)time(NULL));
msg->cm_fields['T'] = strdoop(aaa);
}
"Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n"
"bounceto|%s@%s\n"
"remote|%s|0||\n",
- SPOOLMIME, newmsgid, time(NULL),
+ SPOOLMIME, newmsgid, (long)time(NULL),
msg->cm_fields['A'], msg->cm_fields['N'],
recipient );
sprintf(buf, "cit%ld", author->usernum); /* Path */
msg->cm_fields['P'] = strdoop(buf);
- sprintf(buf, "%ld", time(NULL)); /* timestamp */
+ sprintf(buf, "%ld", (long)time(NULL)); /* timestamp */
msg->cm_fields['T'] = strdoop(buf);
if (fake_name[0]) /* author */
cprintf("%d %ld\n", SEND_BINARY, msglen);
- client_read(&ch, 1); /* 0xFF magic number */
+ client_read((char*)&ch, 1); /* 0xFF magic number */
msg->cm_magic = CTDLMESSAGE_MAGIC;
- client_read(&ch, 1); /* anon type */
+ client_read((char*)&ch, 1); /* anon type */
msg->cm_anon_type = ch;
- client_read(&ch, 1); /* format type */
+ client_read((char*)&ch, 1); /* format type */
msg->cm_format_type = ch;
msglen = msglen - 3;
while (msglen > 0) {
- client_read(&which_field, 1);
+ client_read((char*)&which_field, 1);
if (!isalpha(which_field)) valid_msg = 0;
--msglen;
tempbuf[0] = 0;
do {
- client_read(&ch, 1);
+ client_read((char*)&ch, 1);
--msglen;
a = strlen(tempbuf);
tempbuf[a+1] = 0;
#include "user_ops.h"
#include "room_ops.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
struct ChatLine *ChatQueue = NULL;
int ChatLastMsg = 0;
#include "clientsocket.h"
#include "file_ops.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
/*
* When we do network processing, it's accomplished in two passes; one to
sprintf(&serialized_table[strlen(
serialized_table)], "%s|%ld\n",
ut->message_id,
- ut->timestamp);
+ (long)ut->timestamp);
}
/* Now free the memory */
sprintf(&serialized_map[strlen(serialized_map)],
"%s|%ld|%s\n",
nmptr->nodename,
- nmptr->lastcontact,
+ (long)nmptr->lastcontact,
nmptr->nexthop);
}
}
sprintf(instr,
"Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n"
"bounceto|postmaster@%s\n" ,
- SPOOLMIME, msgnum, time(NULL), config.c_fqdn );
+ SPOOLMIME, msgnum, (long)time(NULL), config.c_fqdn );
/* Generate delivery instructions for each recipient */
for (nptr = sc->listrecps; nptr != NULL; nptr = nptr->next) {
phree(msg->cm_fields['I']);
}
sprintf(buf, "%ld.%04x.%04x@%s",
- time(NULL), getpid(), ++serialnum, config.c_fqdn);
+ (long)time(NULL), getpid(), ++serialnum, config.c_fqdn);
msg->cm_fields['I'] = strdoop(buf);
/*
#include "clientsocket.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
struct citsmtp { /* Information about the current session */
int command_state;
char helo_node[SIZ];
/* $Id$ */
+#ifndef __DECC
int snprintf (char *buf, size_t max, const char *fmt, ...);
int vsnprintf (char *buf, size_t max, const char *fmt, va_list argp);
+#endif
fprintf(stderr, "%04d/%02d/%02d %2d:%02d:%02d.%03ld %s",
tim->tm_year + 1900, tim->tm_mon + 1, tim->tm_mday,
tim->tm_hour, tim->tm_min, tim->tm_sec,
- tv.tv_usec / 1000, buf);
+ (long)tv.tv_usec / 1000, buf);
fflush(stderr);
}