summaryrefslogtreecommitdiff
path: root/ext/xmlrpc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/xmlrpc')
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc.c38
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c13
2 files changed, 24 insertions, 27 deletions
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.c b/ext/xmlrpc/libxmlrpc/xmlrpc.c
index 7b27caee3e..d82f270b35 100644
--- a/ext/xmlrpc/libxmlrpc/xmlrpc.c
+++ b/ext/xmlrpc/libxmlrpc/xmlrpc.c
@@ -43,11 +43,6 @@ static const char rcsid[] = "#(@) $Id$";
* 9/1999 - 10/2000
* HISTORY
* $Log$
- * Revision 1.8.4.3 2007/09/18 19:49:53 iliaa
- *
- * Fixed bug #42189 (xmlrpc_set_type() crashes php on invalid datetime
- * values).
- *
* Revision 1.8.4.2 2007/06/07 09:07:36 tony2001
* MFH: php_localtime_r() checks
*
@@ -166,21 +161,11 @@ static const char rcsid[] = "#(@) $Id$";
* Begin Time Functions *
***********************/
-static time_t mkgmtime(struct tm *tm)
-{
- static const int mdays[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
-
- return ((((((tm->tm_year - 70) * 365) + mdays[tm->tm_mon] + tm->tm_mday-1 +
- (tm->tm_year-68-1+(tm->tm_mon>=2))/4) * 24) + tm->tm_hour) * 60 +
- tm->tm_min) * 60 + tm->tm_sec;
-}
-
static int date_from_ISO8601 (const char *text, time_t * value) {
struct tm tm;
int n;
int i;
- char buf[30];
-
+ char buf[18];
if (strchr (text, '-')) {
char *p = (char *) text, *p2 = buf;
@@ -188,9 +173,6 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
if (*p != '-') {
*p2 = *p;
p2++;
- if (p2-buf >= sizeof(buf)) {
- return -1;
- }
}
p++;
}
@@ -200,6 +182,10 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
tm.tm_isdst = -1;
+ if(strlen(text) < 17) {
+ return -1;
+ }
+
#define XMLRPC_IS_NUMBER(x) if (x < '0' || x > '9') return -1;
n = 1000;
@@ -252,7 +238,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
tm.tm_year -= 1900;
- *value = mkgmtime(&tm);
+ *value = mktime(&tm);
return 0;
@@ -260,14 +246,14 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
static int date_to_ISO8601 (time_t value, char *buf, int length) {
struct tm *tm, tmbuf;
- tm = php_gmtime_r(&value, &tmbuf);
+ tm = php_localtime_r(&value, &tmbuf);
if (!tm) {
return 0;
}
#if 0 /* TODO: soap seems to favor this method. xmlrpc the latter. */
return strftime (buf, length, "%Y-%m-%dT%H:%M:%SZ", tm);
#else
- return strftime(buf, length, "%Y%m%dT%H:%M:%SZ", tm);
+ return strftime(buf, length, "%Y%m%dT%H:%M:%S", tm);
#endif
}
@@ -1538,7 +1524,8 @@ void XMLRPC_SetValueDateTime(XMLRPC_VALUE value, time_t time) {
date_to_ISO8601(time, timeBuf, sizeof(timeBuf));
if(timeBuf[0]) {
- XMLRPC_SetValueDateTime_ISO8601 (value, timeBuf);
+ simplestring_clear(&value->str);
+ simplestring_add(&value->str, timeBuf);
}
}
}
@@ -1714,11 +1701,8 @@ void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s) {
if(value) {
time_t time_val = 0;
if(s) {
- value->type = xmlrpc_datetime;
date_from_ISO8601(s, &time_val);
- value->i = time_val;
- simplestring_clear(&value->str);
- simplestring_add(&value->str, s);
+ XMLRPC_SetValueDateTime(value, time_val);
}
}
}
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index 30031c5219..61895a970a 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -76,49 +76,59 @@
static int le_xmlrpc_server;
/* {{{ arginfo */
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_encode, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, encoding)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode_request, 0, 0, 2)
ZEND_ARG_INFO(0, xml)
ZEND_ARG_INFO(1, method)
ZEND_ARG_INFO(0, encoding)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_encode_request, 0, 0, 2)
ZEND_ARG_INFO(0, method)
ZEND_ARG_INFO(0, params)
ZEND_ARG_INFO(0, output_options)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_set_type, 0, 0, 2)
ZEND_ARG_INFO(1, value)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_is_fault, 0, 0, 1)
ZEND_ARG_INFO(0, arg)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_xmlrpc_server_create, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_destroy, 0, 0, 1)
ZEND_ARG_INFO(0, server)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_register_method, 0, 0, 3)
ZEND_ARG_INFO(0, server)
ZEND_ARG_INFO(0, method_name)
ZEND_ARG_INFO(0, function)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 0, 3)
ZEND_ARG_INFO(0, server)
ZEND_ARG_INFO(0, xml)
@@ -126,15 +136,18 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 0, 3)
ZEND_ARG_INFO(0, output_options)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 0, 1)
ZEND_ARG_INFO(0, xml)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_add_introspection_data, 0, 0, 2)
ZEND_ARG_INFO(0, server)
ZEND_ARG_INFO(0, desc)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_register_introspection_callback, 0, 0, 2)
ZEND_ARG_INFO(0, server)
ZEND_ARG_INFO(0, function)