summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnantha Kesari H Y <hyanantha@php.net>2002-10-24 09:59:31 +0000
committerAnantha Kesari H Y <hyanantha@php.net>2002-10-24 09:59:31 +0000
commit8bfd3ab7f2c46bf65c1ca5c15480411df1489707 (patch)
tree6f4126b40fa4c0f755249e6440e0545bfd503647
parent3ee3b69ce2aef4970d0744ffbeac0714c5ebb918 (diff)
downloadphp-git-8bfd3ab7f2c46bf65c1ca5c15480411df1489707.tar.gz
NetWare related changes/modifications.
-rw-r--r--ext/ftp/ftp.c31
-rw-r--r--ext/ftp/php_ftp.c14
-rw-r--r--ext/imap/php_imap.c4
-rw-r--r--ext/ldap/ldap.c19
-rw-r--r--ext/ldap/php_ldap.h2
-rw-r--r--ext/mysql/php_mysql.c24
-rw-r--r--ext/pcre/pcrelib/internal.h2
-rw-r--r--ext/pgsql/php_pgsql.h2
-rw-r--r--ext/session/mod_files.c18
-rw-r--r--ext/session/session.c16
-rw-r--r--ext/snmp/snmp.c14
11 files changed, 125 insertions, 21 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index dbabdf3c58..9a05991c32 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -33,6 +33,18 @@
#include <time.h>
#ifdef PHP_WIN32
#include <winsock.h>
+#elif defined(NETWARE)
+#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), atleast for now */
+#include <novsock2.h>
+#else
+#ifdef NEW_LIBC
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#else
+#include <sys/socket.h>
+#endif
+#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -56,11 +68,16 @@
#include "ext/standard/fsock.h"
/* define closesocket macro for portability */
-#ifndef PHP_WIN32
+#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
#undef closesocket
#define closesocket close
#endif
+/* Additional headers for NetWare */
+#if defined(NETWARE) && defined(NEW_LIBC) && !defined(USE_WINSOCK)
+#include <sys/select.h>
+#endif
+
/* sends an ftp command, returns true on success, false on error.
* it sends the string "cmd args\r\n" if args is non-null, or
* "cmd\r\n" if args is null
@@ -130,7 +147,7 @@ ftp_open(const char *host, short port, long timeout_sec)
size = sizeof(ftp->localaddr);
memset(&ftp->localaddr, 0, size);
- if (getsockname(ftp->fd, (struct sockaddr*) &ftp->localaddr, &size) == -1) {
+ if (getsockname(ftp->fd, (struct sockaddr*) &ftp->localaddr, (unsigned int*)&size) == -1) {
perror("getsockname");
goto bail;
}
@@ -946,7 +963,7 @@ my_send(ftpbuf_t *ftp, int s, void *buf, size_t len)
FD_SET(s, &write_set);
n = select(s + 1, NULL, &write_set, NULL, &tv);
if (n < 1) {
-#ifndef PHP_WIN32
+#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0)
errno = ETIMEDOUT;
#endif
@@ -981,7 +998,7 @@ my_recv(ftpbuf_t *ftp, int s, void *buf, size_t len)
FD_SET(s, &read_set);
n = select(s + 1, &read_set, NULL, NULL, &tv);
if (n < 1) {
-#ifndef PHP_WIN32
+#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0)
errno = ETIMEDOUT;
#endif
@@ -1008,14 +1025,14 @@ my_accept(ftpbuf_t *ftp, int s, struct sockaddr *addr, int *addrlen)
n = select(s + 1, &accept_set, NULL, NULL, &tv);
if (n < 1) {
-#ifndef PHP_WIN32
+#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0)
errno = ETIMEDOUT;
#endif
return -1;
}
- return accept(s, addr, addrlen);
+ return accept(s, addr, (unsigned int*)addrlen);
}
/* }}} */
@@ -1087,7 +1104,7 @@ ftp_getdata(ftpbuf_t *ftp)
goto bail;
}
- if (getsockname(fd, (struct sockaddr*) &addr, &size) == -1) {
+ if (getsockname(fd, (struct sockaddr*) &addr, (unsigned int*)&size) == -1) {
perror("getsockname");
goto bail;
}
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index 6dc6059bd3..2d3b1d8477 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -24,6 +24,16 @@
#include "php.h"
+#ifdef NETWARE
+#ifdef USE_WINSOCK
+#include <novsock2.h>
+#else
+#ifndef NEW_LIBC
+#include <sys/socket.h>
+#endif
+#endif
+#endif
+
#if HAVE_FTP
#include "ext/standard/info.h"
@@ -482,7 +492,7 @@ PHP_FUNCTION(ftp_get)
RETURN_FALSE;
}
-#ifdef PHP_WIN32
+#if defined(PHP_WIN32) || defined(NETWARE) /* On Windows and NetWare, the file should always be opened in binary mode */
if ((outfp = VCWD_FOPEN(local, "wb")) == NULL) {
#else
if ((outfp = VCWD_FOPEN(local, "w")) == NULL) {
@@ -557,7 +567,7 @@ PHP_FUNCTION(ftp_put)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode);
-#ifdef PHP_WIN32
+#if defined(PHP_WIN32) || defined(NETWARE) /* On Windows and NetWare, the file should always be opened in binary mode */
if ((infp = VCWD_FOPEN(local, "rb")) == NULL) {
#else
if ((infp = VCWD_FOPEN(local, "r")) == NULL) {
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 488b3bef1c..cb1f432eb1 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -421,7 +421,7 @@ PHP_MINIT_FUNCTION(imap)
ZEND_INIT_MODULE_GLOBALS(imap, php_imap_init_globals, NULL)
-#ifndef PHP_WIN32
+#if !defined(PHP_WIN32) && !defined(NETWARE)
mail_link(&unixdriver); /* link in the unix driver */
mail_link(&mhdriver); /* link in the mh driver */
/* mail_link(&mxdriver); */ /* According to c-client docs (internal.txt) this shouldn't be used. */
@@ -437,7 +437,7 @@ PHP_MINIT_FUNCTION(imap)
mail_link(&mtxdriver); /* link in the mtx driver */
mail_link(&dummydriver); /* link in the dummy driver */
-#ifndef PHP_WIN32
+#if !defined(PHP_WIN32) && !defined(NETWARE)
auth_link(&auth_log); /* link in the log authenticator */
auth_link(&auth_md5); /* link in the cram-md5 authenticator */
#ifdef HAVE_IMAP_SSL
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 5c0a422893..afa1cf0c11 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -29,6 +29,12 @@
#include "config.h"
#endif
+/* Additional headers for NetWare */
+#if defined(NETWARE) && (NEW_LIBC)
+#include <sys/select.h>
+#include <sys/timeval.h>
+#endif
+
#include "php.h"
#include "php_ini.h"
@@ -118,9 +124,11 @@ function_entry ldap_functions[] = {
PHP_FE(ldap_rename, NULL)
#endif
+#ifndef NETWARE /* The below function not supported on NetWare */
#if LDAP_API_VERSION > 2000
PHP_FE(ldap_start_tls, NULL)
#endif
+#endif /* NETWARE */
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
PHP_FE(ldap_set_rebind_proc, NULL)
@@ -492,7 +500,16 @@ PHP_FUNCTION(ldap_bind)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
+#ifndef NETWARE
if (ldap_bind_s(ld->link, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
+#else
+ /* The function ldap_bind_s has been deprecated on NetWare. If it is used on NetWare,
+ it gives the result, but will also result in the display of warning message
+ that gets displayed on the web browser.
+ ldap_simple_bind_s removes that warning.
+ */
+ if (ldap_simple_bind_s(ld->link, (const char *)ldap_bind_rdn, (const char *)ldap_bind_pw) != LDAP_SUCCESS) {
+#endif
php_error(E_WARNING, "LDAP: Unable to bind to server: %s", ldap_err2string(_get_lderrno(ld->link)));
RETURN_FALSE;
} else {
@@ -1992,6 +2009,7 @@ PHP_FUNCTION(ldap_rename)
/* }}} */
#endif
+#ifndef NETWARE /* The below function not supported on NetWare */
#if LDAP_API_VERSION > 2000
/* {{{ proto bool ldap_start_tls(resource link)
Start TLS */
@@ -2016,6 +2034,7 @@ PHP_FUNCTION(ldap_start_tls)
}
/* }}} */
#endif
+#endif /* NETWARE */
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
index 4fcbff9b27..e4b7f1e708 100644
--- a/ext/ldap/php_ldap.h
+++ b/ext/ldap/php_ldap.h
@@ -89,9 +89,11 @@ PHP_FUNCTION(ldap_parse_reference);
PHP_FUNCTION(ldap_rename);
#endif
+#ifndef NETWARE /* The below function not supported on NetWare */
#if LDAP_API_VERSION > 2000
PHP_FUNCTION(ldap_start_tls);
#endif
+#endif /* NETWARE */
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
PHP_FUNCTION(ldap_set_rebind_proc);
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index d67945ea2d..b19c015c62 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -37,6 +37,10 @@
#ifdef PHP_WIN32
#include <winsock.h>
#define signal(a, b) NULL
+#elif defined(NETWARE)
+/*#include <ws2nlm.h>*/
+#include <sys/socket.h>
+#define signal(a, b) NULL
#else
#include "build-defs.h"
#if HAVE_SIGNAL_H
@@ -124,10 +128,12 @@ function_entry mysql_functions[] = {
PHP_FE(mysql_pconnect, NULL)
PHP_FE(mysql_close, NULL)
PHP_FE(mysql_select_db, NULL)
+#ifndef NETWARE /* The below two functions not supported on NetWare */
#if MYSQL_VERSION_ID < 40000
PHP_FE(mysql_create_db, NULL)
PHP_FE(mysql_drop_db, NULL)
#endif
+#endif /* NETWARE */
PHP_FE(mysql_query, NULL)
PHP_FE(mysql_unbuffered_query, NULL)
PHP_FE(mysql_db_query, NULL)
@@ -173,10 +179,12 @@ function_entry mysql_functions[] = {
PHP_FALIAS(mysql_fieldtype, mysql_field_type, NULL)
PHP_FALIAS(mysql_fieldflags, mysql_field_flags, NULL)
PHP_FALIAS(mysql_selectdb, mysql_select_db, NULL)
+#ifndef NETWARE /* The below two functions not supported on NetWare */
#if MYSQL_VERSION_ID < 40000
PHP_FALIAS(mysql_createdb, mysql_create_db, NULL)
PHP_FALIAS(mysql_dropdb, mysql_drop_db, NULL)
#endif
+#endif /* NETWARE */
PHP_FALIAS(mysql_freeresult, mysql_free_result, NULL)
PHP_FALIAS(mysql_numfields, mysql_num_fields, NULL)
PHP_FALIAS(mysql_numrows, mysql_num_rows, NULL)
@@ -297,7 +305,7 @@ static void _close_mysql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
static PHP_INI_MH(OnMySQLPort)
{
if (new_value==NULL) { /* default port */
-#ifndef PHP_WIN32
+#if !defined (PHP_WIN32) && ! defined (NETWARE)
struct servent *serv_ptr;
char *env;
@@ -427,7 +435,7 @@ PHP_MINFO_FUNCTION(mysql)
sprintf(buf, "%ld", MySG(num_links));
php_info_print_table_row(2, "Active Links", buf);
php_info_print_table_row(2, "Client API version", mysql_get_client_info());
-#ifndef PHP_WIN32
+#if !defined (PHP_WIN32) && !defined (NETWARE)
php_info_print_table_row(2, "MYSQL_MODULE_TYPE", PHP_MYSQL_TYPE);
php_info_print_table_row(2, "MYSQL_SOCKET", MYSQL_UNIX_ADDR);
php_info_print_table_row(2, "MYSQL_INCLUDE", PHP_MYSQL_INCLUDE);
@@ -834,7 +842,7 @@ PHP_FUNCTION(mysql_get_client_info)
WRONG_PARAM_COUNT;
}
- RETURN_STRING(mysql_get_client_info(),1);
+ RETURN_STRING((char *)mysql_get_client_info(),1); /* Type-casting done due to NetWare */
}
/* }}} */
@@ -864,7 +872,7 @@ PHP_FUNCTION(mysql_get_host_info)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
- RETURN_STRING(mysql_get_host_info(&mysql->conn),1);
+ RETURN_STRING((char *)mysql_get_host_info(&mysql->conn),1); /* Type-casting done due to NetWare */
}
/* }}} */
@@ -924,12 +932,14 @@ PHP_FUNCTION(mysql_get_server_info)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
- RETURN_STRING(mysql_get_server_info(&mysql->conn),1);
+ RETURN_STRING((char *)mysql_get_server_info(&mysql->conn),1); /* Type-casting done due to NetWare */
}
/* }}} */
#endif
+#ifndef NETWARE /* The below two functions not supported on NetWare */
+
#if MYSQL_VERSION_ID < 40000
/* {{{ proto bool mysql_create_db(string database_name [, int link_identifier])
Create a MySQL database */
@@ -1009,6 +1019,8 @@ PHP_FUNCTION(mysql_drop_db)
/* }}} */
#endif
+#endif /* NETWARE */
+
/* {{{ php_mysql_do_query_general
*/
static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link_id, zval **db, int use_store, zval *return_value TSRMLS_DC)
@@ -1310,7 +1322,7 @@ PHP_FUNCTION(mysql_error)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
- RETURN_STRING(mysql_error(&mysql->conn), 1);
+ RETURN_STRING((char *)mysql_error(&mysql->conn), 1); /* Type-casting done due to NetWare */
}
/* }}} */
diff --git a/ext/pcre/pcrelib/internal.h b/ext/pcre/pcrelib/internal.h
index bd992f0dd2..600f4ea03c 100644
--- a/ext/pcre/pcrelib/internal.h
+++ b/ext/pcre/pcrelib/internal.h
@@ -39,6 +39,8 @@ modules, but which are not relevant to the outside. */
#ifdef PHP_WIN32
#include "config.w32.h"
+#elif defined(NETWARE)
+#include "config.nw.h"
#else
#include "php_config.h"
#endif
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index 03390696c5..f832a3f3ca 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -34,6 +34,8 @@ extern zend_module_entry pgsql_module_entry;
#ifdef PHP_WIN32
#define INV_WRITE 0x00020000
#define INV_READ 0x00040000
+#elif defined NETWARE
+#include <libpq-fs.h>
#else
#include <libpq/libpq-fs.h>
#endif
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 1e86d6d4f8..573526e147 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -156,7 +156,11 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
DIR *dir;
char dentry[sizeof(struct dirent) + MAXPATHLEN];
struct dirent *entry = (struct dirent *) &dentry;
+#if (defined(NETWARE) && defined(CLIB_STAT_PATCH))
+ struct stat_libc sbuf;
+#else
struct stat sbuf;
+#endif
char buf[MAXPATHLEN];
time_t now;
int nrdels = 0;
@@ -190,7 +194,11 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
buf[dirname_len + entry_len + 1] = '\0';
/* check whether its last access was more than maxlifet ago */
if (VCWD_STAT(buf, &sbuf) == 0 &&
- (now - sbuf.st_atime) > maxlifetime) {
+#if (defined(NETWARE) && defined(NEW_LIBC))
+ (now - sbuf.st_atime.tv_nsec) > maxlifetime) {
+#else
+ (now - sbuf.st_atime) > maxlifetime) {
+#endif
VCWD_UNLINK(buf);
nrdels++;
}
@@ -242,14 +250,22 @@ PS_CLOSE_FUNC(files)
PS_READ_FUNC(files)
{
long n;
+#if (defined(NETWARE) && defined(CLIB_STAT_PATCH))
+ struct stat_libc sbuf;
+#else
struct stat sbuf;
+#endif
PS_FILES_DATA;
ps_files_open(data, key TSRMLS_CC);
if (data->fd < 0)
return FAILURE;
+#if (defined(NETWARE) && defined(CLIB_STAT_PATCH))
+ if (fstat(data->fd, ((struct stat*)&sbuf)))
+#else
if (fstat(data->fd, &sbuf))
+#endif
return FAILURE;
data->st_size = *vallen = sbuf.st_size;
diff --git a/ext/session/session.c b/ext/session/session.c
index 9e0993dbf6..c8d5bf6b82 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -509,7 +509,8 @@ static char *_php_create_id(int *newlen TSRMLS_DC)
PHP_MD5Init(&context);
sprintf(buf, "%ld%ld%0.8f", tv.tv_sec, tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10);
- PHP_MD5Update(&context, buf, strlen(buf));
+ /*PHP_MD5Update(&context, buf, strlen(buf));*/
+ PHP_MD5Update(&context, (const unsigned char*)buf, strlen(buf));
if (PS(entropy_length) > 0) {
int fd;
@@ -523,7 +524,8 @@ static char *_php_create_id(int *newlen TSRMLS_DC)
while (to_read > 0) {
n = read(fd, buf, MIN(to_read, sizeof(buf)));
if (n <= 0) break;
- PHP_MD5Update(&context, buf, n);
+ /*PHP_MD5Update(&context, buf, n);*/
+ PHP_MD5Update(&context, (const unsigned char*)buf, n);
to_read -= n;
}
close(fd);
@@ -635,7 +637,11 @@ static void strcpy_gmt(char *ubuf, time_t *when)
static void last_modified(TSRMLS_D)
{
const char *path;
+#if (defined(NETWARE) && defined(CLIB_STAT_PATCH))
+ struct stat_libc sb;
+#else
struct stat sb;
+#endif
char buf[MAX_STR + 1];
path = SG(request_info).path_translated;
@@ -646,7 +652,11 @@ static void last_modified(TSRMLS_D)
#define LAST_MODIFIED "Last-Modified: "
memcpy(buf, LAST_MODIFIED, sizeof(LAST_MODIFIED) - 1);
- strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime);
+#if (defined(NETWARE) && defined(NEW_LIBC))
+ strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &(sb.st_mtime.tv_nsec));
+#else
+ strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime);
+#endif
ADD_COOKIE(buf);
}
}
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 2140c065b0..620407ca09 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -32,6 +32,20 @@
#include <errno.h>
#include <process.h>
#include "win32/time.h"
+#elif defined(NETWARE)
+#ifdef USE_WINSOCK
+/*#include <ws2nlm.h>*/
+#include <novsock2.h>
+#else
+#include <sys/socket.h>
+#endif
+#include <errno.h>
+/*#include <process.h>*/
+#ifdef NEW_LIBC
+#include <sys/timeval.h>
+#else
+#include "netware/time_nw.h"
+#endif
#else
#include <sys/socket.h>
#include <netinet/in.h>