26
26
#include <stddef.h>
27
27
#endif
28
28
29
+ #ifdef NETWARE
30
+ #ifdef NEW_LIBC /* Works fine for both Winsock and Berkeley sockets */
31
+ #include <netinet/in.h>
32
+ #else
33
+ #include <sys/socket.h>
34
+ #endif
35
+ #endif /* NETWARE */
36
+
29
37
#include "php.h"
30
38
#include "ext/standard/head.h"
31
39
#include "php_globals.h"
@@ -51,7 +59,7 @@ int php_apache_info_id;
51
59
php_apache_info_struct php_apache_info ;
52
60
#endif
53
61
54
- #ifdef PHP_WIN32
62
+ #if defined( PHP_WIN32 ) || defined( NETWARE )
55
63
#include "zend.h"
56
64
#include "ap_compat.h"
57
65
#else
@@ -101,7 +109,7 @@ static void php_apache_globals_ctor(php_apache_info_struct *apache_globals TSRML
101
109
static PHP_MINIT_FUNCTION (apache )
102
110
{
103
111
#ifdef ZTS
104
- ts_allocate_id (& php_apache_info_id , sizeof (php_apache_info_struct ), php_apache_globals_ctor , NULL );
112
+ ts_allocate_id (& php_apache_info_id , sizeof (php_apache_info_struct ), ( void ( * )( void * , void * * * )) php_apache_globals_ctor , NULL ); /* Type-casting done due to NetWare */
105
113
#else
106
114
php_apache_globals_ctor (& php_apache_info TSRMLS_CC );
107
115
#endif
@@ -133,6 +141,9 @@ zend_module_entry apache_module_entry = {
133
141
Terminate apache process after this request */
134
142
PHP_FUNCTION (apache_child_terminate )
135
143
{
144
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
145
+ EnterClib ();
146
+ #endif
136
147
#ifndef MULTITHREAD
137
148
if (AP (terminate_child )) {
138
149
ap_child_terminate ( ((request_rec * )SG (server_context )) );
@@ -142,6 +153,9 @@ PHP_FUNCTION(apache_child_terminate)
142
153
#else
143
154
php_error (E_WARNING , "apache_child_terminate() is not supported in this build" );
144
155
#endif
156
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
157
+ ExitClib ();
158
+ #endif
145
159
}
146
160
/* }}} */
147
161
@@ -153,6 +167,9 @@ PHP_FUNCTION(apache_note)
153
167
char * note_val ;
154
168
int arg_count = ARG_COUNT (ht );
155
169
170
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
171
+ EnterClib ();
172
+ #endif
156
173
if (arg_count < 1 || arg_count > 2 ||
157
174
zend_get_parameters_ex (arg_count , & arg_name , & arg_val ) == FAILURE ) {
158
175
WRONG_PARAM_COUNT ;
@@ -166,6 +183,9 @@ PHP_FUNCTION(apache_note)
166
183
table_set (((request_rec * )SG (server_context ))-> notes , (* arg_name )-> value .str .val , (* arg_val )-> value .str .val );
167
184
}
168
185
186
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
187
+ ExitClib ();
188
+ #endif
169
189
if (note_val ) {
170
190
RETURN_STRING (note_val , 1 );
171
191
} else {
@@ -180,7 +200,7 @@ PHP_MINFO_FUNCTION(apache)
180
200
{
181
201
module * modp = NULL ;
182
202
char output_buf [128 ];
183
- #if !defined(WIN32 ) && !defined(WINNT )
203
+ #if !defined(WIN32 ) && !defined(WINNT ) /* This seems to be working for NetWare */
184
204
char name [64 ];
185
205
char modulenames [1024 ];
186
206
char * p ;
@@ -192,6 +212,9 @@ PHP_MINFO_FUNCTION(apache)
192
212
extern gid_t group_id ;
193
213
extern int max_requests_per_child ;
194
214
215
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
216
+ EnterClib ();
217
+ #endif
195
218
serv = ((request_rec * ) SG (server_context ))-> server ;
196
219
197
220
@@ -201,6 +224,10 @@ PHP_MINFO_FUNCTION(apache)
201
224
php_info_print_table_row (1 , "Apache for Windows 95/NT" );
202
225
php_info_print_table_end ();
203
226
php_info_print_table_start ();
227
+ #elif defined(NETWARE )
228
+ php_info_print_table_row (1 , "Apache for NetWare" );
229
+ php_info_print_table_end ();
230
+ php_info_print_table_start ();
204
231
#else
205
232
php_info_print_table_row (2 , "APACHE_INCLUDE" , PHP_APACHE_INCLUDE );
206
233
php_info_print_table_row (2 , "APACHE_TARGET" , PHP_APACHE_TARGET );
@@ -216,15 +243,15 @@ PHP_MINFO_FUNCTION(apache)
216
243
php_info_print_table_row (2 , "Apache API Version" , output_buf );
217
244
sprintf (output_buf , "%s:%u" , serv -> server_hostname , serv -> port );
218
245
php_info_print_table_row (2 , "Hostname:Port" , output_buf );
219
- #if !defined(WIN32 ) && !defined(WINNT )
246
+ #if !defined(WIN32 ) && !defined(WINNT ) /* This seems to be working for NetWare */
220
247
sprintf (output_buf , "%s(%d)/%d" , user_name , (int )user_id , (int )group_id );
221
248
php_info_print_table_row (2 , "User/Group" , output_buf );
222
249
sprintf (output_buf , "Per Child: %d - Keep Alive: %s - Max Per Connection: %d" , max_requests_per_child , serv -> keep_alive ? "on" :"off" , serv -> keep_alive_max );
223
250
php_info_print_table_row (2 , "Max Requests" , output_buf );
224
251
#endif
225
252
sprintf (output_buf , "Connection: %d - Keep-Alive: %d" , serv -> timeout , serv -> keep_alive_timeout );
226
253
php_info_print_table_row (2 , "Timeouts" , output_buf );
227
- #if !defined(WIN32 ) && !defined(WINNT )
254
+ #if !defined(WIN32 ) && !defined(WINNT ) /* This seems to be working for NetWare */
228
255
php_info_print_table_row (2 , "Server Root" , server_root );
229
256
230
257
strcpy (modulenames , "" );
@@ -238,6 +265,7 @@ PHP_MINFO_FUNCTION(apache)
238
265
strcat (modulenames , ", " );
239
266
}
240
267
}
268
+ /* But here for NetWare, it seems to be showing all modules instead of just the loaded ones */
241
269
php_info_print_table_row (2 , "Loaded Modules" , modulenames );
242
270
#endif
243
271
@@ -292,6 +320,9 @@ PHP_MINFO_FUNCTION(apache)
292
320
}
293
321
php_info_print_table_end ();
294
322
}
323
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
324
+ ExitClib ();
325
+ #endif
295
326
}
296
327
/* }}} */
297
328
@@ -310,6 +341,9 @@ PHP_FUNCTION(virtual)
310
341
pval * * filename ;
311
342
request_rec * rr = NULL ;
312
343
344
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
345
+ EnterClib ();
346
+ #endif
313
347
if (ARG_COUNT (ht ) != 1 || zend_get_parameters_ex (1 , & filename ) == FAILURE ) {
314
348
WRONG_PARAM_COUNT ;
315
349
}
@@ -318,12 +352,18 @@ PHP_FUNCTION(virtual)
318
352
if (!(rr = sub_req_lookup_uri ((* filename )-> value .str .val , ((request_rec * ) SG (server_context ))))) {
319
353
php_error (E_WARNING , "Unable to include '%s' - URI lookup failed" , (* filename )-> value .str .val );
320
354
if (rr ) destroy_sub_req (rr );
355
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
356
+ ExitClib ();
357
+ #endif
321
358
RETURN_FALSE ;
322
359
}
323
360
324
361
if (rr -> status != 200 ) {
325
362
php_error (E_WARNING , "Unable to include '%s' - error finding URI" , (* filename )-> value .str .val );
326
363
if (rr ) destroy_sub_req (rr );
364
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
365
+ ExitClib ();
366
+ #endif
327
367
RETURN_FALSE ;
328
368
}
329
369
@@ -333,9 +373,15 @@ PHP_FUNCTION(virtual)
333
373
if (run_sub_req (rr )) {
334
374
php_error (E_WARNING , "Unable to include '%s' - request execution failed" , (* filename )-> value .str .val );
335
375
if (rr ) destroy_sub_req (rr );
376
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
377
+ ExitClib ();
378
+ #endif
336
379
RETURN_FALSE ;
337
380
} else {
338
381
if (rr ) destroy_sub_req (rr );
382
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
383
+ ExitClib ();
384
+ #endif
339
385
RETURN_TRUE ;
340
386
}
341
387
}
@@ -348,8 +394,14 @@ PHP_FUNCTION(getallheaders)
348
394
array_header * env_arr ;
349
395
table_entry * tenv ;
350
396
int i ;
351
-
397
+
398
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
399
+ EnterClib ();
400
+ #endif
352
401
if (array_init (return_value ) == FAILURE ) {
402
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
403
+ ExitClib ();
404
+ #endif
353
405
RETURN_FALSE ;
354
406
}
355
407
env_arr = table_elts (((request_rec * ) SG (server_context ))-> headers_in );
@@ -361,9 +413,15 @@ PHP_FUNCTION(getallheaders)
361
413
continue ;
362
414
}
363
415
if (add_assoc_string (return_value , tenv [i ].key , (tenv [i ].val == NULL ) ? "" : tenv [i ].val , 1 )== FAILURE ) {
416
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
417
+ ExitClib ();
418
+ #endif
364
419
RETURN_FALSE ;
365
420
}
366
421
}
422
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
423
+ ExitClib ();
424
+ #endif
367
425
}
368
426
/* }}} */
369
427
@@ -384,7 +442,13 @@ PHP_FUNCTION(apache_setenv)
384
442
else break ;
385
443
}
386
444
445
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
446
+ EnterClib ();
447
+ #endif
387
448
ap_table_setn (r -> subprocess_env , ap_pstrndup (r -> pool , var , var_len ), ap_pstrndup (r -> pool , val , val_len ));
449
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
450
+ ExitClib ();
451
+ #endif
388
452
RETURN_TRUE ;
389
453
}
390
454
/* }}} */
@@ -396,6 +460,9 @@ PHP_FUNCTION(apache_lookup_uri)
396
460
pval * * filename ;
397
461
request_rec * rr = NULL ;
398
462
463
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
464
+ EnterClib ();
465
+ #endif
399
466
if (ARG_COUNT (ht ) != 1 || zend_get_parameters_ex (1 , & filename ) == FAILURE ) {
400
467
WRONG_PARAM_COUNT ;
401
468
}
@@ -458,6 +525,9 @@ PHP_FUNCTION(apache_lookup_uri)
458
525
}
459
526
460
527
destroy_sub_req (rr );
528
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
529
+ ExitClib ();
530
+ #endif
461
531
}
462
532
/* }}} */
463
533
@@ -471,6 +541,9 @@ PHP_FUNCTION(apache_exec_uri)
471
541
request_rec * rr = NULL ;
472
542
TSRMLS_FETCH ();
473
543
544
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
545
+ EnterClib ();
546
+ #endif
474
547
if (ARG_COUNT (ht ) != 1 || zend_get_parameters_ex (1 , & filename ) == FAILURE ) {
475
548
WRONG_PARAM_COUNT ;
476
549
}
@@ -482,6 +555,9 @@ PHP_FUNCTION(apache_exec_uri)
482
555
}
483
556
RETVAL_LONG (ap_run_sub_req (rr ));
484
557
ap_destroy_sub_req (rr );
558
+ #if defined(NETWARE ) && defined(NETWARE_CLIB_BROKER )
559
+ ExitClib ();
560
+ #endif
485
561
}
486
562
#endif
487
563
0 commit comments