Update of /cvsroot/mahogany/M/lib/dspam
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14530
Modified Files:
config.h decode.h dspam.c error.c error.h lht.c libdspam.c
libdspam_objects.h nodetree.c nodetree.h sqlite_drv.c tbt.c
util.c
Log Message:
win32 build fixes
Index: config.h
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/config.h,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- config.h 7 Jul 2004 23:27:18 -0000 1.1.3.1
+++ config.h 7 Jul 2004 23:43:00 -0000 1.2
@@ -27,5 +27,7 @@
#include <limits.h>
+#ifndef _WIN32
#include <sys/param.h>
+#endif
/* Acceptable Word Delimiters */
Index: decode.h
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/decode.h,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- decode.h 7 Jul 2004 23:26:58 -0000 1.1.3.1
+++ decode.h 7 Jul 2004 23:43:00 -0000 1.2
@@ -21,5 +21,7 @@
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include "nodetree.h"
Index: dspam.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/dspam.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- dspam.c 7 Jul 2004 23:27:14 -0000 1.1.3.1
+++ dspam.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -28,11 +28,15 @@
#include <ctype.h>
#include <errno.h>
+#ifdef HAVE_UNISTD_H_
#include <unistd.h>
#include <pwd.h>
+#endif
#include <sys/types.h>
#include <signal.h>
#include <sys/stat.h>
+#ifndef _WIN32
#include <sys/wait.h>
#include <sys/param.h>
+#endif
#include "config.h"
#include "util.h"
@@ -61,4 +65,12 @@
#endif
+#ifndef CONFIGURE_ARGS
+#define CONFIGURE_ARGS "default"
+#endif
+
+#ifndef MLOCAL
+#define DELIVER_TO_STDOUT
+#endif
+
int
main (int argc, char *argv[])
@@ -90,5 +102,4 @@
#endif
- p = getpwuid (getuid ());
srand (getpid ());
@@ -115,4 +126,5 @@
#ifdef TRUSTED_USER_SECURITY
+ p = getpwuid (getuid ());
trusted = is_trusted(p);
if (!trusted)
@@ -122,5 +134,7 @@
#endif
+#ifdef MLOCAL
snprintf(ATX.mailer_args, sizeof(ATX.mailer_args), "%s ", MLOCAL);
+#endif
#ifdef DEBUG
@@ -1415,5 +1429,5 @@
&&
(isalnum
- ((int) signature_end[0]) || signature_end[0] == 32))
+ ((unsigned char) signature_end[0]) || signature_end[0] == 32))
signature_end++;
@@ -2607,6 +2621,7 @@
&& block->media_subtype == MST_SIGNED && !i && block->boundary != NULL)
{
- char boundary[strlen (block->boundary) + 1];
- char term[sizeof (boundary) + 2];
+ size_t len = strlen (block->boundary);
+ char *boundary = malloc(len + 1);
+ char *term = malloc(len + 2);
struct nt_node *node_nt, *prev_node = NULL;
struct nt_c c_nt;
@@ -2727,4 +2742,7 @@
}
+ free(term);
+ free(boundary);
+
break;
}
@@ -2901,5 +2919,5 @@
for(i=0;i<strlen(a);i++) {
- if (!(isalnum((int) a[i]) || a[i] == '+' || a[i] == '_' || a[i] == '-' ||
+ if (!(isalnum((unsigned char) a[i]) || a[i] == '+' || a[i] == '_' || a[i] ==
'-' ||
a[i] == '.' || a[i] == '/' || a[i] == '@')) {
strlcpy(b, a+i, sizeof(b));
Index: error.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/error.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- error.c 7 Jul 2004 23:27:22 -0000 1.1.3.1
+++ error.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -26,5 +26,7 @@
#include <string.h>
#include <stdarg.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#ifdef TIME_WITH_SYS_TIME
@@ -43,4 +45,8 @@
#include "config.h"
+#ifdef _WIN32
+ #include <process.h>
+#endif
+
/* Subroutine: report_error
Description: Reports an error to the supported facilities (currently stderr)
@@ -139,4 +145,12 @@
{
#ifdef DEBUG
+#ifdef _WIN32
+ char log_text[1024];
+ va_list args;
+ va_start (args, text);
+ snprintf (log_text, sizeof (log_text), text, args);
+ va_end (args);
+ debug(log_text);
+#else
va_list args;
@@ -148,4 +162,5 @@
va_end (args);
#endif
+#endif
}
#endif
Index: error.h
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/error.h,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- error.h 7 Jul 2004 23:27:21 -0000 1.1.3.1
+++ error.h 7 Jul 2004 23:43:00 -0000 1.2
@@ -22,5 +22,12 @@
# define _DSPAM_ERROR_H
+#ifdef _WIN32
+# define LOG_CRIT 2
+# define LOG_ERR 3
+# define LOG_WARNING 4
+# define LOG_INFO 6
+#else
#include <syslog.h>
+#endif
#ifdef DEBUG
@@ -47,8 +54,12 @@
#endif
+#ifdef _WIN32
+# define LOG( ... )
+#else
# define LOG( A, ... ) \
{ openlog("dspam", LOG_PID, LOG_MAIL); syslog( A, __VA_ARGS__ ); \
closelog(); LOGDEBUG( __VA_ARGS__ ) }
#endif
+#endif
#endif /* _DSPAM_ERROR_H */
Index: lht.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/lht.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- lht.c 7 Jul 2004 23:26:56 -0000 1.1.3.1
+++ lht.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -19,4 +19,8 @@
*/
+#ifdef HAVE_CONFIG_H
+#include <auto-config.h>
+#endif
+
#include <string.h>
#include <stdlib.h>
Index: libdspam.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/libdspam.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- libdspam.c 7 Jul 2004 23:27:00 -0000 1.1.3.1
+++ libdspam.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -29,5 +29,7 @@
#include <errno.h>
#include <math.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
@@ -1017,5 +1019,5 @@
for(i = 0; i < index->items; i++)
#else
- for (i = 0; i < ((index->items > 27) ? 27 : index->items); i++)
+ for (i = 0; i < ((index->items > 27) ? 27 : (long)index->items); i++)
#endif
{
@@ -1266,5 +1268,5 @@
chi_result = ((chi_s-chi_h)+1.0) / 2.0;
} else {
- chi_result = CHI_CUTOFF-0.1;
+ chi_result = (float)(CHI_CUTOFF-0.1);
}
@@ -1777,7 +1779,7 @@
for (i = 0; token[i] != 0; i++)
{
- if (!isdigit ((int) token[i]))
+ if (!isdigit ((unsigned char) token[i]))
all_num = 0;
- if (token[i] >= 127 || iscntrl ((int) token[i])) {
+ if (token[i] >= 127 || iscntrl ((unsigned char) token[i])) {
token[i] = 'z';
all_num = 0;
@@ -1787,5 +1789,5 @@
len = i - 1;
- if (isdigit ((int) token[0]))
+ if (isdigit ((unsigned char) token[0]))
{
if (token[len - 1] != '%')
@@ -1793,5 +1795,5 @@
}
- if (!isalnum ((int) token[0]) && token[0] != '$' && token[0] != '#')
+ if (!isalnum ((unsigned char) token[0]) && token[0] != '$' && token[0] != '#')
all_num = 1;
@@ -1855,7 +1857,7 @@
for (i = 0; token[i] != 0; i++)
{
- if (!isdigit ((int) token[i]))
+ if (!isdigit ((unsigned char) token[i]))
all_num = 0;
- if (token[i] >= 127 || iscntrl ((int) token[i])) {
+ if (token[i] >= 127 || iscntrl ((unsigned char) token[i])) {
token[i] = 'z';
all_num = 0;
@@ -1865,5 +1867,5 @@
len = i - 1;
- if (isdigit ((int) token[0]))
+ if (isdigit ((unsigned char) token[0]))
{
int l = len - 1;
@@ -1872,5 +1874,5 @@
}
- if (!isalnum ((int) token[0]) && token[0] != '$' && token[0] != '#')
+ if (!isalnum ((unsigned char) token[0]) && token[0] != '$' && token[0] != '#')
all_num = 1;
@@ -2020,5 +2022,5 @@
x = strchr(decode2, '%');
while(x != NULL) {
- if (isxdigit((int) x[1]) && isxdigit((int) x[2])) {
+ if (isxdigit((unsigned char) x[1]) && isxdigit((unsigned char) x[2])) {
hex[2] = x[1];
hex[3] = x[2];
Index: libdspam_objects.h
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/libdspam_objects.h,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- libdspam_objects.h 7 Jul 2004 23:26:56 -0000 1.1.3.1
+++ libdspam_objects.h 7 Jul 2004 23:43:00 -0000 1.2
@@ -29,4 +29,11 @@
#endif
+#ifdef _WIN32
+typedef unsigned int u_int32_t;
+typedef u_int32_t uid_t;
+#endif
+
+#include <time.h>
+
#include "decode.h"
Index: nodetree.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/nodetree.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- nodetree.c 7 Jul 2004 23:27:21 -0000 1.1.3.1
+++ nodetree.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -19,8 +19,5 @@
*/
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
#include "nodetree.h"
#include "util.h"
Index: nodetree.h
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/nodetree.h,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- nodetree.h 7 Jul 2004 23:27:00 -0000 1.1.3.1
+++ nodetree.h 7 Jul 2004 23:43:00 -0000 1.2
@@ -21,5 +21,7 @@
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#ifndef _NODETREE_H
Index: sqlite_drv.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/sqlite_drv.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- sqlite_drv.c 7 Jul 2004 23:27:22 -0000 1.1.3.1
+++ sqlite_drv.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -24,9 +24,13 @@
#include <string.h>
-#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <dirent.h>
-#include <unistd.h>
+#ifndef _WIN32
+# include <pwd.h>
+# include <dirent.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <errno.h>
#include <stdlib.h>
@@ -34,5 +38,4 @@
#include <fcntl.h>
#include <signal.h>
-#include <sqlite.h>
#ifdef TIME_WITH_SYS_TIME
@@ -56,4 +59,9 @@
#include "lht.h"
+#ifdef _WIN32
+# include <process.h>
+# include "dir_win32.h"
+#endif
+
int
dspam_init_driver (void)
Index: tbt.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/tbt.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- tbt.c 7 Jul 2004 23:27:12 -0000 1.1.3.1
+++ tbt.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -19,4 +19,8 @@
*/
+#ifdef HAVE_CONFIG_H
+#include <auto-config.h>
+#endif
+
#include <string.h>
#include <stdlib.h>
Index: util.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/util.c,v
retrieving revision 1.1.3.1
retrieving revision 1.2
diff -b -u -2 -r1.1.3.1 -r1.2
--- util.c 7 Jul 2004 23:26:59 -0000 1.1.3.1
+++ util.c 7 Jul 2004 23:43:00 -0000 1.2
@@ -28,8 +28,12 @@
#include <errno.h>
#include <error.h>
-#include <pwd.h>
+#ifndef _WIN32
+# include <pwd.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <stdio.h>
#include <math.h>
@@ -41,4 +45,10 @@
#include "libdspam.h"
+#ifdef _WIN32
+ #include <direct.h>
+
+ #define mkdir(filename, perm) _mkdir(filename)
+#endif
+
/* Compliments of Jay Freeman <[EMAIL PROTECTED]> */
@@ -329,4 +339,18 @@
}
+#ifdef _WIN32
+ /*
+ Windows uses both slash and backslash as path separators while the code
+ below only deals with slashes -- make it work by adjusting the path.
+ */
+ {
+ char *p;
+ for ( p = strchr(file, '\\'); p; p = strchr(p + 1, '\\') )
+ {
+ *p = '/';
+ }
+ }
+#endif
+
file_buffer_start = file;
path[0] = 0;
@@ -336,7 +360,11 @@
{
strlcat (path, dir, sizeof (path));
- strlcat (path, "/", sizeof (path));
dir = strsep (&file, "/");
+#ifdef _WIN32
+ /* don't try to create root directory of a drive */
+ if ( path[2] != '\0' || path[1] != ':' )
+#endif
+ {
if (dir != NULL && stat (path, &s))
{
@@ -352,4 +380,7 @@
}
}
+
+ strlcat (path, "/", sizeof (path));
+ }
free (file_buffer_start);
return 0;
@@ -496,4 +527,7 @@
int get_fcntl_lock(int fd) {
+#ifdef _WIN32
+ return 0;
+#else
struct flock f;
@@ -504,7 +538,11 @@
return fcntl(fd, F_SETLKW, &f);
+#endif
}
int free_fcntl_lock(int fd) {
+#ifdef _WIN32
+ return 0;
+#else
struct flock f;
@@ -515,4 +553,5 @@
return fcntl(fd, F_SETLKW, &f);
+#endif
}
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates