#include <stdio.h>
#include <ctype.h>
#include <signal.h>
-#if (WIN32|WINNT)
+#ifdef PHP_WIN32
#include "winsock.h"
MAILSTREAM DEFAULTPROTO;
#endif
PHP_FE(imap_alerts, NULL)
PHP_FE(imap_errors, NULL)
PHP_FE(imap_last_error, NULL)
-#if !(WIN32|WINNT)
+#ifndef PHP_WIN32
PHP_FE(imap_mail, NULL)
#endif
PHP_FE(imap_search, NULL)
ZEND_INIT_MODULE_GLOBALS(imap, php_imap_init_globals, NULL)
-#if !(WIN32|WINNT)
+#ifndef PHP_WIN32
mail_link(&unixdriver); /* link in the unix driver */
#endif
mail_link(&imapdriver); /* link in the imap driver */
mail_link(&nntpdriver); /* link in the nntp driver */
mail_link(&pop3driver); /* link in the pop3 driver */
-#if !(WIN32|WINNT)
+#ifndef PHP_WIN32
mail_link(&mhdriver); /* link in the mh driver */
mail_link(&mxdriver); /* link in the mx driver */
#endif
mail_link(&mbxdriver); /* link in the mbx driver */
mail_link(&tenexdriver); /* link in the tenex driver */
mail_link(&mtxdriver); /* link in the mtx driver */
-#if !(WIN32|WINNT)
+#ifndef PHP_WIN32
mail_link(&mmdfdriver); /* link in the mmdf driver */
mail_link(&newsdriver); /* link in the news driver */
mail_link(&philedriver); /* link in the phile driver */
}
/* }}} */
-#if !(WIN32|WINNT)
+#ifndef PHP_WIN32
int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath)
{
#ifdef PHP_WIN32
#define NEW_BOUNDARY_CHECK 1
#define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); return; }
+/* The longest property name we use in an uploaded file array */
+#define MAX_SIZE_OF_INDEX sizeof("[tmpname]")
+
static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files ELS_DC PLS_DC)
{
if (lbuf) {
efree(lbuf);
}
- lbuf = emalloc(s-name + MAX(MAX(sizeof("[name]"),sizeof("[size]")),sizeof("[type]")));
+ lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX);
state = 2;
loc2 = memchr(loc + 1, '\n', rem);
rem -= (loc2 - ptr) + 1;
}
}
php_register_variable(namebuf, fn, NULL ELS_CC PLS_CC);
+
+ /* Add $foo[tmp_name] */
+ sprintf(lbuf, "%s[tmp_name]", namebuf);
+ register_http_post_files_variable(lbuf, fn, http_post_files ELS_CC PLS_CC);
{
zval file_size;