Changeset ee3afa2 in rtems
- Timestamp:
- 04/11/03 14:46:55 (20 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 2e7f00fc
- Parents:
- 2f73363
- Files:
-
- 75 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/libnetworking/ChangeLog
r2f73363 ree3afa2 1 2002-04-10 Mike Siers <mikes@poliac.com> 2 3 * rtems_webserver/NOTES, rtems_webserver/asp.c, 4 rtems_webserver/balloc.c, rtems_webserver/default.c, 5 rtems_webserver/ej.h, rtems_webserver/ejIntrn.h, 6 rtems_webserver/ejlex.c, rtems_webserver/ejparse.c, 7 rtems_webserver/emfdb.c, rtems_webserver/emfdb.h, 8 rtems_webserver/form.c, rtems_webserver/h.c, 9 rtems_webserver/handler.c, rtems_webserver/license.txt, 10 rtems_webserver/md5.h, rtems_webserver/md5c.c, 11 rtems_webserver/mime.c, rtems_webserver/misc.c, 12 rtems_webserver/ringq.c, rtems_webserver/rom.c, 13 rtems_webserver/security.c, rtems_webserver/sock.c, 14 rtems_webserver/sym.c, rtems_webserver/uemf.c, 15 rtems_webserver/uemf.h, rtems_webserver/um.c, rtems_webserver/um.h, 16 rtems_webserver/url.c, rtems_webserver/value.c, 17 rtems_webserver/wbase64.c, rtems_webserver/webcomp.c, 18 rtems_webserver/webpage.c, rtems_webserver/webrom.c, 19 rtems_webserver/webs.c, rtems_webserver/webs.h, 20 rtems_webserver/websuemf.c, rtems_webserver/wsIntrn.h: 21 Update to GoAhead Webserver 2.1.4. The following URL is 22 the release notes from GoAhead. 23 24 http://data.goahead.com/Software/Webserver/2.1.4/release.htm 25 26 I have only done a minimal amount of testing (i.e. the network 27 demo program works fine). Please try this out and let me know 28 if it works. The patch needs to be applied on the 29 c/src/libnetworking/rtems_webserver directory. 30 1 31 2003-04-10 Joel Sherrill <joel@OARcorp.com> 2 32 -
c/src/libnetworking/rtems_webserver/NOTES
r2f73363 ree3afa2 3 3 # 4 4 5 Notes on merging GoAhead Webs 2.1. Eventually RTEMS should be supported5 Notes on merging GoAhead Webs 2.1.4. Eventually RTEMS should be supported 6 6 in their distributions and this directory removed. 7 7 … … 10 10 Obtain the original distribution from http://www.goahead.com for 11 11 documentation. 12 13 Porting 14 ======= 15 - added rtems complier flags to uemf.h and misc.c 16 - following source files are distributed with the web server 17 but not currently used by RTEMS 18 [cgi.c, sockGen.c, umui.c, websSSL.c, websda.c] 12 19 13 20 Tailoring -
c/src/libnetworking/rtems_webserver/asp.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 -
c/src/libnetworking/rtems_webserver/balloc.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 27 29 #define IN_BALLOC 28 30 29 #if UEMF31 #ifdef UEMF 30 32 #include "uemf.h" 31 33 #else … … 36 38 #include <stdlib.h> 37 39 38 #if !NO_BALLOC40 #ifndef NO_BALLOC 39 41 /********************************* Defines ************************************/ 40 42 … … 42 44 * Define B_STATS if you wish to track memory block and stack usage 43 45 */ 44 #if B_STATS46 #ifdef B_STATS 45 47 /* 46 48 * Optional statistics … … 108 110 /*************************** Forward Declarations *****************************/ 109 111 110 #if B_STATS112 #ifdef B_STATS 111 113 static void bStatsAlloc(B_ARGS_DEC, void *ptr, int q, int size); 112 114 static void bStatsFree(B_ARGS_DEC, void *ptr, int q, int size); … … 115 117 #endif /* B_STATS */ 116 118 117 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD119 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 118 120 static void bFillBlock(void *buf, int bufsize); 119 121 #endif 120 122 121 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD123 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 122 124 static void verifyUsedBlock(bType *bp, int q); 123 125 static void verifyFreeBlock(bType *bp, int q); … … 142 144 bFlags = flags; 143 145 144 #if BASTARD_TESTING146 #ifdef BASTARD_TESTING 145 147 srand(time(0L)); 146 148 #endif /* BASTARD_TESTING */ … … 164 166 return -1; 165 167 } 166 #if B_STATS168 #ifdef B_STATS 167 169 bStatsMemMalloc += bufsize; 168 170 #endif … … 174 176 bFreeBuf = bFreeNext = buf; 175 177 memset(bQhead, 0, sizeof(bQhead)); 176 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD178 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 177 179 bFillBlock(buf, bufsize); 178 180 #endif 179 #if B_STATS181 #ifdef B_STATS 180 182 bStackStart = &buf; 181 183 #endif 182 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD184 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 183 185 verifyFreeBlock(buf, bufsize); 184 186 #endif … … 193 195 void bclose() 194 196 { 195 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD197 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 196 198 verifyBallocSpace(); 197 199 #endif … … 221 223 } 222 224 } 223 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD225 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 224 226 verifyBallocSpace(); 225 227 #endif … … 228 230 } 229 231 230 #if BASTARD_TESTING232 #ifdef BASTARD_TESTING 231 233 if (rand() == 0x7fff) { 232 234 return NULL; … … 242 244 */ 243 245 if (bFlags & B_USE_MALLOC) { 244 #if B_STATS246 #ifdef B_STATS 245 247 bstats(0, NULL); 246 248 #endif … … 253 255 return NULL; 254 256 } 255 #if B_STATS257 #ifdef B_STATS 256 258 bStatsMemMalloc += memSize; 257 259 #endif 258 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD260 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 259 261 bFillBlock(bp, memSize); 260 262 #endif … … 276 278 */ 277 279 bQhead[q] = bp->u.next; 278 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD280 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 279 281 verifyFreeBlock(bp, q); 280 282 #endif 281 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD283 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 282 284 bFillBlock(bp, memSize); 283 285 #endif … … 292 294 */ 293 295 bp = (bType*) bFreeNext; 294 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD296 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 295 297 verifyFreeBlock(bp, q); 296 298 #endif 297 299 bFreeNext += memSize; 298 300 bFreeLeft -= memSize; 299 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD301 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 300 302 bFillBlock(bp, memSize); 301 303 #endif … … 304 306 305 307 } else if (bFlags & B_USE_MALLOC) { 306 #if B_STATS308 #ifdef B_STATS 307 309 static int once = 0; 308 310 if (once++ == 0) { … … 320 322 return NULL; 321 323 } 322 #if B_STATS324 #ifdef B_STATS 323 325 bStatsMemMalloc += memSize; 324 326 #endif 325 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD327 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 326 328 bFillBlock(bp, memSize); 327 329 #endif … … 335 337 } 336 338 337 #if B_STATS339 #ifdef B_STATS 338 340 bStatsAlloc(B_ARGS, bp, q, memSize); 339 341 #endif … … 345 347 */ 346 348 #if 0 347 #if B_STATS349 #ifdef B_STATS 348 350 if (bStatsBallocInUse == bStatsBallocMax) { 349 351 bstats(0, NULL); … … 366 368 int q, memSize; 367 369 368 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD370 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 369 371 verifyBallocSpace(); 370 372 #endif … … 379 381 memSize = ballocGetSize(bp->u.size, &q); 380 382 381 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD383 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 382 384 verifyUsedBlock(bp,q); 383 385 #endif 384 #if B_STATS386 #ifdef B_STATS 385 387 bStatsFree(B_ARGS, bp, q, bp->u.size+sizeof(bType)); 386 388 #endif … … 390 392 } 391 393 392 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD394 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 393 395 bFillBlock(bp, memSize); 394 396 #endif … … 416 418 417 419 /******************************************************************************/ 418 #if UNICODE420 #ifdef UNICODE 419 421 /* 420 422 * Duplicate a string, allow NULL pointers and then dup an empty string. … … 511 513 512 514 /******************************************************************************/ 513 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD515 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 514 516 /* 515 517 * Fill the block (useful during development to catch zero fill assumptions) … … 523 525 524 526 /******************************************************************************/ 525 #if B_STATS527 #ifdef B_STATS 526 528 /* 527 529 * Statistics. Do output via calling the writefn callback function with … … 817 819 818 820 /******************************************************************************/ 819 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD821 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 820 822 /* 821 823 * The following routines verify the integrity of the balloc memory space. … … 937 939 char_t *bstrdupNoBalloc(char_t *s) 938 940 { 939 #if UNICODE941 #ifdef UNICODE 940 942 if (s) { 941 943 return wcsdup(s); -
c/src/libnetworking/rtems_webserver/default.c
r2f73363 ree3afa2 85 85 * Open the document. Stat for later use. 86 86 */ 87 if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, 88 0666) < 0) { 89 websError(wp, 400, 90 T("Cannot open URL <b>%s</b>"), url); 91 return 1; 92 } 93 if (websPageStat(wp, lpath, path, &sbuf) < 0) { 94 websError(wp, 400, T("Cannot stat page for URL <b>%s</b>"), 95 url); 96 return 1; 97 } 87 if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, 88 0666) < 0) { 89 websError(wp, 400, T("Cannot open URL <b>%s</b>"), url); 90 return 1; 91 } 92 93 if (websPageStat(wp, lpath, path, &sbuf) < 0) { 94 websError(wp, 400, T("Cannot stat page for URL <b>%s</b>"), url); 95 return 1; 96 } 98 97 99 98 /* … … 103 102 */ 104 103 websStats.localHits++; 105 #if WEBS_IF_MODIFIED_SUPPORT104 #ifdef WEBS_IF_MODIFIED_SUPPORT 106 105 if (flags & WEBS_IF_MODIFIED && !(flags & WEBS_ASP)) { 107 106 if (sbuf.mtime <= wp->since) { … … 228 227 len = npart = 0; 229 228 parts[0] = NULL; 229 230 /* 231 * 22 Jul 02 -- there were reports that a directory traversal exploit was 232 * possible in the WebServer running under Windows if directory paths 233 * outside the server's specified root web were given by URL-encoding the 234 * backslash character, like: 235 * 236 * GoAhead is vulnerable to a directory traversal bug. A request such as 237 * 238 * GoAhead-server/../../../../../../../ results in an error message 239 * 'Cannot open URL'. 240 241 * However, by encoding the '/' character, it is possible to break out of 242 * the 243 * web root and read arbitrary files from the server. 244 * Hence a request like: 245 * 246 * GoAhead-server/..%5C..%5C..%5C..%5C..%5C..%5C/winnt/win.ini returns the 247 * contents of the win.ini file. 248 * (Note that the description uses forward slashes (0x2F), but the example 249 * uses backslashes (0x5C). In my tests, forward slashes are correctly 250 * trapped, but backslashes are not. The code below substitutes forward 251 * slashes for backslashes before attempting to validate that there are no 252 * unauthorized paths being accessed. 253 */ 254 token = gstrchr(path, '\\'); 255 while (token != NULL) 256 { 257 *token = '/'; 258 token = gstrchr(token, '\\'); 259 } 260 230 261 token = gstrtok(path, T("/")); 231 262 … … 285 316 flags = websGetRequestFlags(wp); 286 317 287 webs MarkTime(wp);318 websSetTimeMark(wp); 288 319 289 320 wrote = bytes = 0; … … 301 332 if ((buf = balloc(B_L, PAGE_READ_BUFSIZE)) == NULL) { 302 333 websError(wp, 200, T("Can't get memory")); 303 } 304 else { 334 } else { 305 335 while ((len = websPageReadData(wp, buf, PAGE_READ_BUFSIZE)) > 0) { 306 336 if ((wrote = websWriteDataNonBlock(wp, buf, len)) < 0) { -
c/src/libnetworking/rtems_webserver/ej.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for information on usage and redistribution 7 * 8 * $Id$ 7 9 */ 8 10 … … 19 21 /********************************* Includes ***********************************/ 20 22 21 #if !UEMF23 #ifndef UEMF 22 24 #include "basic/basic.h" 23 25 #include "emf/emf.h" -
c/src/libnetworking/rtems_webserver/ejIntrn.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for information on usage and redistribution 7 * 8 * $Id$ 7 9 */ 8 10 … … 23 25 #include <stdlib.h> 24 26 25 #if CE26 #if !UEMF27 #ifdef CE 28 #ifndef UEMF 27 29 #include <io.h> 28 30 #endif 29 31 #endif 30 32 31 #if LYNX33 #ifdef LYNX 32 34 #include <unistd.h> 33 35 #endif … … 37 39 #endif 38 40 39 #if UEMF41 #ifdef UEMF 40 42 #include "uemf.h" 41 43 #else -
c/src/libnetworking/rtems_webserver/ejlex.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 18 20 #include "ejIntrn.h" 19 21 20 #if UEMF22 #ifdef UEMF 21 23 #include "uemf.h" 22 24 #else … … 195 197 { 196 198 ep->tid = getLexicalToken(ep, state); 199 /* 200 * commented out 04 Apr 02 Bg Porter -- we found a case where very long 201 * arguments to write() were being corrupted downstream in the trace call 202 * (the ep->token pointer was being overwritten with the trace message. 203 * restore this if it's useful for your debugging. 197 204 trace(9, T("ejGetToken: %d, \"%s\"\n"), ep->tid, ep->token); 205 */ 198 206 return ep->tid; 199 207 } -
c/src/libnetworking/rtems_webserver/ejparse.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 18 20 #include "ejIntrn.h" 19 21 20 #if CE22 #ifdef CE 21 23 #include "CE/wincompat.h" 22 24 #endif … … 99 101 ejSetGlobalVar(ep->eid, T("null"), NULL); 100 102 101 #if EMF103 #ifdef EMF 102 104 ejEmfOpen(ep->eid); 103 105 #endif … … 119 121 } 120 122 121 #if EMF123 #ifdef EMF 122 124 ejEmfClose(eid); 123 125 #endif -
c/src/libnetworking/rtems_webserver/emfdb.c
r2f73363 ree3afa2 663 663 if (pLineOut) { 664 664 len = gstrlen(pLineOut); 665 #if CE665 #ifdef CE 666 666 rc = writeUniToAsc(fd, pLineOut, len); 667 667 #else … … 854 854 */ 855 855 buf = balloc(B_L, sbuf.st_size + 1); 856 #if CE856 #ifdef CE 857 857 if (readAscToUni(fd, &buf, sbuf.st_size) != (int)sbuf.st_size) { 858 858 #else … … 1020 1020 int len; 1021 1021 1022 if (basicProdDir != NULL) { 1023 1022 if (basicProdDir != NULL) { 1023 bfree(B_L, basicProdDir); 1024 1024 } 1025 1025 -
c/src/libnetworking/rtems_webserver/emfdb.h
r2f73363 ree3afa2 19 19 #define _h_EMFDB 1 20 20 21 #if !UEMF21 #ifndef UEMF 22 22 #include "basic/basic.h" 23 23 #include "emf/emf.h" -
c/src/libnetworking/rtems_webserver/form.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 -
c/src/libnetworking/rtems_webserver/h.c
r2f73363 ree3afa2 4 4 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. 5 5 * See the file "license.txt" for usage and redistribution license requirements 6 * 7 * $Id$ 6 8 */ 7 9 … … 16 18 /********************************* Includes ***********************************/ 17 19 18 #if UEMF20 #ifdef UEMF 19 21 #include "uemf.h" 20 22 #else … … 42 44 */ 43 45 44 #if B_STATS46 #ifdef B_STATS 45 47 int HALLOC(B_ARGS_DEC, void ***map) 46 48 #else … … 56 58 incr = H_INCR; 57 59 memsize = (incr + H_OFFSET) * sizeof(void**); 58 #if B_STATS60 #ifdef B_STATS 59 61 if ((mp = (int*) balloc(B_ARGS, memsize)) == NULL) { 60 62 #else … … 149 151 */ 150 152 151 #if B_STATS153 #ifdef B_STATS 152 154 int HALLOCENTRY(B_ARGS_DEC, void ***list, int *max, int size) 153 155 #else … … 161 163 a_assert(max); 162 164 163 #if B_STATS165 #ifdef B_STATS 164 166 if ((id = HALLOC(B_ARGS, (void***) list)) < 0) { 165 167 #else … … 170 172 171 173 if (size > 0) { 172 #if B_STATS174 #ifdef B_STATS 173 175 if ((cp = balloc(B_ARGS, size)) == NULL) { 174 176 #else -
c/src/libnetworking/rtems_webserver/handler.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 26 28 /**************************** Forward Declarations ****************************/ 27 29 28 static int websUrlHandlerSort(const void *p1, const void *p2);29 static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,30 static int websUrlHandlerSort(const void *p1, const void *p2); 31 static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, 30 32 int sid, char_t *url, char_t *path, char_t *query); 31 static int websTidyUrl(webs_t wp);33 static char_t *websCondenseMultipleChars(char_t *strToCondense, char_t cCondense); 32 34 33 35 /*********************************** Code *************************************/ … … 257 259 websSetRequestPath(wp, websGetDefaultDir(), NULL); 258 260 259 websTidyUrl(wp); 261 /* 262 * Eliminate security hole 263 */ 264 websCondenseMultipleChars(wp->path, '/'); 265 websCondenseMultipleChars(wp->url, '/'); 260 266 261 267 /* … … 293 299 } 294 300 301 #ifdef OBSOLETE_CODE 295 302 296 303 /******************************************************************************/ … … 359 366 } 360 367 361 /******************************************************************************/ 368 #endif 369 370 /******************************************************************************/ 371 /* 372 * Convert multiple adjacent occurrences of a given character to a single 373 * instance. 374 */ 375 376 static char_t *websCondenseMultipleChars(char_t *strToCondense, char_t cCondense) 377 { 378 if (strToCondense != NULL) { 379 char_t *pStr, *pScan; 380 381 pStr = pScan = strToCondense; 382 383 while (*pScan && *pStr) { 384 /* 385 * Advance scan pointer over multiple occurences of condense character 386 */ 387 while ((*pScan == cCondense) && (*(pScan + 1) == cCondense)) { 388 pScan++; 389 } 390 /* 391 * Copy character if an advance of the scan pointer has occurred 392 */ 393 if (pStr != pScan) { 394 *pStr = *pScan; 395 } 396 397 pScan++; 398 pStr++; 399 } 400 /* 401 * Zero terminate string if multiple adjacent characters were found and condensed 402 */ 403 if (pStr != pScan) { 404 *pStr = 0; 405 } 406 } 407 408 return strToCondense; 409 } 410 411 /******************************************************************************/ -
c/src/libnetworking/rtems_webserver/license.txt
r2f73363 ree3afa2 1 1 License Agreement 2 2 3 THIS LICENSE ALLOWS ONLY THE LIMITED USE OF GO AHEAD SOFTWARE, INC. PROPRIETARY CODE. PLEASE CAREFULLY READ THIS AGREEMENT AS IT PERTAINS TO THIS LICENSE, YOU CERTIFY THAT YOU WILL USE THE SOFTWARE ONLY IN THE MANNER PERMITTED HEREIN. 3 THIS LICENSE ALLOWS ONLY THE LIMITED USE OF GO AHEAD SOFTWARE, 4 INC. PROPRIETARY CODE. PLEASE CAREFULLY READ THIS AGREEMENT AS IT 5 PERTAINS TO THIS LICENSE, YOU CERTIFY THAT YOU WILL USE THE SOFTWARE 6 ONLY IN THE MANNER PERMITTED HEREIN. 4 7 5 8 1. Definitions. 6 9 7 1.1 "Documentation" means any documentation GoAhead includes with the Original Code. 10 1.1 "Documentation" means any documentation GoAhead includes with the 11 Original Code. 8 12 9 13 1.2 "GoAhead" means Go Ahead Software, Inc. 10 14 11 1.3 "Intellectual Property Rights" means all rights, whether now existing or hereinafter acquired, in and to trade secrets, patents, copyrights, trademarks, know-how, as well as moral rights and similar rights of any type under the laws of any governmental authority, domestic or foreign, including rights in and to all applications and registrations relating to any of the foregoing. 15 1.3 "Intellectual Property Rights" means all rights, whether now existing 16 or hereinafter acquired, in and to trade secrets, patents, copyrights, 17 trademarks, know-how, as well as moral rights and similar rights of any 18 type under the laws of any governmental authority, domestic or foreign, 19 including rights in and to all applications and registrations relating 20 to any of the foregoing. 12 21 13 22 1.4 "License" or "Agreement" means this document. 14 23 15 1.5 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. 16 17 1.6 "Original Code" means the Source Code to GoAheads proprietary computer software entitled GoAhead WebServer. 18 19 1.7 "Response Header" means the first portion of the response message output by the GoAhead WebServer, containing but not limited to, header fields for date, content-type, server identification and cache control. 20 21 1.8 "Server Identification Field" means the field in the Response Header which contains the text "Server: GoAhead-Webs". 22 23 1.9 "You" means an individual or a legal entity exercising rights under, and complying with all of the terms of, this license or a future version of this license. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity. 24 1.5 "Modifications" means any addition to or deletion from the substance 25 or structure of either the Original Code or any previous Modifications. 26 27 1.6 "Original Code" means the Source Code to GoAheads proprietary 28 computer software entitled GoAhead WebServer. 29 30 1.7 "Response Header" means the first portion of the response message 31 output by the GoAhead WebServer, containing but not limited to, header 32 fields for date, content-type, server identification and cache control. 33 34 1.8 "Server Identification Field" means the field in the Response Header 35 which contains the text "Server: GoAhead-Webs". 36 37 1.9 "You" means an individual or a legal entity exercising rights under, 38 and complying with all of the terms of, this license or a future version 39 of this license. For legal entities, "You" includes any entity which 40 controls, is controlled by, or is under common control with You. For 41 purposes of this definition, "control" means (a) the power, direct or 42 indirect, to cause the direction or management of such entity, whether 43 by contract or otherwise, or (b) ownership of fifty percent (50%) or 44 more of the outstanding shares or beneficial ownership of such entity. 24 45 25 46 2. Source Code License. … … 27 48 2.1 Limited Source Code Grant. 28 49 29 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims, to use, reproduce, modify, copy and distribute the Original Code. 50 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive 51 license, subject to third party intellectual property claims, to use, 52 reproduce, modify, copy and distribute the Original Code. 30 53 31 54 2.2 Binary Code. 32 55 33 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive license to copy and distribute the binary code versions of the Original Code together with Your Modifications. 56 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive 57 license to copy and distribute the binary code versions of the Original 58 Code together with Your Modifications. 34 59 35 60 2.3 License Back to GoAhead. 36 61 37 You hereby grant in both source code and binary code to GoAhead a world-wide, royalty-free, non-exclusive license to copy, modify, display, use and sublicense any Modifications You make that are distributed or planned for distribution. Within 30 days of either such event, You agree to ship to GoAhead a file containing the Modifications (in a media to be determined by the parties), including any programmers notes and other programmers materials. Additionally, You will provide to GoAhead a complete description of the product, the product code or model number, the date on which the product is initially shipped, and a contact name, phone number and e-mail address for future correspondence. GoAhead will keep confidential all data specifically marked as such. 62 You hereby grant in both source code and binary code to GoAhead a 63 world-wide, royalty-free, non-exclusive license to copy, modify, display, 64 use and sublicense any Modifications You make that are distributed or 65 planned for distribution. Within 30 days of either such event, You 66 agree to ship to GoAhead a file containing the Modifications (in a media 67 to be determined by the parties), including any programmers notes and 68 other programmers materials. Additionally, You will provide to GoAhead 69 a complete description of the product, the product code or model number, 70 the date on which the product is initially shipped, and a contact name, 71 phone number and e-mail address for future correspondence. GoAhead will 72 keep confidential all data specifically marked as such. 38 73 39 74 2.4 Restrictions on Use. 40 75 41 You may sublicense Modifications to third parties such as subcontractors or OEM's provided that You enter into license agreements with such third parties that bind such third parties to all the obligations under this Agreement applicable to you and that are otherwise substantially similar in scope and application to this Agreement. 76 You may sublicense Modifications to third parties such as subcontractors 77 or OEM's provided that You enter into license agreements with such third 78 parties that bind such third parties to all the obligations under this 79 Agreement applicable to you and that are otherwise substantially similar 80 in scope and application to this Agreement. 42 81 43 82 3. Term. 44 83 45 This Agreement and license are effective from the time You accept the terms of this Agreement until this Agreement is terminated. You may terminate this Agreement at any time by uninstalling or destroying all copies of the Original Code including any and all binary versions and removing any Modifications to the Original Code existing in any products. This Agreement will terminate immediately and without further notice if You fail to comply with any provision of this Agreement. All restrictions on use, and all other provisions that may reasonably be interpreted to survive termination of this Agreement, will survive termination of this Agreement for any reason. Upon termination, You agree to uninstall or destroy all copies of the Original Code, Modifications, and Documentation. 84 This Agreement and license are effective from the time You accept the 85 terms of this Agreement until this Agreement is terminated. You may 86 terminate this Agreement at any time by uninstalling or destroying 87 all copies of the Original Code including any and all binary versions 88 and removing any Modifications to the Original Code existing in any 89 products. This Agreement will terminate immediately and without further 90 notice if You fail to comply with any provision of this Agreement. All 91 restrictions on use, and all other provisions that may reasonably 92 be interpreted to survive termination of this Agreement, will survive 93 termination of this Agreement for any reason. Upon termination, You agree 94 to uninstall or destroy all copies of the Original Code, Modifications, 95 and Documentation. 46 96 47 97 4. Trademarks and Brand. … … 49 99 4.1 License and Use. 50 100 51 GoAhead hereby grants to You a limited world-wide, royalty-free, non-exclusive license to use the GoAhead trade names, trademarks, logos, service marks and product designations posted in Exhibit A (collectively, the "GoAhead Marks") in connection with the activities by You under this Agreement. Additionally, GoAhead grants You a license under the terms above to such GoAhead trademarks as shall be identified at a URL (the "URL") provided by GoAhead. The use by You of GoAhead Marks shall be in accordance with GoAheads trademark policies regarding trademark usage as established at the web site designated by the URL, or as otherwise communicated to You by GoAhead at its sole discretion. You understand and agree that any use of GoAhead Marks in connection with this Agreement shall not create any right, title or interest in or to such GoAhead Marks and that all such use and goodwill associated with GoAhead Marks will inure to the benefit of GoAhead. 101 GoAhead hereby grants to You a limited world-wide, royalty-free, 102 non-exclusive license to use the GoAhead trade names, trademarks, logos, 103 service marks and product designations posted in Exhibit A (collectively, 104 the "GoAhead Marks") in connection with the activities by You under this 105 Agreement. Additionally, GoAhead grants You a license under the terms 106 above to such GoAhead trademarks as shall be identified at a URL (the 107 "URL") provided by GoAhead. The use by You of GoAhead Marks shall be in 108 accordance with GoAheads trademark policies regarding trademark usage 109 as established at the web site designated by the URL, or as otherwise 110 communicated to You by GoAhead at its sole discretion. You understand and 111 agree that any use of GoAhead Marks in connection with this Agreement 112 shall not create any right, title or interest in or to such GoAhead 113 Marks and that all such use and goodwill associated with GoAhead Marks 114 will inure to the benefit of GoAhead. 52 115 53 116 4.2 Promotion by You of GoAhead WebServer Mark. 54 117 55 In consideration for the licenses granted by GoAhead to You herein, You agree to notify GoAhead when You incorporate the GoAhead WebServer in Your product and to inform GoAhead when such product begins to ship. You agree to promote the Original Code by prominently and visibly displaying a graphic of the GoAhead WebServer mark on the initial web page of Your product that is displayed each time a user connects to it. You also agree that GoAhead may identify your company as a user of the GoAhead WebServer in conjunction with its own marketing efforts. You may further promote the Original Code by displaying the GoAhead WebServer mark in marketing and promotional materials such as the home page of your web site or web pages promoting the product. 118 In consideration for the licenses granted by GoAhead to You herein, You 119 agree to notify GoAhead when You incorporate the GoAhead WebServer in 120 Your product and to inform GoAhead when such product begins to ship. You 121 agree to promote the Original Code by prominently and visibly displaying 122 a graphic of the GoAhead WebServer mark on the initial web page of Your 123 product that is displayed each time a user connects to it. You also agree 124 that GoAhead may identify your company as a user of the GoAhead WebServer 125 in conjunction with its own marketing efforts. You may further promote 126 the Original Code by displaying the GoAhead WebServer mark in marketing 127 and promotional materials such as the home page of your web site or web 128 pages promoting the product. 56 129 57 130 4.3 Placement of Copyright Notice by You. 58 131 59 You agree to include copies of the following notice (the "Notice") regarding proprietary rights in all copies of the products that You distribute, as follows: (i) embedded in the object code; and (ii) on the title pages of all documentation. Furthermore, You agree to use commercially reasonable efforts to cause any licensees of your products to embed the Notice in object code and on the title pages or relevant documentation. The Notice is as follows: Copyright (c) 20xx GoAhead Software, Inc. All Rights Reserved. Unless GoAhead otherwise instructs, the year 20xx is to be replaced with the year during which the release of the Original Code containing the notice is issued by GoAhead. If this year is not supplied with Documentation, GoAhead will supply it upon request. 132 You agree to include copies of the following notice (the "Notice") 133 regarding proprietary rights in all copies of the products that You 134 distribute, as follows: (i) embedded in the object code; and (ii) on 135 the title pages of all documentation. Furthermore, You agree to use 136 commercially reasonable efforts to cause any licensees of your products 137 to embed the Notice in object code and on the title pages or relevant 138 documentation. The Notice is as follows: Copyright (c) 20xx GoAhead 139 Software, Inc. All Rights Reserved. Unless GoAhead otherwise instructs, 140 the year 20xx is to be replaced with the year during which the release of 141 the Original Code containing the notice is issued by GoAhead. If this year 142 is not supplied with Documentation, GoAhead will supply it upon request. 60 143 61 144 4.4 No Modifications to Server Identification Field. 62 145 63 You agree not to remove or modify the Server identification Field contained in the Response Header as defined in Section 1.6 and 1.7. 146 You agree not to remove or modify the Server identification Field 147 contained in the Response Header as defined in Section 1.6 and 1.7. 64 148 65 149 5. Warranty Disclaimers. 66 150 67 THE ORIGINAL CODE, THE DOCUMENTATION AND THE MEDIA UPON WHICH THE ORIGINAL CODE IS RECORDED (IF ANY) ARE PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS, STATUTORY OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 68 69 The entire risk as to the quality and performance of the Original Code (including any Modifications You make) and the Documentation is with You. Should the Original Code or the Documentation prove defective, You (and not GoAhead or its distributors, licensors or dealers) assume the entire cost of all necessary servicing or repair. GoAhead does not warrant that the functions contained in the Original Code will meet your requirements or operate in the combination that You may select for use, that the operation of the Original Code will be uninterrupted or error free, or that defects in the Original Code will be corrected. No oral or written statement by GoAhead or by a representative of GoAhead shall create a warranty or increase the scope of this warranty. 70 71 GOAHEAD DOES NOT WARRANT THE ORIGINAL CODE AGAINST INFRINGEMENT OR THE LIKE WITH RESPECT TO ANY COPYRIGHT, PATENT, TRADE SECRET, TRADEMARK OR OTHER PROPRIETARY RIGHT OF ANY THIRD PARTY AND DOES NOT WARRANT THAT THE ORIGINAL CODE DOES NOT INCLUDE ANY VIRUS, SOFTWARE ROUTINE OR OTHER SOFTWARE DESIGNED TO PERMIT UNAUTHORIZED ACCESS, TO DISABLE, ERASE OR OTHERWISE HARM SOFTWARE, HARDWARE OR DATA, OR TO PERFORM ANY OTHER SUCH ACTIONS. 72 73 Any warranties that by law survive the foregoing disclaimers shall terminate ninety (90) days from the date You received the Original Code. 151 THE ORIGINAL CODE, THE DOCUMENTATION AND THE MEDIA UPON WHICH THE ORIGINAL 152 CODE IS RECORDED (IF ANY) ARE PROVIDED "AS IS" AND WITHOUT WARRANTIES OF 153 ANY KIND, EXPRESS, STATUTORY OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 154 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 155 PURPOSE. 156 157 The entire risk as to the quality and performance of the Original Code 158 (including any Modifications You make) and the Documentation is with 159 You. Should the Original Code or the Documentation prove defective, 160 You (and not GoAhead or its distributors, licensors or dealers) assume 161 the entire cost of all necessary servicing or repair. GoAhead does not 162 warrant that the functions contained in the Original Code will meet your 163 requirements or operate in the combination that You may select for use, 164 that the operation of the Original Code will be uninterrupted or error 165 free, or that defects in the Original Code will be corrected. No oral 166 or written statement by GoAhead or by a representative of GoAhead shall 167 create a warranty or increase the scope of this warranty. 168 169 GOAHEAD DOES NOT WARRANT THE ORIGINAL CODE AGAINST INFRINGEMENT OR THE 170 LIKE WITH RESPECT TO ANY COPYRIGHT, PATENT, TRADE SECRET, TRADEMARK 171 OR OTHER PROPRIETARY RIGHT OF ANY THIRD PARTY AND DOES NOT WARRANT 172 THAT THE ORIGINAL CODE DOES NOT INCLUDE ANY VIRUS, SOFTWARE ROUTINE 173 OR OTHER SOFTWARE DESIGNED TO PERMIT UNAUTHORIZED ACCESS, TO DISABLE, 174 ERASE OR OTHERWISE HARM SOFTWARE, HARDWARE OR DATA, OR TO PERFORM ANY 175 OTHER SUCH ACTIONS. 176 177 Any warranties that by law survive the foregoing disclaimers shall 178 terminate ninety (90) days from the date You received the Original Code. 74 179 75 180 6. Limitation of Liability. 76 181 77 YOUR SOLE REMEDIES AND GOAHEAD'S ENTIRE LIABILITY ARE SET FORTH ABOVE. IN NO EVENT WILL GOAHEAD OR ITS DISTRIBUTORS OR DEALERS BE LIABLE FOR DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM THE USE OF THE ORIGINAL CODE, THE INABILITY TO USE THE ORIGINAL CODE, OR ANY DEFECT IN THE ORIGINAL CODE, INCLUDING ANY LOST PROFITS, EVEN IF THEY HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 78 79 You agree that GoAhead and its distributors and dealers will not be LIABLE for defense or indemnity with respect to any claim against You by any third party arising from your possession or use of the Original Code or the Documentation. 80 81 In no event will GoAheads total liability to You for all damages, losses, and causes of action (whether in contract, tort, including negligence, or otherwise) exceed the amount You paid for this product. 82 83 SOME STATES DO NOT ALLOW LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY LASTS, AND SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATIONS OR EXCLUSIONS MAY NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE. 182 YOUR SOLE REMEDIES AND GOAHEAD'S ENTIRE LIABILITY ARE SET FORTH ABOVE. IN 183 NO EVENT WILL GOAHEAD OR ITS DISTRIBUTORS OR DEALERS BE LIABLE FOR 184 DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM 185 THE USE OF THE ORIGINAL CODE, THE INABILITY TO USE THE ORIGINAL CODE, 186 OR ANY DEFECT IN THE ORIGINAL CODE, INCLUDING ANY LOST PROFITS, EVEN IF 187 THEY HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 188 189 You agree that GoAhead and its distributors and dealers will not be 190 LIABLE for defense or indemnity with respect to any claim against You 191 by any third party arising from your possession or use of the Original 192 Code or the Documentation. 193 194 In no event will GoAheads total liability to You for all damages, losses, 195 and causes of action (whether in contract, tort, including negligence, 196 or otherwise) exceed the amount You paid for this product. 197 198 SOME STATES DO NOT ALLOW LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY 199 LASTS, AND SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION 200 OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATIONS OR 201 EXCLUSIONS MAY NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC LEGAL 202 RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE. 84 203 85 204 7. Indemnification by You. 86 205 87 You agree to indemnify and hold GoAhead harmless against any and all claims, losses, damages and costs (including legal expenses and reasonable counsel fees) arising out of any claim of a third party with respect to the contents of the Your products, and any intellectual property rights or other rights or interests related thereto. 206 You agree to indemnify and hold GoAhead harmless against any and all 207 claims, losses, damages and costs (including legal expenses and reasonable 208 counsel fees) arising out of any claim of a third party with respect to 209 the contents of the Your products, and any intellectual property rights 210 or other rights or interests related thereto. 88 211 89 212 8. High Risk Activities. 90 213 91 The Original Code is not fault-tolerant and is not designed , manufactured or intended for use or resale as online control equipment in hazardous environments requiring fail-safe performance, such as in the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, direct life support machines or weapons systems, in which the failure of the Original Code could lead directly to death, personal injury, or severe physical or environmental damage. GoAhead and its suppliers specifically disclaim any express or implied warranty of fitness for any high risk uses listed above. 214 The Original Code is not fault-tolerant and is not designed , manufactured 215 or intended for use or resale as online control equipment in hazardous 216 environments requiring fail-safe performance, such as in the operation 217 of nuclear facilities, aircraft navigation or communication systems, 218 air traffic control, direct life support machines or weapons systems, 219 in which the failure of the Original Code could lead directly to death, 220 personal injury, or severe physical or environmental damage. GoAhead and 221 its suppliers specifically disclaim any express or implied warranty of 222 fitness for any high risk uses listed above. 92 223 93 224 9. Government Restricted Rights. 94 225 95 For units of the Department of Defense, use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013. Contractor/manufacturer is GoAhead Software, Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, Washington 98004. 96 97 If the Commercial Computer Software Restricted rights clause at FAR 52.227-19 or its successors apply, the Software and Documentation constitute restricted computer software as defined in that clause and the Government shall not have the license for published software set forth in subparagraph (c)(3) of that clause. 98 99 The Original Code (i) was developed at private expense, and no part of it was developed with governmental funds; (ii) is a trade secret of GoAhead (or its licensor(s)) for all purposes of the Freedom of Information Act; (iii) is "restricted computer software" subject to limited utilization as provided in the contract between the vendor and the governmental entity; and (iv) in all respects is proprietary data belonging solely to GoAhead (or its licensor(s)). 226 For units of the Department of Defense, use, duplication, or disclosure 227 by the Government is subject to restrictions as set forth in subparagraph 228 (c)(1)(ii) of the Rights in Technical Data and Computer Software clause 229 at DFARS 252.227-7013. Contractor/manufacturer is GoAhead Software, 230 Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, Washington 98004. 231 232 If the Commercial Computer Software Restricted rights clause at FAR 233 52.227-19 or its successors apply, the Software and Documentation 234 constitute restricted computer software as defined in that clause and 235 the Government shall not have the license for published software set 236 forth in subparagraph (c)(3) of that clause. 237 238 The Original Code (i) was developed at private expense, and no part of it 239 was developed with governmental funds; (ii) is a trade secret of GoAhead 240 (or its licensor(s)) for all purposes of the Freedom of Information Act; 241 (iii) is "restricted computer software" subject to limited utilization as 242 provided in the contract between the vendor and the governmental entity; 243 and (iv) in all respects is proprietary data belonging solely to GoAhead 244 (or its licensor(s)). 100 245 101 246 10. Governing Law and Interpretation. 102 247 103 This Agreement shall be interpreted under and governed by the laws of the State of Washington, without regard to its rules governing the conflict of laws. If any provision of this Agreement is held illegal or unenforceable by a court or tribunal of competent jurisdiction, the remaining provisions of this Agreement shall remain in effect and the invalid provision deemed modified to the least degree necessary to remedy such invalidity. 248 This Agreement shall be interpreted under and governed by the laws of the 249 State of Washington, without regard to its rules governing the conflict of 250 laws. If any provision of this Agreement is held illegal or unenforceable 251 by a court or tribunal of competent jurisdiction, the remaining provisions 252 of this Agreement shall remain in effect and the invalid provision deemed 253 modified to the least degree necessary to remedy such invalidity. 104 254 105 255 11. Entire Agreement. 106 256 107 This Agreement is the complete agreement between GoAhead and You and supersedes all prior agreements, oral or written, with respect to the subject matter hereof. 108 109 If You have any questions concerning this Agreement, You may write to GoAhead Software, Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, Washington 98004 or send e-mail to info@goahead.com. 110 111 BY CLICKING ON THE "Register" BUTTON ON THE REGISTRATION FORM, YOU ACCEPT AND AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS SET FORTH IN THIS AGREEMENT. IF YOU DO NOT WISH TO ACCEPT THIS LICENSE OR YOU DO NOT QUALIFY FOR A LICENSE BASED ON THE TERMS SET FORTH ABOVE, YOU MUST NOT CLICK THE "Register" BUTTON. 257 This Agreement is the complete agreement between GoAhead and You and 258 supersedes all prior agreements, oral or written, with respect to the 259 subject matter hereof. 260 261 If You have any questions concerning this Agreement, You may write to 262 GoAhead Software, Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, 263 Washington 98004 or send e-mail to info@goahead.com. 264 265 BY CLICKING ON THE "Register" BUTTON ON THE REGISTRATION FORM, YOU 266 ACCEPT AND AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS SET 267 FORTH IN THIS AGREEMENT. IF YOU DO NOT WISH TO ACCEPT THIS LICENSE OR 268 YOU DO NOT QUALIFY FOR A LICENSE BASED ON THE TERMS SET FORTH ABOVE, 269 YOU MUST NOT CLICK THE "Register" BUTTON. 112 270 113 271 Exhibit A -
c/src/libnetworking/rtems_webserver/md5.h
r2f73363 ree3afa2 1 1 /* MD5.H - header file for MD5C.C 2 * 3 * $Id$ 2 4 */ 3 5 … … 47 49 48 50 #endif /* _h_MD5 */ 51 -
c/src/libnetworking/rtems_webserver/md5c.c
r2f73363 ree3afa2 1 1 /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm 2 * 3 * $Id$ 2 4 */ 3 5 -
c/src/libnetworking/rtems_webserver/mime.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 23 25 */ 24 26 27 25 28 websMimeType websMimeList[] = { 26 29 { T("application/java"), T(".class") }, … … 33 36 { T("text/css"), T(".css") }, 34 37 { T("text/plain"), T(".txt") }, 38 { T("application/x-javascript"), T(".js") }, 35 39 36 #if MORE_MIME_TYPES40 #ifdef MORE_MIME_TYPES 37 41 { T("application/binary"), T(".exe") }, 38 42 { T("application/compress"), T(".z") }, -
c/src/libnetworking/rtems_webserver/misc.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 9 11 /********************************* Includes ***********************************/ 10 12 11 #if UEMF13 #ifdef UEMF 12 14 #include "uemf.h" 13 15 #else … … 50 52 static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, 51 53 int msize); 54 #if !defined(__rtems__) 55 static int strnlen(char_t *s, unsigned int n); 56 #endif 52 57 static void put_char(strbuf_t *buf, char_t c); 53 58 static void put_string(strbuf_t *buf, char_t *s, int len, … … 59 64 /* 60 65 * "basename" returns a pointer to the last component of a pathname 61 * LINUX and LynxOShave their own basename function62 */ 63 64 #if ! LINUX && ! LYNX && ! __rtems__66 * LINUX, LynxOS and Mac OS X have their own basename function 67 */ 68 69 #if (!defined (LINUX) && !defined (LYNX) && !defined (MACOSX)) 65 70 char_t *basename(char_t *name) 66 71 { 67 72 char_t *cp; 68 73 69 #if NW || WIN74 #if (defined (NW) || defined (WIN)) 70 75 if (((cp = gstrrchr(name, '\\')) == NULL) && 71 76 ((cp = gstrrchr(name, '/')) == NULL)) { … … 83 88 } 84 89 } 85 #endif /* ! LINUX & ! LYNX */90 #endif /* ! LINUX & ! LYNX & ! MACOSX */ 86 91 87 92 /******************************************************************************/ … … 100 105 a_assert(bufsize > 0); 101 106 102 #if WIN || NW107 #if (defined (WIN) || defined (NW)) 103 108 if ((cp = gstrrchr(name, '/')) == NULL && 104 109 (cp = gstrrchr(name, '\\')) == NULL) … … 344 349 } 345 350 } else { 351 /* 04 Apr 02 BgP -- changed so that %X correctly outputs 352 * uppercase hex digits when requested. 346 353 put_ulong(&buf, value, 16, 0, NULL, width, prec, f); 354 */ 355 put_ulong(&buf, value, 16, ('X' == c) , NULL, width, prec, f); 347 356 } 348 357 } … … 409 418 /******************************************************************************/ 410 419 /* 420 * Return the length of a string limited by a given length 421 */ 422 423 #if !defined(__rtems__) 424 static int strnlen(char_t *s, unsigned int n) 425 { 426 unsigned int len; 427 428 len = gstrlen(s); 429 return min(len, n); 430 } 431 #endif 432 433 /******************************************************************************/ 434 /* 411 435 * Add a character to a string buffer 412 436 */ … … 528 552 char_t *ascToUni(char_t *ubuf, char *str, int nBytes) 529 553 { 530 #if UNICODE554 #ifdef UNICODE 531 555 if (MultiByteToWideChar(CP_ACP, 0, str, nBytes / sizeof(char_t), ubuf, 532 556 nBytes / sizeof(char_t)) < 0) { … … 534 558 } 535 559 #else 536 memcpy(ubuf, str, nBytes);560 strncpy(ubuf, str, nBytes); 537 561 #endif 538 562 return ubuf; … … 548 572 char *uniToAsc(char *buf, char_t *ustr, int nBytes) 549 573 { 550 #if UNICODE574 #ifdef UNICODE 551 575 if (WideCharToMultiByte(CP_ACP, 0, ustr, nBytes, buf, nBytes, NULL, 552 576 NULL) < 0) { … … 554 578 } 555 579 #else 556 memcpy(buf, ustr, nBytes);580 strncpy(buf, ustr, nBytes); 557 581 #endif 558 582 return (char*) buf; -
c/src/libnetworking/rtems_webserver/ringq.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 48 50 /********************************* Includes ***********************************/ 49 51 50 #if UEMF52 #ifdef UEMF 51 53 #include "uemf.h" 52 54 #else … … 246 248 247 249 /******************************************************************************/ 248 #if UNICODE250 #ifdef UNICODE 249 251 /* 250 252 * Get a byte from the queue … … 539 541 bfree(B_L, (char*) rq->buf); 540 542 541 #if OLD543 #ifdef OLD 542 544 rq->endp = &newbuf[endp]; 543 545 rq->servp = &newbuf[servp]; -
c/src/libnetworking/rtems_webserver/rom.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 25 27 /******************************** Local Data **********************************/ 26 28 27 #if WEBS_PAGE_ROM29 #ifdef WEBS_PAGE_ROM 28 30 29 31 sym_fd_t romTab; /* Symbol table for web pages */ -
c/src/libnetworking/rtems_webserver/security.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 82 84 #ifdef WEBS_SSL_SUPPORT 83 85 nRet = umGetAccessLimitSecure(accessLimit); 84 if (nRet && ((flags |WEBS_SECURE) == 0)) {86 if (nRet && ((flags & WEBS_SECURE) == 0)) { 85 87 websStats.access++; 86 websError(wp, 200, T("Access Denied\nSecure access is required."));88 websError(wp, 405, T("Access Denied\nSecure access is required.")); 87 89 trace(3, T("SEC: Non-secure access attempted on <%s>\n"), path); 90 /* bugfix 5/24/02 -- we were leaking the memory pointed to by 91 * 'accessLimit'. Thanks to Simon Byholm. 92 */ 93 bfree(B_L, accessLimit); 88 94 return 1; 89 95 } … … 110 116 if (!umUserExists(userid)) { 111 117 websStats.access++; 112 websError(wp, 200, T("Access Denied\nUnknown User"));118 websError(wp, 401, T("Access Denied\nUnknown User")); 113 119 trace(3, T("SEC: Unknown user <%s> attempted to access <%s>\n"), 114 120 userid, path); … … 123 129 if (gstrcmp(password, userpass) != 0) { 124 130 websStats.access++; 125 websError(wp, 200, T("Access Denied\nWrong Password"));131 websError(wp, 401, T("Access Denied\nWrong Password")); 126 132 trace(3, T("SEC: Password fail for user <%s>") 127 133 T("attempt to access <%s>\n"), userid, path); … … 154 160 if (gstrcmp(wp->digest, digestCalc) != 0) { 155 161 websStats.access++; 156 websError(wp, 200, T("Access Denied\nWrong Password"));162 websError(wp, 405, T("Access Denied\nWrong Password")); 157 163 nRet = 1; 158 164 } -
c/src/libnetworking/rtems_webserver/sock.c
r2f73363 ree3afa2 3 3 * 4 4 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. 5 * 6 * $Id$ 5 7 */ 6 8 … … 17 19 #include <stdlib.h> 18 20 19 #if UEMF21 #ifdef UEMF 20 22 #include "uemf.h" 21 23 #else … … 71 73 if ((room = ringqPutBlkMax(rq)) == 0) { 72 74 if (sp->flags & SOCKET_BLOCK) { 73 #if WIN || CE75 #if (defined (WIN) || defined (CE)) 74 76 int errCode; 75 77 if (! socketWaitForEvent(sp, FD_WRITE | SOCKET_WRITABLE, … … 100 102 int socketWriteString(int sid, char_t *buf) 101 103 { 102 #if UNICODE104 #ifdef UNICODE 103 105 char *byteBuf; 104 106 int r, len; … … 248 250 len = ringqLen(lq); 249 251 if (len > 0) { 250 *buf = ballocAscToUni( lq->servp, len);252 *buf = ballocAscToUni((char *)lq->servp, len); 251 253 } else { 252 254 *buf = NULL; … … 299 301 continue; 300 302 } else if (errCode == EWOULDBLOCK || errCode == EAGAIN) { 301 #if WIN || CE303 #if (defined (WIN) || defined (CE)) 302 304 if (sp->flags & SOCKET_BLOCK) { 303 305 int errCode; … … 479 481 *errCode = 0; 480 482 481 #if WIN || CE483 #if (defined (WIN) || defined (CE)) 482 484 if ((sp->flags & SOCKET_ASYNC) 483 485 && ! socketWaitForEvent(sp, FD_CONNECT, errCode)) { … … 491 493 if (sp->flags & SOCKET_BROADCAST) { 492 494 server.sin_family = AF_INET; 493 #if UEMF || LITTLEFOOT495 #if (defined (UEMF) || defined (LITTLEFOOT)) 494 496 server.sin_addr.s_addr = INADDR_BROADCAST; 495 497 #else … … 515 517 if (bytes < 0) { 516 518 *errCode = socketGetError(); 517 #if WIN || CE519 #if (defined (WIN) || defined (CE)) 518 520 sp->currentEvents &= ~FD_WRITE; 519 521 #endif … … 523 525 } else if (bytes == 0 && bytes != toWrite) { 524 526 *errCode = EWOULDBLOCK; 525 #if WIN || CE527 #if (defined (WIN) || defined (CE)) 526 528 sp->currentEvents &= ~FD_WRITE; 527 529 #endif … … 533 535 * more data 534 536 */ 535 #if !UEMF536 #if WIN537 #ifndef UEMF 538 #ifdef WIN 537 539 if (sp->interestEvents & FD_WRITE) { 538 540 emfTime_t blockTime = { 0, 0 }; … … 554 556 struct sockaddr *server) 555 557 { 556 #if VXWORKS558 #ifdef VXWORKS 557 559 char *ptr; 558 560 … … 639 641 recv(sp->sock, buf, sizeof(buf), 0); 640 642 } 641 #if WIN || CE643 #if (defined (WIN) || defined (CE)) 642 644 closesocket(sp->sock); 643 645 #else … … 689 691 int socketGetError() 690 692 { 691 #if WIN || CE693 #if (defined (WIN) || defined (CE)) 692 694 switch (WSAGetLastError()) { 693 695 case WSAEWOULDBLOCK: -
c/src/libnetworking/rtems_webserver/sym.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 17 19 /********************************* Includes ***********************************/ 18 20 19 #if UEMF21 #ifdef UEMF 20 22 #include "uemf.h" 21 23 #else -
c/src/libnetworking/rtems_webserver/uemf.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 47 49 if (etype == E_LOG) { 48 50 fmtAlloc(&buf, E_MAX_ERROR, T("%s\n"), fmtBuf); 49 #if DEV 51 /*#ifdef DEV*/ 50 52 } else if (etype == E_ASSERT) { 51 53 fmtAlloc(&buf, E_MAX_ERROR, 52 54 T("Assertion %s, failed at %s %d\n"), fmtBuf, E_ARGS); 53 #endif 55 /*#endif*/ 54 56 } else if (etype == E_USER) { 55 57 fmtAlloc(&buf, E_MAX_ERROR, T("%s\n"), fmtBuf); 56 58 } 59 /* 60 * bugfix -- if etype is not E_LOG, E_ASSERT, or E_USER, the call to 61 * bfreeSafe(B_L, buf) below will fail, because 'buf' is randomly 62 * initialized. To be nice, we format a message saying that this is an 63 * unknown message type, and in doing so give buf a valid value. Thanks 64 * to Simon Byholm. 65 */ 66 else { 67 fmtAlloc(&buf, E_MAX_ERROR, T("Unknown error")); 68 } 57 69 va_end(args); 58 70 -
c/src/libnetworking/rtems_webserver/uemf.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 18 20 /******************************* Per O/S Includes *****************************/ 19 21 20 #if WIN22 #ifdef WIN 21 23 #include <direct.h> 22 24 #include <io.h> … … 34 36 #endif /* WIN */ 35 37 36 #if CE 38 #ifdef CE 39 #include <errno.h> 37 40 #include <limits.h> 38 41 #include <tchar.h> 39 42 #include <windows.h> 43 #include <winsock.h> 40 44 #include <winnls.h> 41 45 #include "CE/wincompat.h" … … 43 47 #endif /* CE */ 44 48 45 #if NW 49 #ifdef NW 50 #include <direct.h> 51 #include <io.h> 52 #include <sys/stat.h> 53 #include <time.h> 54 #include <sys/types.h> 46 55 #include <stdio.h> 56 #include <stdlib.h> 57 #include <fcntl.h> 58 #include <errno.h> 59 #include <niterror.h> 60 #define EINTR EINUSE 61 #define WEBS 1 62 #include <limits.h> 63 #include <netdb.h> 64 #include <process.h> 65 #include <tiuser.h> 66 #include <sys/time.h> 67 #include <arpa/inet.h> 68 #include <sys/types.h> 69 #include <sys/socket.h> 70 #include <sys/filio.h> 71 #include <netinet/in.h> 47 72 #endif /* NW */ 48 73 49 #if SCOV574 #ifdef SCOV5 50 75 #include <sys/types.h> 51 76 #include <stdio.h> … … 57 82 #endif /* SCOV5 */ 58 83 59 #if UNIX84 #ifdef UNIX 60 85 #include <stdio.h> 61 86 #endif /* UNIX */ … … 79 104 #endif /* LINUX */ 80 105 81 #if LYNX106 #ifdef LYNX 82 107 #include <limits.h> 83 108 #include <stdarg.h> … … 94 119 #endif /* LYNX */ 95 120 96 #if UW 121 #ifdef MACOSX 122 #include <sys/stat.h> 123 #include <stdio.h> 124 #include <stdlib.h> 125 #include <unistd.h> 126 #include <sys/socket.h> 127 #include <netinet/in.h> 128 #include <arpa/inet.h> 129 #include <netdb.h> 130 #include <fcntl.h> 131 #include <errno.h> 132 #endif /* MACOSX */ 133 134 #ifdef UW 97 135 #include <stdio.h> 98 136 #endif /* UW */ 99 137 100 #if VXWORKS138 #ifdef VXWORKS 101 139 #include <vxWorks.h> 102 140 #include <sockLib.h> … … 112 150 #endif /* VXWORKS */ 113 151 114 #if SOLARIS152 #ifdef SOLARIS 115 153 #include <sys/types.h> 116 154 #include <limits.h> … … 128 166 #endif /* SOLARIS */ 129 167 130 #if QNX4168 #ifdef QNX4 131 169 #include <sys/types.h> 132 170 #include <stdio.h> … … 142 180 #endif /* QNX4 */ 143 181 144 #if ECOS182 #ifdef ECOS 145 183 #include <limits.h> 146 184 #include <cyg/infra/cyg_type.h> … … 157 195 #include <string.h> 158 196 159 #if !WEBS197 #ifndef WEBS 160 198 #include "messages.h" 161 199 #endif /* ! WEBS */ … … 167 205 #endif 168 206 169 #if UW207 #ifdef UW 170 208 #define __NO_PACK 1 171 209 #endif /* UW */ 172 210 173 #if SCOV5 || VXWORKS || LINUX || LYNX || __rtems__211 #if (defined (SCOV5) || defined (VXWORKS) || defined (LINUX) || defined (LYNX) || defined (MACOSX) || defined (__rtems__)) 174 212 #ifndef O_BINARY 175 213 #define O_BINARY 0 176 214 #endif /* O_BINARY */ 177 215 #define SOCKET_ERROR -1 178 #endif /* SCOV5 || VXWORKS || LINUX || LYNX */179 180 #if WIN || CE216 #endif /* SCOV5 || VXWORKS || LINUX || LYNX || MACOSX */ 217 218 #if (defined (WIN) || defined (CE)) 181 219 /* 182 220 * __NO_FCNTL means can't access fcntl function. Fcntl.h is still available. … … 194 232 #endif /* WIN || CE */ 195 233 196 #if LINUX && !__rtems__ && ! _STRUCT_TIMEVAL234 #if (defined (LINUX) && !defined(__rtems__) && !defined (_STRUCT_TIMEVAL)) 197 235 struct timeval 198 236 { … … 203 241 #endif /* LINUX && ! _STRUCT_TIMEVAL */ 204 242 205 #if ECOS243 #ifdef ECOS 206 244 #define O_RDONLY 1 207 245 #define O_BINARY 2 … … 219 257 #endif /* ECOS */ 220 258 221 #if QNX4259 #ifdef QNX4 222 260 typedef long fd_mask; 223 261 #define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ 224 262 #endif /* QNX4 */ 263 264 #ifdef NW 265 #define fd_mask fd_set 266 #define INADDR_NONE -1l 267 #define Sleep delay 268 269 #define __NO_FCNTL 1 270 271 #undef R_OK 272 #define R_OK 4 273 #undef W_OK 274 #define W_OK 2 275 #undef X_OK 276 #define X_OK 1 277 #undef F_OK 278 #define F_OK 0 279 #endif /* NW */ 225 280 226 281 /********************************** Unicode ***********************************/ … … 234 289 #define XML_MAX 4096 /* Maximum size for tags/tokens */ 235 290 #define BUF_MAX 4096 /* General sanity check for bufs */ 236 237 #if LITTLEFOOT || WEBS 291 #define FMT_STATIC_MAX 256 /* Maximum for fmtStatic calls */ 292 293 #if (defined (LITTLEFOOT) || defined (WEBS)) 238 294 #define LF_BUF_MAX (510) 239 295 #define LF_PATHSIZE LF_BUF_MAX … … 246 302 #ifndef CHAR_T_DEFINED 247 303 #define CHAR_T_DEFINED 1 248 #if UNICODE304 #ifdef UNICODE 249 305 /* 250 306 * To convert strings to UNICODE. We have a level of indirection so things … … 272 328 #define TSZ(x) (sizeof(x)) 273 329 #define TASTRL(x) (strlen(x) + 1) 274 #if WIN330 #ifdef WIN 275 331 typedef unsigned char uchar_t; 276 332 #endif /* WIN */ … … 302 358 * here, many modules in various parts of the tree are cleaner. 303 359 */ 304 #if LITTLEFOOT && INMEM360 #if (defined (LITTLEFOOT) && defined (INMEM)) 305 361 #include "lf/inmem.h" 306 362 #endif /* LITTLEFOOT && INMEM */ … … 309 365 * Type for unicode systems 310 366 */ 311 #if UNICODE367 #ifdef UNICODE 312 368 313 369 #define gmain wmain … … 368 424 #define gtolower towlower 369 425 #define gtoupper towupper 370 #if CE426 #ifdef CE 371 427 #define gisspace isspace 372 428 #define gisdigit isdigit … … 395 451 #ifndef gopen 396 452 #if INMEM 453 #define gchdir imChdir 454 #define gmkdir imMkdir 455 #define grmdir imRmdir 397 456 #define gclose imClose 398 457 #define gclosedir imClosedir 399 #define gchdir imChdir400 458 #define gchmod imChmod 401 459 #define ggetcwd imGetcwd 402 460 #define glseek imLseek 403 461 #define gloadModule imLoadModule 404 #define gmkdir imMkdir405 462 #define gopen imOpen 406 463 #define gopendir imOpendir … … 408 465 #define greaddir imReaddir 409 466 #define grename imRename 410 #define grmdir imRmdir411 467 #define gstat imStat 412 468 #define gunlink imUnlink 413 469 #define gwrite imWrite 414 470 #else 415 #define gclose close416 #define gclosedir closedir417 471 #if VXWORKS 418 472 #define gchdir vxchdir 419 473 #define gmkdir vxmkdir 420 474 #define grmdir vxrmdir 475 #elif (defined (LYNX) || defined (LINUX) || defined (MACOSX) || defined (SOLARIS)) 476 #define gchdir chdir 477 #define gmkdir(s) mkdir(s,0755) 478 #define grmdir rmdir 421 479 #else 422 #if LYNX || LINUX || SOLARIS 423 #define gmkdir(s) mkdir(s,0755) 424 #else 480 #define gchdir chdir 425 481 #define gmkdir mkdir 426 #endif /* LYNX || LINUX || SOLARIS */427 482 #define grmdir rmdir 428 #define gchdir chdir 429 #endif /* VXWORKS */ 483 #endif /* VXWORKS #elif LYNX || LINUX || MACOSX || SOLARIS*/ 484 #define gclose close 485 #define gclosedir closedir 430 486 #define gchmod chmod 431 487 #define ggetcwd getcwd … … 501 557 #define gmain main 502 558 #endif /* ! VXWORKS */ 503 #if VXWORKS559 #ifdef VXWORKS 504 560 #define fcntl(a, b, c) 505 561 #endif /* VXWORKS */ 506 562 #endif /* ! UNICODE */ 507 563 564 /* 565 * Include inmem.h here because it redefines many of the file access fucntions. 566 * Otherwise there would be lots more #if-#elif-#else-#endif ugliness. 567 */ 568 #ifdef INMEM 569 #include "lf/inmem.h" 570 #endif 571 508 572 /********************************** Defines ***********************************/ 509 573 … … 526 590 #define E_ARGS file, line 527 591 528 #if ASSERT || ASSERT_CE592 #if (defined (ASSERT) || defined (ASSERT_CE)) 529 593 #define a_assert(C) if (C) ; else error(E_L, E_ASSERT, T("%s"), T(#C)) 530 594 #else … … 571 635 long octal; 572 636 long big[2]; 573 #if FLOATING_POINT_SUPPORT637 #ifdef FLOATING_POINT_SUPPORT 574 638 double floating; 575 639 #endif /* FLOATING_POINT_SUPPORT */ … … 580 644 } value; 581 645 582 vtype_t type : 16;646 vtype_t type; 583 647 unsigned int valid : 8; 584 648 unsigned int allocated : 8; /* String was balloced */ … … 750 814 */ 751 815 752 #if ( WIN || CE) && WEBS816 #if ((defined (WIN) || defined (CE)) && defined (WEBS)) 753 817 #define EWOULDBLOCK WSAEWOULDBLOCK 754 818 #define ENETDOWN WSAENETDOWN … … 756 820 #endif /* (WIN || CE) && WEBS) */ 757 821 758 #define SOCKET_EOF 0x1 /* Seen end of file */ 759 #define SOCKET_CONNECTING 0x2 /* Connect in progress */ 760 #define SOCKET_BROADCAST 0x4 /* Broadcast mode */ 761 #define SOCKET_PENDING 0x8 /* Message pending on this socket */ 762 #define SOCKET_FLUSHING 0x10 /* Background flushing */ 763 #define SOCKET_DATAGRAM 0x20 /* Use datagrams */ 764 #define SOCKET_ASYNC 0x40 /* Use async connect */ 765 #define SOCKET_BLOCK 0x80 /* Use blocking I/O */ 766 #define SOCKET_LISTENING 0x100 /* Socket is server listener */ 767 #define SOCKET_CLOSING 0x200 /* Socket is closing */ 768 769 #define SOCKET_PORT_MAX 0xffff /* Max Port size */ 822 #define SOCKET_EOF 0x1 /* Seen end of file */ 823 #define SOCKET_CONNECTING 0x2 /* Connect in progress */ 824 #define SOCKET_BROADCAST 0x4 /* Broadcast mode */ 825 #define SOCKET_PENDING 0x8 /* Message pending on this socket */ 826 #define SOCKET_FLUSHING 0x10 /* Background flushing */ 827 #define SOCKET_DATAGRAM 0x20 /* Use datagrams */ 828 #define SOCKET_ASYNC 0x40 /* Use async connect */ 829 #define SOCKET_BLOCK 0x80 /* Use blocking I/O */ 830 #define SOCKET_LISTENING 0x100 /* Socket is server listener */ 831 #define SOCKET_CLOSING 0x200 /* Socket is closing */ 832 #define SOCKET_CONNRESET 0x400 /* Socket connection was reset */ 833 834 #define SOCKET_PORT_MAX 0xffff /* Max Port size */ 770 835 771 836 /* 772 837 * Socket error values 773 838 */ 774 #define SOCKET_WOULDBLOCK 1 775 #define SOCKET_RESET 2 776 #define SOCKET_NETDOWN 3 777 #define SOCKET_AGAIN 4 778 #define SOCKET_INTR 5 779 #define SOCKET_INVAL 6 839 #define SOCKET_WOULDBLOCK 1 /* Socket would block on I/O */ 840 #define SOCKET_RESET 2 /* Socket has been reset */ 841 #define SOCKET_NETDOWN 3 /* Network is down */ 842 #define SOCKET_AGAIN 4 /* Issue the request again */ 843 #define SOCKET_INTR 5 /* Call was interrupted */ 844 #define SOCKET_INVAL 6 /* Invalid */ 780 845 781 846 /* 782 847 * Handler event masks 783 848 */ 784 #define SOCKET_READABLE 0x2 785 #define SOCKET_WRITABLE 0x4 786 #define SOCKET_EXCEPTION 0x8 849 #define SOCKET_READABLE 0x2 /* Make socket readable */ 850 #define SOCKET_WRITABLE 0x4 /* Make socket writable */ 851 #define SOCKET_EXCEPTION 0x8 /* Interested in exceptions */ 787 852 #define EMF_SOCKET_MESSAGE (WM_USER+13) 788 853 789 #if LITTLEFOOT790 #define SOCKET_BUFSIZ 510 854 #ifdef LITTLEFOOT 855 #define SOCKET_BUFSIZ 510 /* Underlying buffer size */ 791 856 #else 792 #define SOCKET_BUFSIZ 1024 857 #define SOCKET_BUFSIZ 1024 /* Underlying buffer size */ 793 858 #endif /* LITTLEFOOT */ 794 859 … … 831 896 */ 832 897 833 #if NO_BALLOC898 #ifdef NO_BALLOC 834 899 #define balloc(B_ARGS, num) malloc(num) 835 900 #define bfree(B_ARGS, p) free(p) … … 852 917 #define bstrdup(B_ARGS, p) bstrdup(p) 853 918 854 #if UNICODE919 #ifdef UNICODE 855 920 #define bstrdupA(B_ARGS, p) bstrdupA(p) 856 921 #else /* UNICODE */ … … 867 932 extern char_t *bstrdup(B_ARGS_DEC, char_t *s); 868 933 869 #if UNICODE934 #ifdef UNICODE 870 935 extern char *bstrdupA(B_ARGS_DEC, char *s); 871 936 #else /* UNICODE */ … … 882 947 #define B_USER_BUF 0x2 /* User supplied buffer for mem */ 883 948 949 884 950 #if !LINUX && !__rtems__ 885 951 extern char_t *basename(char_t *name); 886 952 #endif /* !LINUX */ 887 953 888 #if UEMF && WEBS954 #if (defined (UEMF) && defined (WEBS)) 889 955 /* 890 956 * The open source webserver uses a different callback/timer mechanism … … 909 975 (int etype, char_t *msg); 910 976 911 #if B_STATS977 #ifdef B_STATS 912 978 #define hAlloc(x) HALLOC(B_L, x) 913 979 #define hAllocEntry(x, y, z) HALLOCENTRY(B_L, x, y, z) … … 934 1000 extern int fmtStatic(char_t *s, int n, char_t *fmt, ...); 935 1001 936 #if UNICODE1002 #ifdef UNICODE 937 1003 extern int ringqPutcA(ringq_t *rq, char c); 938 1004 extern int ringqInsertcA(ringq_t *rq, char c); -
c/src/libnetworking/rtems_webserver/um.c
r2f73363 ree3afa2 54 54 /******************************** Local Data **********************************/ 55 55 56 #ifdef qHierarchicalAccess 57 /* 58 * user-provided function to allow hierarchical access protection. See below. 59 * for details. 60 */ 61 extern bool_t dmfCanAccess(const char_t* usergroup, const char_t* group); 62 #endif 56 63 #ifdef UEMF 57 64 /* … … 1378 1385 */ 1379 1386 if (group && *group) { 1387 #ifdef qHierarchicalAccess 1388 /* 1389 * If we are compiling with the hierarchical access extensions, we 1390 * instead call the user-provided function that checks to see whether 1391 * the current user's access level is greater than or equal to the 1392 * access level required for this URL. 1393 */ 1394 return dmfCanAccess(usergroup, group); 1395 1396 #else 1380 1397 if (usergroup && (gstrcmp(group, usergroup) != 0)) { 1381 1398 return FALSE; 1399 1382 1400 } 1401 #endif 1383 1402 } 1384 1403 … … 1387 1406 */ 1388 1407 return TRUE; 1408 1389 1409 } 1390 1410 -
c/src/libnetworking/rtems_webserver/um.h
r2f73363 ree3afa2 22 22 /********************************* Includes ***********************************/ 23 23 24 #if !UEMF24 #ifndef UEMF 25 25 #include "basic/basic.h" 26 26 #include "emf/emf.h" -
c/src/libnetworking/rtems_webserver/url.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 -
c/src/libnetworking/rtems_webserver/value.c
r2f73363 ree3afa2 3 3 * 4 4 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. 5 * 6 * $Id$ 5 7 */ 6 8 … … 14 16 /********************************* Includes ***********************************/ 15 17 16 #if UEMF18 #ifdef UEMF 17 19 #include "uemf.h" 18 20 #else … … 21 23 22 24 /*********************************** Locals ***********************************/ 23 #if !UEMF25 #ifndef UEMF 24 26 static value_t value_null; /* All zeros */ 25 27 … … 78 80 bfree(B_L, v->value.string); 79 81 } 80 #if !UEMF82 #ifndef UEMF 81 83 if (v->valid && v->type == symbol && v->value.symbol.data != NULL && 82 84 v->value.symbol.freeCb !=NULL) { … … 89 91 } 90 92 91 #if !UEMF93 #ifndef UEMF 92 94 93 95 /******************************************************************************/ … … 152 154 } 153 155 154 #if FLOATING_POINT_SUPPORT156 #ifdef FLOATING_POINT_SUPPORT 155 157 /******************************************************************************/ 156 158 /* … … 337 339 break; 338 340 339 #if FLOATING_POINT_SUPPORT341 #ifdef FLOATING_POINT_SUPPORT 340 342 case floating: 341 343 v1.value.floating += v2.value.floating; … … 394 396 break; 395 397 396 #if FLOATING_POINT_SUPPORT398 #ifdef FLOATING_POINT_SUPPORT 397 399 case floating: 398 400 v1.value.floating -= v2.value.floating; … … 455 457 break; 456 458 457 #if FLOATING_POINT_SUPPORT459 #ifdef FLOATING_POINT_SUPPORT 458 460 case floating: 459 461 v1.value.floating *= v2.value.floating; … … 512 514 break; 513 515 514 #if FLOATING_POINT_SUPPORT516 #ifdef FLOATING_POINT_SUPPORT 515 517 case floating: 516 518 v1.value.floating /= v2.value.floating; … … 583 585 else return 1; 584 586 585 #if FLOATING_POINT_SUPPORT587 #ifdef FLOATING_POINT_SUPPORT 586 588 case floating: 587 589 if (v1.value.floating < v2.value.floating) … … 634 636 static void coerce_types(register value_t* v1, register value_t* v2) 635 637 { 636 #if FLOATING_POINT_SUPPORT638 #ifdef FLOATING_POINT_SUPPORT 637 639 if (v1->type == floating) { 638 640 v2->type = floating; … … 701 703 return 0; 702 704 703 #if FLOATING_POINT_SUPPORT705 #ifdef FLOATING_POINT_SUPPORT 704 706 case floating: 705 707 if (vp->value.floating < 0) … … 751 753 return 0; 752 754 753 #if FLOATING_POINT_SUPPORT755 #ifdef FLOATING_POINT_SUPPORT 754 756 case floating: 755 757 if (vp->value.floating == 0) … … 802 804 case bytes: 803 805 case big: 804 #if FLOATING_POINT_SUPPORT806 #ifdef FLOATING_POINT_SUPPORT 805 807 case floating: 806 808 a_assert(0); … … 853 855 break; 854 856 855 #if FLOATING_POINT_SUPPORT857 #ifdef FLOATING_POINT_SUPPORT 856 858 case floating: 857 859 if (fmt == NULL || *fmt == '\0') { … … 962 964 break; 963 965 964 #if UNUSED966 #ifdef UNUSED 965 967 case bytes: 966 968 asrc = vp.value.bytes; … … 1169 1171 break; 1170 1172 1171 #if FLOATING_POINT_SUPPORT1173 #ifdef FLOATING_POINT_SUPPORT 1172 1174 case floating: 1173 1175 gsscanf(s, T("%f"), &v.value.floating); … … 1192 1194 break; 1193 1195 1194 #if UNUSED1196 #ifdef UNUSED 1195 1197 case literal: 1196 1198 v = value_literal(bstrdup(B_L, s)); -
c/src/libnetworking/rtems_webserver/wbase64.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 -
c/src/libnetworking/rtems_webserver/webcomp.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 113 115 return -1; 114 116 } 115 fprintf(stdout, "static constunsigned char page_%d[] = {\n", nFile);117 fprintf(stdout, "static unsigned char page_%d[] = {\n", nFile); 116 118 117 119 while ((len = read(fd, buf, sizeof(buf))) > 0) { -
c/src/libnetworking/rtems_webserver/webpage.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 28 30 a_assert(websValid(wp)); 29 31 30 #if WEBS_PAGE_ROM32 #ifdef WEBS_PAGE_ROM 31 33 return websRomPageOpen(wp, path, mode, perm); 32 34 #else … … 44 46 a_assert(websValid(wp)); 45 47 46 #if WEBS_PAGE_ROM48 #ifdef WEBS_PAGE_ROM 47 49 websRomPageClose(wp->docfd); 48 50 #else … … 61 63 int websPageStat(webs_t wp, char_t *lpath, char_t *path, websStatType* sbuf) 62 64 { 63 #if WEBS_PAGE_ROM65 #ifdef WEBS_PAGE_ROM 64 66 return websRomPageStat(path, sbuf); 65 67 #else … … 83 85 int websPageIsDirectory(char_t *lpath) 84 86 { 85 #if WEBS_PAGE_ROM87 #ifdef WEBS_PAGE_ROM 86 88 websStatType sbuf; 87 89 … … 112 114 { 113 115 114 #if WEBS_PAGE_ROM116 #ifdef WEBS_PAGE_ROM 115 117 a_assert(websValid(wp)); 116 118 return websRomPageReadData(wp, buf, nBytes); … … 130 132 a_assert(websValid(wp)); 131 133 132 #if WEBS_PAGE_ROM134 #ifdef WEBS_PAGE_ROM 133 135 websRomPageSeek(wp, offset, SEEK_CUR); 134 136 #else -
c/src/libnetworking/rtems_webserver/webrom.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 -
c/src/libnetworking/rtems_webserver/webs.c
r2f73363 ree3afa2 20 20 #include "wsIntrn.h" 21 21 #ifdef DIGEST_ACCESS_SUPPORT 22 #include "websda.h"22 #include "websda.h" 23 23 #endif 24 24 … … 45 45 { 301, T("Redirect") }, 46 46 { 302, T("Redirect") }, 47 { 304, T("Use rlocal copy") },47 { 304, T("Use local copy") }, 48 48 { 400, T("Page not found") }, 49 49 { 401, T("Unauthorized") }, … … 57 57 }; 58 58 59 #if WEBS_LOG_SUPPORT59 #ifdef WEBS_LOG_SUPPORT 60 60 static char_t websLogname[64] = T("log.txt"); /* Log filename */ 61 61 static int websLogFd; /* Log file handle */ … … 70 70 71 71 72 static char_t *websErrorMsg(int code); 72 /*static char_t *websErrorMsg(int code);*/ 73 73 static int websGetInput(webs_t wp, char_t **ptext, int *nbytes); 74 74 static int websParseFirst(webs_t wp, char_t *text); … … 77 77 static int websGetTimeSinceMark(webs_t wp); 78 78 79 #if WEBS_LOG_SUPPORT79 #ifdef WEBS_LOG_SUPPORT 80 80 static void websLog(webs_t wp, int code); 81 81 #endif 82 #if WEBS_IF_MODIFIED_SUPPORT82 #ifdef WEBS_IF_MODIFIED_SUPPORT 83 83 static time_t dateParse(time_t tip, char_t *cmd); 84 84 #endif … … 100 100 a_assert(retries >= 0); 101 101 102 #if WEBS_PAGE_ROM102 #ifdef WEBS_PAGE_ROM 103 103 websRomOpen(); 104 104 #endif … … 124 124 websFormOpen(); 125 125 126 #if WEBS_LOG_SUPPORT126 #ifdef WEBS_LOG_SUPPORT 127 127 /* 128 128 * Optional request log support … … 166 166 } 167 167 168 #if WEBS_LOG_SUPPORT168 #ifdef WEBS_LOG_SUPPORT 169 169 if (websLogFd >= 0) { 170 170 close(websLogFd); … … 173 173 #endif 174 174 175 #if WEBS_PAGE_ROM175 #ifdef WEBS_PAGE_ROM 176 176 websRomClose(); 177 177 #endif … … 273 273 wp->listenSid = listenSid; 274 274 275 ascToUni(wp->ipaddr, ipaddr, sizeof(wp->ipaddr));275 ascToUni(wp->ipaddr, ipaddr, min(sizeof(wp->ipaddr), strlen(ipaddr) + 1)); 276 276 277 277 /* … … 320 320 } 321 321 if (mask & SOCKET_WRITABLE) { 322 if (w p->writeSocket) {322 if (websValid(wp) && wp->writeSocket) { 323 323 (*wp->writeSocket)(wp); 324 324 } … … 341 341 a_assert(websValid(wp)); 342 342 343 webs MarkTime(wp);343 websSetTimeMark(wp); 344 344 345 345 /* … … 411 411 } 412 412 gwrite(fd, text, gstrlen(text)); 413 gwrite(fd, T("\n"), sizeof(char_t)); 413 /* 414 * NOTE that the above comment is wrong -- if the content length 415 * is set, websGetInput() does NOT use socketGets(), it uses 416 * socketRead(), so the line below that adds an additional newline 417 * is destructive. 418 */ 419 /*gwrite(fd, T("\n"), sizeof(char_t));*/ 420 /* 421 * Line removed as per BUG02488 422 * 414 423 nbytes += 1; 424 */ 415 425 } else 416 426 #endif … … 434 444 * append it. 435 445 */ 436 len = gstrlen(wp->query); 437 wp->query = brealloc(B_L, wp->query, (len + gstrlen(text) + 438 1) * sizeof(char_t)); 439 if (wp->query) { 440 gstrcpy(&wp->query[len], text); 441 } 446 if (text != NULL) 447 { 448 len = gstrlen(wp->query); 449 wp->query = brealloc(B_L, wp->query, (len + gstrlen(text) + 450 1) * sizeof(char_t)); 451 if (wp->query) { 452 gstrcpy(&wp->query[len], text); 453 } 454 } 442 455 } 443 456 … … 458 471 } 459 472 /* 460 * No more data so process the request 461 */ 473 * No more data so process the request, (but be sure to close 474 * the input file first!). 475 */ 476 if (fd != -1) { 477 gclose (fd); 478 fd = -1; 479 } 462 480 websUrlHandlerRequest(wp); 463 481 done++; … … 625 643 websDone(wp, 0); 626 644 } 645 } else { 646 /* 647 * If an error occurred and it wasn't an eof, close the connection 648 */ 649 #ifdef HP_FIX 650 websDone(wp, 0); 651 #endif /*HP_FIX*/ 652 627 653 } 628 654 /* … … 631 657 * no empty line terminator. 632 658 */ 659 /* 660 * NOTE: this fix for earlier versions of browsers is troublesome 661 * because if we don't receive the entire header in the first pass 662 * this code assumes we were only expecting a one line header, which 663 * is not necessarily the case. So we weren't processing the whole 664 * header and weren't fufilling requests properly. 665 */ 666 #ifdef UNUSED 633 667 if (wp->state == WEBS_HEADER && ringqLen(&wp->header) <= 0) { 634 668 websParseRequest(wp); 635 669 websUrlHandlerRequest(wp); 636 670 } 671 #endif 637 672 return -1; 638 673 … … 762 797 websUrlType(url, wp->type, TSZ(wp->type)); 763 798 764 #if WEBS_PROXY_SUPPORT799 #ifdef WEBS_PROXY_SUPPORT 765 800 /* 766 801 * Determine if this is a request for local webs data. If it is not a proxied … … 873 908 if ((cp = gstrchr(value, ' ')) != NULL) { 874 909 *cp = '\0'; 910 /* 911 * bugfix 5/24/02 -- we were leaking the memory pointed to by 912 * wp->authType that was allocated just before the if() 913 * statement that we are currently in. Thanks to Simon Byholm. 914 */ 915 bfree(B_L, wp->authType); 875 916 wp->authType = bstrdup(B_L, value); 876 917 websDecode64(userAuth, ++cp, sizeof(userAuth)); … … 1001 1042 */ 1002 1043 } else if (gstrcmp(key, T("content-length")) == 0) { 1003 wp->flags |= WEBS_CLEN; 1004 wp->clen = gatoi(value); 1005 websSetVar(wp, T("CONTENT_LENGTH"), value); 1044 /* 1045 * 11 Oct 02 BgP -- The server would crash if an attacker sent a POST 1046 * message with a content-length value <= 0. We assume that anyone 1047 * sending this is malicious, and the POST is read from the socket, 1048 * but it is ignored, and the socket is closed. 1049 */ 1050 wp->clen = gatoi(value); 1051 if (wp->clen > 0) 1052 { 1053 wp->flags |= WEBS_CLEN; 1054 websSetVar(wp, T("CONTENT_LENGTH"), value); 1055 } 1056 else 1057 { 1058 wp->clen = 0; 1059 } 1006 1060 1007 1061 /* … … 1011 1065 websSetVar(wp, T("CONTENT_TYPE"), value); 1012 1066 1013 #if WEBS_KEEP_ALIVE_SUPPORT1067 #ifdef WEBS_KEEP_ALIVE_SUPPORT 1014 1068 } else if (gstrcmp(key, T("connection")) == 0) { 1015 1069 strlower(value); … … 1019 1073 #endif 1020 1074 1021 #if WEBS_PROXY_SUPPORT1075 #ifdef WEBS_PROXY_SUPPORT 1022 1076 /* 1023 1077 * This may be useful if you wish to keep a local cache of web pages … … 1040 1094 wp->cookie = bstrdup(B_L, value); 1041 1095 1042 #if WEBS_IF_MODIFIED_SUPPORT1096 #ifdef WEBS_IF_MODIFIED_SUPPORT 1043 1097 /* 1044 1098 * See if the local page has been modified since the browser last … … 1128 1182 } 1129 1183 1130 #if EMF1184 #ifdef EMF 1131 1185 /* 1132 1186 * Add GoAhead Embedded Management Framework defines … … 1257 1311 if ( !(wp->flags & WEBS_HEADER_DONE)) { 1258 1312 wp->flags |= WEBS_HEADER_DONE; 1259 websWrite(wp, T("HTTP/1.1 %d %s\r\n"), code, websErrorMsg(code)); 1313 /* 1314 * Redirect behaves much better when sent with HTTP/1.0 1315 */ 1316 if (redirect != NULL) { 1317 websWrite(wp, T("HTTP/1.0 %d %s\r\n"), code, websErrorMsg(code)); 1318 } else { 1319 websWrite(wp, T("HTTP/1.1 %d %s\r\n"), code, websErrorMsg(code)); 1320 } 1321 1260 1322 /* 1261 1323 * By license terms the following line of code must not be modified. … … 1281 1343 char_t *nonce, *opaque; 1282 1344 1345 /* $$$ before... (note commas instead of semicolons...) 1283 1346 nonce = websCalcNonce(wp), 1284 1347 opaque = websCalcOpaque(wp), 1348 $$$ after */ 1349 nonce = websCalcNonce(wp); 1350 opaque = websCalcOpaque(wp); 1351 /* ...$$$ end */ 1285 1352 websWrite(wp, 1286 1353 T("WWW-Authenticate: Digest realm=\"%s\", domain=\"%s\",") … … 1382 1449 */ 1383 1450 1451 #ifdef qRichErrorPage 1452 extern int dmfRichError(webs_t wp, int code, char_t* userMsg); 1453 #endif 1384 1454 void websError(webs_t wp, int code, char_t *fmt, ...) 1385 1455 { 1386 1456 va_list args; 1387 1457 char_t *msg, *userMsg, *buf; 1458 #ifdef qRichErrorPage 1459 static int reEntry = 0; 1460 int errorOk; 1461 #endif 1388 1462 1389 1463 a_assert(websValid(wp)); … … 1397 1471 va_end(args); 1398 1472 1473 #ifdef qRichErrorPage 1474 if (!reEntry) 1475 { 1476 /* 1477 * The dmfRichError function that we're about to call may very well call 1478 * websError() as part of its work. If that happens, we do NOT want to 1479 * get into a never-ending recursive call chain. When we get back here 1480 * in a call from inside dmfRichError(), we check to see if we're 1481 * already trying to call dmfRichError. If we are, we just revert to the 1482 * old non-rich behavior and display a black on white error page. 1483 */ 1484 1485 reEntry = 1; 1486 errorOk = dmfRichError(wp, code, userMsg); 1487 reEntry = 0; 1488 if (errorOk) 1489 { 1490 return; 1491 } 1492 /* ...else we need to fall through and execute the simple error page. */ 1493 } 1494 /* implicit else... */ 1495 #endif 1496 1399 1497 msg = T("<html><head><title>Document Error: %s</title></head>\r\n\ 1400 1498 <body><h2>Access Error: %s</h2>\r\n\ … … 1417 1515 */ 1418 1516 1419 static char_t *websErrorMsg(int code) 1517 /*static char_t *websErrorMsg(int code)*/ 1518 char_t *websErrorMsg(int code) 1420 1519 { 1421 1520 websErrorType *ep; … … 1448 1547 buf = NULL; 1449 1548 rc = 0; 1549 1450 1550 if (fmtValloc(&buf, WEBS_BUFSIZE, fmt, vargs) >= WEBS_BUFSIZE) { 1451 1551 trace(0, T("webs: websWrite lost data, buffer overflow\n")); 1452 1552 } 1553 1453 1554 va_end(vargs); 1454 1555 a_assert(buf); … … 1598 1699 1599 1700 /******************************************************************************/ 1600 #if WEBS_LOG_SUPPORT1701 #ifdef WEBS_LOG_SUPPORT 1601 1702 /* 1602 1703 * Output a log message … … 1608 1709 char *abuf; 1609 1710 int len; 1610 1711 #define qAnlLog 1 1712 #ifdef qAnlLog 1713 time_t timer; 1714 char_t* newLine = NULL; 1715 char_t* timeStr = NULL; 1716 #endif 1611 1717 a_assert(websValid(wp)); 1612 1718 1613 1719 buf = NULL; 1720 1721 #ifdef qAnlLog 1722 time(&timer); 1723 timeStr = ctime(&timer); 1724 newLine = gstrchr(timeStr, '\n'); 1725 if (newLine) 1726 { 1727 *newLine = '\0'; 1728 } 1729 fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%s\t%s\t%s\tcode = %d\n"), 1730 timeStr, wp->ipaddr, wp->url, code); 1731 #else 1614 1732 fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%d %s %d %d\n"), time(0), 1615 1733 wp->url, code, wp->written); 1734 #endif 1616 1735 len = gstrlen(buf); 1617 1736 abuf = ballocUniToAsc(buf, len+1); … … 1648 1767 wp->timeout = -1; 1649 1768 websDone(wp, 404); 1650 1651 1769 } else { 1652 1770 delay = WEBS_TIMEOUT - tm; … … 1674 1792 } 1675 1793 1676 #if WEBS_PROXY_SUPPORT1794 #ifdef WEBS_PROXY_SUPPORT 1677 1795 if (! (wp->flags & WEBS_LOCAL_PAGE)) { 1678 1796 websStats.activeNetRequests--; … … 1680 1798 #endif 1681 1799 1682 #if WEBS_LOG_SUPPORT1800 #ifdef WEBS_LOG_SUPPORT 1683 1801 if (! (wp->flags & WEBS_REQUEST_DONE)) { 1684 1802 websLog(wp, code); … … 1961 2079 a_assert(websValid(wp)); 1962 2080 1963 #if WEBS_PAGE_ROM2081 #ifdef WEBS_PAGE_ROM 1964 2082 return wp->path; 1965 2083 #else … … 2210 2328 */ 2211 2329 2212 void webs MarkTime(webs_t wp)2330 void websSetTimeMark(webs_t wp) 2213 2331 { 2214 2332 wp->timestamp = time(0); … … 2248 2366 2249 2367 2250 #if WEBS_IF_MODIFIED_SUPPORT2368 #ifdef WEBS_IF_MODIFIED_SUPPORT 2251 2369 /******************************************************************************/ 2252 2370 /* … … 2583 2701 long dayDifference; 2584 2702 2585 dayDifference = FixedFromGregorian(month, day, year) - 2703 /* 2704 * Bug fix by Jeff Reeder (Jun 14, 2002): The 'month' parameter is 2705 * numbered from 0 (Jan == 0), but FixedFromGregorian() takes 2706 * months numbered from 1 (January == 1). We need to add 1 2707 * to the month 2708 */ 2709 dayDifference = FixedFromGregorian(month + 1, day, year) - 2586 2710 FixedFromGregorian(1, 1, 1970); 2587 2711 … … 2835 2959 #endif /* WEBS_IF_MODIFIED_SUPPORT */ 2836 2960 2837 2838 /******************************************************************************/ 2961 /******************************************************************************/ -
c/src/libnetworking/rtems_webserver/webs.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for information on usage and redistribution 7 * 8 * $Id$ 7 9 */ 8 10 … … 22 24 #include "ej.h" 23 25 #ifdef WEBS_SSL_SUPPORT 24 #include "websSSL.h"26 #include "websSSL.h" 25 27 #endif 26 28 … … 31 33 */ 32 34 #define WEBS_NAME T("GoAhead-Webs") 33 #define WEBS_VERSION T("2.1 ")35 #define WEBS_VERSION T("2.1.3") 34 36 35 37 #define WEBS_HEADER_BUFINC 512 /* Header buffer size */ … … 141 143 extern void websEncode64(char_t *outbuf, char_t *string, int buflen); 142 144 extern void websError(webs_t wp, int code, char_t *msg, ...); 145 /* function websErrorMsg() made extern 03 Jun 02 BgP */ 146 extern char_t *websErrorMsg(int code); 143 147 extern void websFooter(webs_t wp); 144 148 extern int websFormDefine(char_t *name, void (*fn)(webs_t wp, … … 207 211 extern int websValid(webs_t wp); 208 212 extern int websValidateUrl(webs_t wp, char_t *path); 209 extern void webs MarkTime(webs_t wp);213 extern void websSetTimeMark(webs_t wp); 210 214 211 215 /* … … 221 225 * GoAhead Embedded Management Framework (EMF) 222 226 */ 223 #if EMF227 #ifdef EMF 224 228 extern void websFormExplain(webs_t wp, char_t *path, char_t *query); 225 229 #endif -
c/src/libnetworking/rtems_webserver/websuemf.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 46 48 if (engine == EMF_SCRIPT_EJSCRIPT) { 47 49 ejid = (int) chan; 48 if (ejEval(ejid, cmd, NULL) ) { 50 /* 51 * NOTE -- to disable better reporting of ASP errors, change the 52 * following line of code to 53 * if (ejEval(ejid, cmd, NULL) ) { 54 */ 55 if (ejEval(ejid, cmd, result) ) { 49 56 return 0; 50 57 } else { -
c/src/libnetworking/rtems_webserver/wsIntrn.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for information on usage and redistribution 7 * 8 * $Id$ 7 9 */ 8 10 … … 20 22 21 23 /* 22 * Define this to enable log in of web accesses to a file24 * Define this to enable logging of web accesses to a file 23 25 * #define WEBS_LOG_SUPPORT 1 24 26 * … … 47 49 #include <stdarg.h> 48 50 49 #if WIN 50 #include <fcntl.h> 51 #include <sys/stat.h> 51 #ifdef NETWARE 52 #include <fcntl.h> 53 #include <sys/stat.h> 54 #include <signal.h> 52 55 #include <io.h> 53 56 #endif 54 57 55 #if CE 56 #if ! UEMF 58 #ifdef WIN 59 #include <fcntl.h> 60 #include <sys/stat.h> 57 61 #include <io.h> 58 62 #endif 59 #endif 60 61 #if NW 62 #include <fcntl.h> 63 #include <sys/stat.h> 64 #endif 65 66 #if SCOV5 63 64 #ifdef CE 65 #ifndef UEMF 66 #include <io.h> 67 #endif 68 #endif 69 70 #ifdef NW 71 #include <fcntl.h> 72 #include <sys/stat.h> 73 #endif 74 75 #ifdef SCOV5 67 76 #include <fcntl.h> 68 77 #include <sys/stat.h> … … 71 80 #endif 72 81 73 #if LYNX82 #ifdef LYNX 74 83 #include <fcntl.h> 75 84 #include <sys/stat.h> … … 78 87 #endif 79 88 80 #if UNIX89 #ifdef UNIX 81 90 #include <fcntl.h> 82 91 #include <sys/stat.h> … … 85 94 #endif 86 95 87 #if QNX496 #ifdef QNX4 88 97 #include <fcntl.h> 89 98 #include <sys/stat.h> … … 93 102 #endif 94 103 95 #if UW96 #include <fcntl.h> 97 #include <sys/stat.h> 98 #endif 99 100 #if VXWORKS104 #ifdef UW 105 #include <fcntl.h> 106 #include <sys/stat.h> 107 #endif 108 109 #ifdef VXWORKS 101 110 #include <vxWorks.h> 102 111 #include <fcntl.h> … … 104 113 #endif 105 114 106 #if SOLARIS115 #ifdef SOLARIS 107 116 #include <macros.h> 108 117 #include <fcntl.h> … … 110 119 #endif 111 120 112 #if UEMF121 #ifdef UEMF 113 122 #include "uemf.h" 114 123 #include "ejIntrn.h" … … 135 144 #define MAX_PORT_LEN 10 /* max digits in port number */ 136 145 #define WEBS_SYM_INIT 64 /* initial # of sym table entries */ 137 #define WEBS_VERSION_STR T("2.1.3") /* version of web server s/w */138 146 139 147 /* … … 202 210 typedef struct { 203 211 char_t *path; /* Web page URL path */ 204 constunsigned char *page; /* Web page data */212 unsigned char *page; /* Web page data */ 205 213 int size; /* Size of web page in bytes */ 206 214 int pos; /* Current read position */ … … 286 294 * GoAhead Embedded Management Framework (EMF) 287 295 */ 288 #if EMF296 #ifdef EMF 289 297 extern int websEmfOpen(); 290 298 extern void websEmfClose(); … … 292 300 #endif 293 301 294 #if CE302 #ifdef CE 295 303 extern int writeUniToAsc(int fid, void *buf, unsigned int len); 296 304 extern int readAscToUni(int fid, void **buf, unsigned int len); -
cpukit/httpd/NOTES
r2f73363 ree3afa2 3 3 # 4 4 5 Notes on merging GoAhead Webs 2.1. Eventually RTEMS should be supported5 Notes on merging GoAhead Webs 2.1.4. Eventually RTEMS should be supported 6 6 in their distributions and this directory removed. 7 7 … … 10 10 Obtain the original distribution from http://www.goahead.com for 11 11 documentation. 12 13 Porting 14 ======= 15 - added rtems complier flags to uemf.h and misc.c 16 - following source files are distributed with the web server 17 but not currently used by RTEMS 18 [cgi.c, sockGen.c, umui.c, websSSL.c, websda.c] 12 19 13 20 Tailoring -
cpukit/httpd/asp.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 -
cpukit/httpd/balloc.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 27 29 #define IN_BALLOC 28 30 29 #if UEMF31 #ifdef UEMF 30 32 #include "uemf.h" 31 33 #else … … 36 38 #include <stdlib.h> 37 39 38 #if !NO_BALLOC40 #ifndef NO_BALLOC 39 41 /********************************* Defines ************************************/ 40 42 … … 42 44 * Define B_STATS if you wish to track memory block and stack usage 43 45 */ 44 #if B_STATS46 #ifdef B_STATS 45 47 /* 46 48 * Optional statistics … … 108 110 /*************************** Forward Declarations *****************************/ 109 111 110 #if B_STATS112 #ifdef B_STATS 111 113 static void bStatsAlloc(B_ARGS_DEC, void *ptr, int q, int size); 112 114 static void bStatsFree(B_ARGS_DEC, void *ptr, int q, int size); … … 115 117 #endif /* B_STATS */ 116 118 117 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD119 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 118 120 static void bFillBlock(void *buf, int bufsize); 119 121 #endif 120 122 121 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD123 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 122 124 static void verifyUsedBlock(bType *bp, int q); 123 125 static void verifyFreeBlock(bType *bp, int q); … … 142 144 bFlags = flags; 143 145 144 #if BASTARD_TESTING146 #ifdef BASTARD_TESTING 145 147 srand(time(0L)); 146 148 #endif /* BASTARD_TESTING */ … … 164 166 return -1; 165 167 } 166 #if B_STATS168 #ifdef B_STATS 167 169 bStatsMemMalloc += bufsize; 168 170 #endif … … 174 176 bFreeBuf = bFreeNext = buf; 175 177 memset(bQhead, 0, sizeof(bQhead)); 176 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD178 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 177 179 bFillBlock(buf, bufsize); 178 180 #endif 179 #if B_STATS181 #ifdef B_STATS 180 182 bStackStart = &buf; 181 183 #endif 182 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD184 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 183 185 verifyFreeBlock(buf, bufsize); 184 186 #endif … … 193 195 void bclose() 194 196 { 195 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD197 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 196 198 verifyBallocSpace(); 197 199 #endif … … 221 223 } 222 224 } 223 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD225 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 224 226 verifyBallocSpace(); 225 227 #endif … … 228 230 } 229 231 230 #if BASTARD_TESTING232 #ifdef BASTARD_TESTING 231 233 if (rand() == 0x7fff) { 232 234 return NULL; … … 242 244 */ 243 245 if (bFlags & B_USE_MALLOC) { 244 #if B_STATS246 #ifdef B_STATS 245 247 bstats(0, NULL); 246 248 #endif … … 253 255 return NULL; 254 256 } 255 #if B_STATS257 #ifdef B_STATS 256 258 bStatsMemMalloc += memSize; 257 259 #endif 258 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD260 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 259 261 bFillBlock(bp, memSize); 260 262 #endif … … 276 278 */ 277 279 bQhead[q] = bp->u.next; 278 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD280 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 279 281 verifyFreeBlock(bp, q); 280 282 #endif 281 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD283 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 282 284 bFillBlock(bp, memSize); 283 285 #endif … … 292 294 */ 293 295 bp = (bType*) bFreeNext; 294 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD296 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 295 297 verifyFreeBlock(bp, q); 296 298 #endif 297 299 bFreeNext += memSize; 298 300 bFreeLeft -= memSize; 299 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD301 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 300 302 bFillBlock(bp, memSize); 301 303 #endif … … 304 306 305 307 } else if (bFlags & B_USE_MALLOC) { 306 #if B_STATS308 #ifdef B_STATS 307 309 static int once = 0; 308 310 if (once++ == 0) { … … 320 322 return NULL; 321 323 } 322 #if B_STATS324 #ifdef B_STATS 323 325 bStatsMemMalloc += memSize; 324 326 #endif 325 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD327 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 326 328 bFillBlock(bp, memSize); 327 329 #endif … … 335 337 } 336 338 337 #if B_STATS339 #ifdef B_STATS 338 340 bStatsAlloc(B_ARGS, bp, q, memSize); 339 341 #endif … … 345 347 */ 346 348 #if 0 347 #if B_STATS349 #ifdef B_STATS 348 350 if (bStatsBallocInUse == bStatsBallocMax) { 349 351 bstats(0, NULL); … … 366 368 int q, memSize; 367 369 368 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD370 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 369 371 verifyBallocSpace(); 370 372 #endif … … 379 381 memSize = ballocGetSize(bp->u.size, &q); 380 382 381 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD383 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 382 384 verifyUsedBlock(bp,q); 383 385 #endif 384 #if B_STATS386 #ifdef B_STATS 385 387 bStatsFree(B_ARGS, bp, q, bp->u.size+sizeof(bType)); 386 388 #endif … … 390 392 } 391 393 392 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD394 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 393 395 bFillBlock(bp, memSize); 394 396 #endif … … 416 418 417 419 /******************************************************************************/ 418 #if UNICODE420 #ifdef UNICODE 419 421 /* 420 422 * Duplicate a string, allow NULL pointers and then dup an empty string. … … 511 513 512 514 /******************************************************************************/ 513 #if B_FILL || B_VERIFY_CAUSES_SEVERE_OVERHEAD515 #if (defined (B_FILL) || defined (B_VERIFY_CAUSES_SEVERE_OVERHEAD)) 514 516 /* 515 517 * Fill the block (useful during development to catch zero fill assumptions) … … 523 525 524 526 /******************************************************************************/ 525 #if B_STATS527 #ifdef B_STATS 526 528 /* 527 529 * Statistics. Do output via calling the writefn callback function with … … 817 819 818 820 /******************************************************************************/ 819 #if B_VERIFY_CAUSES_SEVERE_OVERHEAD821 #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD 820 822 /* 821 823 * The following routines verify the integrity of the balloc memory space. … … 937 939 char_t *bstrdupNoBalloc(char_t *s) 938 940 { 939 #if UNICODE941 #ifdef UNICODE 940 942 if (s) { 941 943 return wcsdup(s); -
cpukit/httpd/default.c
r2f73363 ree3afa2 85 85 * Open the document. Stat for later use. 86 86 */ 87 if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, 88 0666) < 0) { 89 websError(wp, 400, 90 T("Cannot open URL <b>%s</b>"), url); 91 return 1; 92 } 93 if (websPageStat(wp, lpath, path, &sbuf) < 0) { 94 websError(wp, 400, T("Cannot stat page for URL <b>%s</b>"), 95 url); 96 return 1; 97 } 87 if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, 88 0666) < 0) { 89 websError(wp, 400, T("Cannot open URL <b>%s</b>"), url); 90 return 1; 91 } 92 93 if (websPageStat(wp, lpath, path, &sbuf) < 0) { 94 websError(wp, 400, T("Cannot stat page for URL <b>%s</b>"), url); 95 return 1; 96 } 98 97 99 98 /* … … 103 102 */ 104 103 websStats.localHits++; 105 #if WEBS_IF_MODIFIED_SUPPORT104 #ifdef WEBS_IF_MODIFIED_SUPPORT 106 105 if (flags & WEBS_IF_MODIFIED && !(flags & WEBS_ASP)) { 107 106 if (sbuf.mtime <= wp->since) { … … 228 227 len = npart = 0; 229 228 parts[0] = NULL; 229 230 /* 231 * 22 Jul 02 -- there were reports that a directory traversal exploit was 232 * possible in the WebServer running under Windows if directory paths 233 * outside the server's specified root web were given by URL-encoding the 234 * backslash character, like: 235 * 236 * GoAhead is vulnerable to a directory traversal bug. A request such as 237 * 238 * GoAhead-server/../../../../../../../ results in an error message 239 * 'Cannot open URL'. 240 241 * However, by encoding the '/' character, it is possible to break out of 242 * the 243 * web root and read arbitrary files from the server. 244 * Hence a request like: 245 * 246 * GoAhead-server/..%5C..%5C..%5C..%5C..%5C..%5C/winnt/win.ini returns the 247 * contents of the win.ini file. 248 * (Note that the description uses forward slashes (0x2F), but the example 249 * uses backslashes (0x5C). In my tests, forward slashes are correctly 250 * trapped, but backslashes are not. The code below substitutes forward 251 * slashes for backslashes before attempting to validate that there are no 252 * unauthorized paths being accessed. 253 */ 254 token = gstrchr(path, '\\'); 255 while (token != NULL) 256 { 257 *token = '/'; 258 token = gstrchr(token, '\\'); 259 } 260 230 261 token = gstrtok(path, T("/")); 231 262 … … 285 316 flags = websGetRequestFlags(wp); 286 317 287 webs MarkTime(wp);318 websSetTimeMark(wp); 288 319 289 320 wrote = bytes = 0; … … 301 332 if ((buf = balloc(B_L, PAGE_READ_BUFSIZE)) == NULL) { 302 333 websError(wp, 200, T("Can't get memory")); 303 } 304 else { 334 } else { 305 335 while ((len = websPageReadData(wp, buf, PAGE_READ_BUFSIZE)) > 0) { 306 336 if ((wrote = websWriteDataNonBlock(wp, buf, len)) < 0) { -
cpukit/httpd/ej.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for information on usage and redistribution 7 * 8 * $Id$ 7 9 */ 8 10 … … 19 21 /********************************* Includes ***********************************/ 20 22 21 #if !UEMF23 #ifndef UEMF 22 24 #include "basic/basic.h" 23 25 #include "emf/emf.h" -
cpukit/httpd/ejIntrn.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for information on usage and redistribution 7 * 8 * $Id$ 7 9 */ 8 10 … … 23 25 #include <stdlib.h> 24 26 25 #if CE26 #if !UEMF27 #ifdef CE 28 #ifndef UEMF 27 29 #include <io.h> 28 30 #endif 29 31 #endif 30 32 31 #if LYNX33 #ifdef LYNX 32 34 #include <unistd.h> 33 35 #endif … … 37 39 #endif 38 40 39 #if UEMF41 #ifdef UEMF 40 42 #include "uemf.h" 41 43 #else -
cpukit/httpd/ejlex.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 18 20 #include "ejIntrn.h" 19 21 20 #if UEMF22 #ifdef UEMF 21 23 #include "uemf.h" 22 24 #else … … 195 197 { 196 198 ep->tid = getLexicalToken(ep, state); 199 /* 200 * commented out 04 Apr 02 Bg Porter -- we found a case where very long 201 * arguments to write() were being corrupted downstream in the trace call 202 * (the ep->token pointer was being overwritten with the trace message. 203 * restore this if it's useful for your debugging. 197 204 trace(9, T("ejGetToken: %d, \"%s\"\n"), ep->tid, ep->token); 205 */ 198 206 return ep->tid; 199 207 } -
cpukit/httpd/ejparse.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 18 20 #include "ejIntrn.h" 19 21 20 #if CE22 #ifdef CE 21 23 #include "CE/wincompat.h" 22 24 #endif … … 99 101 ejSetGlobalVar(ep->eid, T("null"), NULL); 100 102 101 #if EMF103 #ifdef EMF 102 104 ejEmfOpen(ep->eid); 103 105 #endif … … 119 121 } 120 122 121 #if EMF123 #ifdef EMF 122 124 ejEmfClose(eid); 123 125 #endif -
cpukit/httpd/emfdb.c
r2f73363 ree3afa2 663 663 if (pLineOut) { 664 664 len = gstrlen(pLineOut); 665 #if CE665 #ifdef CE 666 666 rc = writeUniToAsc(fd, pLineOut, len); 667 667 #else … … 854 854 */ 855 855 buf = balloc(B_L, sbuf.st_size + 1); 856 #if CE856 #ifdef CE 857 857 if (readAscToUni(fd, &buf, sbuf.st_size) != (int)sbuf.st_size) { 858 858 #else … … 1020 1020 int len; 1021 1021 1022 if (basicProdDir != NULL) { 1023 1022 if (basicProdDir != NULL) { 1023 bfree(B_L, basicProdDir); 1024 1024 } 1025 1025 -
cpukit/httpd/emfdb.h
r2f73363 ree3afa2 19 19 #define _h_EMFDB 1 20 20 21 #if !UEMF21 #ifndef UEMF 22 22 #include "basic/basic.h" 23 23 #include "emf/emf.h" -
cpukit/httpd/form.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 -
cpukit/httpd/h.c
r2f73363 ree3afa2 4 4 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. 5 5 * See the file "license.txt" for usage and redistribution license requirements 6 * 7 * $Id$ 6 8 */ 7 9 … … 16 18 /********************************* Includes ***********************************/ 17 19 18 #if UEMF20 #ifdef UEMF 19 21 #include "uemf.h" 20 22 #else … … 42 44 */ 43 45 44 #if B_STATS46 #ifdef B_STATS 45 47 int HALLOC(B_ARGS_DEC, void ***map) 46 48 #else … … 56 58 incr = H_INCR; 57 59 memsize = (incr + H_OFFSET) * sizeof(void**); 58 #if B_STATS60 #ifdef B_STATS 59 61 if ((mp = (int*) balloc(B_ARGS, memsize)) == NULL) { 60 62 #else … … 149 151 */ 150 152 151 #if B_STATS153 #ifdef B_STATS 152 154 int HALLOCENTRY(B_ARGS_DEC, void ***list, int *max, int size) 153 155 #else … … 161 163 a_assert(max); 162 164 163 #if B_STATS165 #ifdef B_STATS 164 166 if ((id = HALLOC(B_ARGS, (void***) list)) < 0) { 165 167 #else … … 170 172 171 173 if (size > 0) { 172 #if B_STATS174 #ifdef B_STATS 173 175 if ((cp = balloc(B_ARGS, size)) == NULL) { 174 176 #else -
cpukit/httpd/handler.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 26 28 /**************************** Forward Declarations ****************************/ 27 29 28 static int websUrlHandlerSort(const void *p1, const void *p2);29 static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,30 static int websUrlHandlerSort(const void *p1, const void *p2); 31 static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, 30 32 int sid, char_t *url, char_t *path, char_t *query); 31 static int websTidyUrl(webs_t wp);33 static char_t *websCondenseMultipleChars(char_t *strToCondense, char_t cCondense); 32 34 33 35 /*********************************** Code *************************************/ … … 257 259 websSetRequestPath(wp, websGetDefaultDir(), NULL); 258 260 259 websTidyUrl(wp); 261 /* 262 * Eliminate security hole 263 */ 264 websCondenseMultipleChars(wp->path, '/'); 265 websCondenseMultipleChars(wp->url, '/'); 260 266 261 267 /* … … 293 299 } 294 300 301 #ifdef OBSOLETE_CODE 295 302 296 303 /******************************************************************************/ … … 359 366 } 360 367 361 /******************************************************************************/ 368 #endif 369 370 /******************************************************************************/ 371 /* 372 * Convert multiple adjacent occurrences of a given character to a single 373 * instance. 374 */ 375 376 static char_t *websCondenseMultipleChars(char_t *strToCondense, char_t cCondense) 377 { 378 if (strToCondense != NULL) { 379 char_t *pStr, *pScan; 380 381 pStr = pScan = strToCondense; 382 383 while (*pScan && *pStr) { 384 /* 385 * Advance scan pointer over multiple occurences of condense character 386 */ 387 while ((*pScan == cCondense) && (*(pScan + 1) == cCondense)) { 388 pScan++; 389 } 390 /* 391 * Copy character if an advance of the scan pointer has occurred 392 */ 393 if (pStr != pScan) { 394 *pStr = *pScan; 395 } 396 397 pScan++; 398 pStr++; 399 } 400 /* 401 * Zero terminate string if multiple adjacent characters were found and condensed 402 */ 403 if (pStr != pScan) { 404 *pStr = 0; 405 } 406 } 407 408 return strToCondense; 409 } 410 411 /******************************************************************************/ -
cpukit/httpd/license.txt
r2f73363 ree3afa2 1 1 License Agreement 2 2 3 THIS LICENSE ALLOWS ONLY THE LIMITED USE OF GO AHEAD SOFTWARE, INC. PROPRIETARY CODE. PLEASE CAREFULLY READ THIS AGREEMENT AS IT PERTAINS TO THIS LICENSE, YOU CERTIFY THAT YOU WILL USE THE SOFTWARE ONLY IN THE MANNER PERMITTED HEREIN. 3 THIS LICENSE ALLOWS ONLY THE LIMITED USE OF GO AHEAD SOFTWARE, 4 INC. PROPRIETARY CODE. PLEASE CAREFULLY READ THIS AGREEMENT AS IT 5 PERTAINS TO THIS LICENSE, YOU CERTIFY THAT YOU WILL USE THE SOFTWARE 6 ONLY IN THE MANNER PERMITTED HEREIN. 4 7 5 8 1. Definitions. 6 9 7 1.1 "Documentation" means any documentation GoAhead includes with the Original Code. 10 1.1 "Documentation" means any documentation GoAhead includes with the 11 Original Code. 8 12 9 13 1.2 "GoAhead" means Go Ahead Software, Inc. 10 14 11 1.3 "Intellectual Property Rights" means all rights, whether now existing or hereinafter acquired, in and to trade secrets, patents, copyrights, trademarks, know-how, as well as moral rights and similar rights of any type under the laws of any governmental authority, domestic or foreign, including rights in and to all applications and registrations relating to any of the foregoing. 15 1.3 "Intellectual Property Rights" means all rights, whether now existing 16 or hereinafter acquired, in and to trade secrets, patents, copyrights, 17 trademarks, know-how, as well as moral rights and similar rights of any 18 type under the laws of any governmental authority, domestic or foreign, 19 including rights in and to all applications and registrations relating 20 to any of the foregoing. 12 21 13 22 1.4 "License" or "Agreement" means this document. 14 23 15 1.5 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. 16 17 1.6 "Original Code" means the Source Code to GoAheads proprietary computer software entitled GoAhead WebServer. 18 19 1.7 "Response Header" means the first portion of the response message output by the GoAhead WebServer, containing but not limited to, header fields for date, content-type, server identification and cache control. 20 21 1.8 "Server Identification Field" means the field in the Response Header which contains the text "Server: GoAhead-Webs". 22 23 1.9 "You" means an individual or a legal entity exercising rights under, and complying with all of the terms of, this license or a future version of this license. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity. 24 1.5 "Modifications" means any addition to or deletion from the substance 25 or structure of either the Original Code or any previous Modifications. 26 27 1.6 "Original Code" means the Source Code to GoAheads proprietary 28 computer software entitled GoAhead WebServer. 29 30 1.7 "Response Header" means the first portion of the response message 31 output by the GoAhead WebServer, containing but not limited to, header 32 fields for date, content-type, server identification and cache control. 33 34 1.8 "Server Identification Field" means the field in the Response Header 35 which contains the text "Server: GoAhead-Webs". 36 37 1.9 "You" means an individual or a legal entity exercising rights under, 38 and complying with all of the terms of, this license or a future version 39 of this license. For legal entities, "You" includes any entity which 40 controls, is controlled by, or is under common control with You. For 41 purposes of this definition, "control" means (a) the power, direct or 42 indirect, to cause the direction or management of such entity, whether 43 by contract or otherwise, or (b) ownership of fifty percent (50%) or 44 more of the outstanding shares or beneficial ownership of such entity. 24 45 25 46 2. Source Code License. … … 27 48 2.1 Limited Source Code Grant. 28 49 29 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims, to use, reproduce, modify, copy and distribute the Original Code. 50 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive 51 license, subject to third party intellectual property claims, to use, 52 reproduce, modify, copy and distribute the Original Code. 30 53 31 54 2.2 Binary Code. 32 55 33 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive license to copy and distribute the binary code versions of the Original Code together with Your Modifications. 56 GoAhead hereby grants You a world-wide, royalty-free, non-exclusive 57 license to copy and distribute the binary code versions of the Original 58 Code together with Your Modifications. 34 59 35 60 2.3 License Back to GoAhead. 36 61 37 You hereby grant in both source code and binary code to GoAhead a world-wide, royalty-free, non-exclusive license to copy, modify, display, use and sublicense any Modifications You make that are distributed or planned for distribution. Within 30 days of either such event, You agree to ship to GoAhead a file containing the Modifications (in a media to be determined by the parties), including any programmers notes and other programmers materials. Additionally, You will provide to GoAhead a complete description of the product, the product code or model number, the date on which the product is initially shipped, and a contact name, phone number and e-mail address for future correspondence. GoAhead will keep confidential all data specifically marked as such. 62 You hereby grant in both source code and binary code to GoAhead a 63 world-wide, royalty-free, non-exclusive license to copy, modify, display, 64 use and sublicense any Modifications You make that are distributed or 65 planned for distribution. Within 30 days of either such event, You 66 agree to ship to GoAhead a file containing the Modifications (in a media 67 to be determined by the parties), including any programmers notes and 68 other programmers materials. Additionally, You will provide to GoAhead 69 a complete description of the product, the product code or model number, 70 the date on which the product is initially shipped, and a contact name, 71 phone number and e-mail address for future correspondence. GoAhead will 72 keep confidential all data specifically marked as such. 38 73 39 74 2.4 Restrictions on Use. 40 75 41 You may sublicense Modifications to third parties such as subcontractors or OEM's provided that You enter into license agreements with such third parties that bind such third parties to all the obligations under this Agreement applicable to you and that are otherwise substantially similar in scope and application to this Agreement. 76 You may sublicense Modifications to third parties such as subcontractors 77 or OEM's provided that You enter into license agreements with such third 78 parties that bind such third parties to all the obligations under this 79 Agreement applicable to you and that are otherwise substantially similar 80 in scope and application to this Agreement. 42 81 43 82 3. Term. 44 83 45 This Agreement and license are effective from the time You accept the terms of this Agreement until this Agreement is terminated. You may terminate this Agreement at any time by uninstalling or destroying all copies of the Original Code including any and all binary versions and removing any Modifications to the Original Code existing in any products. This Agreement will terminate immediately and without further notice if You fail to comply with any provision of this Agreement. All restrictions on use, and all other provisions that may reasonably be interpreted to survive termination of this Agreement, will survive termination of this Agreement for any reason. Upon termination, You agree to uninstall or destroy all copies of the Original Code, Modifications, and Documentation. 84 This Agreement and license are effective from the time You accept the 85 terms of this Agreement until this Agreement is terminated. You may 86 terminate this Agreement at any time by uninstalling or destroying 87 all copies of the Original Code including any and all binary versions 88 and removing any Modifications to the Original Code existing in any 89 products. This Agreement will terminate immediately and without further 90 notice if You fail to comply with any provision of this Agreement. All 91 restrictions on use, and all other provisions that may reasonably 92 be interpreted to survive termination of this Agreement, will survive 93 termination of this Agreement for any reason. Upon termination, You agree 94 to uninstall or destroy all copies of the Original Code, Modifications, 95 and Documentation. 46 96 47 97 4. Trademarks and Brand. … … 49 99 4.1 License and Use. 50 100 51 GoAhead hereby grants to You a limited world-wide, royalty-free, non-exclusive license to use the GoAhead trade names, trademarks, logos, service marks and product designations posted in Exhibit A (collectively, the "GoAhead Marks") in connection with the activities by You under this Agreement. Additionally, GoAhead grants You a license under the terms above to such GoAhead trademarks as shall be identified at a URL (the "URL") provided by GoAhead. The use by You of GoAhead Marks shall be in accordance with GoAheads trademark policies regarding trademark usage as established at the web site designated by the URL, or as otherwise communicated to You by GoAhead at its sole discretion. You understand and agree that any use of GoAhead Marks in connection with this Agreement shall not create any right, title or interest in or to such GoAhead Marks and that all such use and goodwill associated with GoAhead Marks will inure to the benefit of GoAhead. 101 GoAhead hereby grants to You a limited world-wide, royalty-free, 102 non-exclusive license to use the GoAhead trade names, trademarks, logos, 103 service marks and product designations posted in Exhibit A (collectively, 104 the "GoAhead Marks") in connection with the activities by You under this 105 Agreement. Additionally, GoAhead grants You a license under the terms 106 above to such GoAhead trademarks as shall be identified at a URL (the 107 "URL") provided by GoAhead. The use by You of GoAhead Marks shall be in 108 accordance with GoAheads trademark policies regarding trademark usage 109 as established at the web site designated by the URL, or as otherwise 110 communicated to You by GoAhead at its sole discretion. You understand and 111 agree that any use of GoAhead Marks in connection with this Agreement 112 shall not create any right, title or interest in or to such GoAhead 113 Marks and that all such use and goodwill associated with GoAhead Marks 114 will inure to the benefit of GoAhead. 52 115 53 116 4.2 Promotion by You of GoAhead WebServer Mark. 54 117 55 In consideration for the licenses granted by GoAhead to You herein, You agree to notify GoAhead when You incorporate the GoAhead WebServer in Your product and to inform GoAhead when such product begins to ship. You agree to promote the Original Code by prominently and visibly displaying a graphic of the GoAhead WebServer mark on the initial web page of Your product that is displayed each time a user connects to it. You also agree that GoAhead may identify your company as a user of the GoAhead WebServer in conjunction with its own marketing efforts. You may further promote the Original Code by displaying the GoAhead WebServer mark in marketing and promotional materials such as the home page of your web site or web pages promoting the product. 118 In consideration for the licenses granted by GoAhead to You herein, You 119 agree to notify GoAhead when You incorporate the GoAhead WebServer in 120 Your product and to inform GoAhead when such product begins to ship. You 121 agree to promote the Original Code by prominently and visibly displaying 122 a graphic of the GoAhead WebServer mark on the initial web page of Your 123 product that is displayed each time a user connects to it. You also agree 124 that GoAhead may identify your company as a user of the GoAhead WebServer 125 in conjunction with its own marketing efforts. You may further promote 126 the Original Code by displaying the GoAhead WebServer mark in marketing 127 and promotional materials such as the home page of your web site or web 128 pages promoting the product. 56 129 57 130 4.3 Placement of Copyright Notice by You. 58 131 59 You agree to include copies of the following notice (the "Notice") regarding proprietary rights in all copies of the products that You distribute, as follows: (i) embedded in the object code; and (ii) on the title pages of all documentation. Furthermore, You agree to use commercially reasonable efforts to cause any licensees of your products to embed the Notice in object code and on the title pages or relevant documentation. The Notice is as follows: Copyright (c) 20xx GoAhead Software, Inc. All Rights Reserved. Unless GoAhead otherwise instructs, the year 20xx is to be replaced with the year during which the release of the Original Code containing the notice is issued by GoAhead. If this year is not supplied with Documentation, GoAhead will supply it upon request. 132 You agree to include copies of the following notice (the "Notice") 133 regarding proprietary rights in all copies of the products that You 134 distribute, as follows: (i) embedded in the object code; and (ii) on 135 the title pages of all documentation. Furthermore, You agree to use 136 commercially reasonable efforts to cause any licensees of your products 137 to embed the Notice in object code and on the title pages or relevant 138 documentation. The Notice is as follows: Copyright (c) 20xx GoAhead 139 Software, Inc. All Rights Reserved. Unless GoAhead otherwise instructs, 140 the year 20xx is to be replaced with the year during which the release of 141 the Original Code containing the notice is issued by GoAhead. If this year 142 is not supplied with Documentation, GoAhead will supply it upon request. 60 143 61 144 4.4 No Modifications to Server Identification Field. 62 145 63 You agree not to remove or modify the Server identification Field contained in the Response Header as defined in Section 1.6 and 1.7. 146 You agree not to remove or modify the Server identification Field 147 contained in the Response Header as defined in Section 1.6 and 1.7. 64 148 65 149 5. Warranty Disclaimers. 66 150 67 THE ORIGINAL CODE, THE DOCUMENTATION AND THE MEDIA UPON WHICH THE ORIGINAL CODE IS RECORDED (IF ANY) ARE PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS, STATUTORY OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 68 69 The entire risk as to the quality and performance of the Original Code (including any Modifications You make) and the Documentation is with You. Should the Original Code or the Documentation prove defective, You (and not GoAhead or its distributors, licensors or dealers) assume the entire cost of all necessary servicing or repair. GoAhead does not warrant that the functions contained in the Original Code will meet your requirements or operate in the combination that You may select for use, that the operation of the Original Code will be uninterrupted or error free, or that defects in the Original Code will be corrected. No oral or written statement by GoAhead or by a representative of GoAhead shall create a warranty or increase the scope of this warranty. 70 71 GOAHEAD DOES NOT WARRANT THE ORIGINAL CODE AGAINST INFRINGEMENT OR THE LIKE WITH RESPECT TO ANY COPYRIGHT, PATENT, TRADE SECRET, TRADEMARK OR OTHER PROPRIETARY RIGHT OF ANY THIRD PARTY AND DOES NOT WARRANT THAT THE ORIGINAL CODE DOES NOT INCLUDE ANY VIRUS, SOFTWARE ROUTINE OR OTHER SOFTWARE DESIGNED TO PERMIT UNAUTHORIZED ACCESS, TO DISABLE, ERASE OR OTHERWISE HARM SOFTWARE, HARDWARE OR DATA, OR TO PERFORM ANY OTHER SUCH ACTIONS. 72 73 Any warranties that by law survive the foregoing disclaimers shall terminate ninety (90) days from the date You received the Original Code. 151 THE ORIGINAL CODE, THE DOCUMENTATION AND THE MEDIA UPON WHICH THE ORIGINAL 152 CODE IS RECORDED (IF ANY) ARE PROVIDED "AS IS" AND WITHOUT WARRANTIES OF 153 ANY KIND, EXPRESS, STATUTORY OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 154 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 155 PURPOSE. 156 157 The entire risk as to the quality and performance of the Original Code 158 (including any Modifications You make) and the Documentation is with 159 You. Should the Original Code or the Documentation prove defective, 160 You (and not GoAhead or its distributors, licensors or dealers) assume 161 the entire cost of all necessary servicing or repair. GoAhead does not 162 warrant that the functions contained in the Original Code will meet your 163 requirements or operate in the combination that You may select for use, 164 that the operation of the Original Code will be uninterrupted or error 165 free, or that defects in the Original Code will be corrected. No oral 166 or written statement by GoAhead or by a representative of GoAhead shall 167 create a warranty or increase the scope of this warranty. 168 169 GOAHEAD DOES NOT WARRANT THE ORIGINAL CODE AGAINST INFRINGEMENT OR THE 170 LIKE WITH RESPECT TO ANY COPYRIGHT, PATENT, TRADE SECRET, TRADEMARK 171 OR OTHER PROPRIETARY RIGHT OF ANY THIRD PARTY AND DOES NOT WARRANT 172 THAT THE ORIGINAL CODE DOES NOT INCLUDE ANY VIRUS, SOFTWARE ROUTINE 173 OR OTHER SOFTWARE DESIGNED TO PERMIT UNAUTHORIZED ACCESS, TO DISABLE, 174 ERASE OR OTHERWISE HARM SOFTWARE, HARDWARE OR DATA, OR TO PERFORM ANY 175 OTHER SUCH ACTIONS. 176 177 Any warranties that by law survive the foregoing disclaimers shall 178 terminate ninety (90) days from the date You received the Original Code. 74 179 75 180 6. Limitation of Liability. 76 181 77 YOUR SOLE REMEDIES AND GOAHEAD'S ENTIRE LIABILITY ARE SET FORTH ABOVE. IN NO EVENT WILL GOAHEAD OR ITS DISTRIBUTORS OR DEALERS BE LIABLE FOR DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM THE USE OF THE ORIGINAL CODE, THE INABILITY TO USE THE ORIGINAL CODE, OR ANY DEFECT IN THE ORIGINAL CODE, INCLUDING ANY LOST PROFITS, EVEN IF THEY HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 78 79 You agree that GoAhead and its distributors and dealers will not be LIABLE for defense or indemnity with respect to any claim against You by any third party arising from your possession or use of the Original Code or the Documentation. 80 81 In no event will GoAheads total liability to You for all damages, losses, and causes of action (whether in contract, tort, including negligence, or otherwise) exceed the amount You paid for this product. 82 83 SOME STATES DO NOT ALLOW LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY LASTS, AND SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATIONS OR EXCLUSIONS MAY NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE. 182 YOUR SOLE REMEDIES AND GOAHEAD'S ENTIRE LIABILITY ARE SET FORTH ABOVE. IN 183 NO EVENT WILL GOAHEAD OR ITS DISTRIBUTORS OR DEALERS BE LIABLE FOR 184 DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM 185 THE USE OF THE ORIGINAL CODE, THE INABILITY TO USE THE ORIGINAL CODE, 186 OR ANY DEFECT IN THE ORIGINAL CODE, INCLUDING ANY LOST PROFITS, EVEN IF 187 THEY HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 188 189 You agree that GoAhead and its distributors and dealers will not be 190 LIABLE for defense or indemnity with respect to any claim against You 191 by any third party arising from your possession or use of the Original 192 Code or the Documentation. 193 194 In no event will GoAheads total liability to You for all damages, losses, 195 and causes of action (whether in contract, tort, including negligence, 196 or otherwise) exceed the amount You paid for this product. 197 198 SOME STATES DO NOT ALLOW LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY 199 LASTS, AND SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION 200 OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATIONS OR 201 EXCLUSIONS MAY NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC LEGAL 202 RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE. 84 203 85 204 7. Indemnification by You. 86 205 87 You agree to indemnify and hold GoAhead harmless against any and all claims, losses, damages and costs (including legal expenses and reasonable counsel fees) arising out of any claim of a third party with respect to the contents of the Your products, and any intellectual property rights or other rights or interests related thereto. 206 You agree to indemnify and hold GoAhead harmless against any and all 207 claims, losses, damages and costs (including legal expenses and reasonable 208 counsel fees) arising out of any claim of a third party with respect to 209 the contents of the Your products, and any intellectual property rights 210 or other rights or interests related thereto. 88 211 89 212 8. High Risk Activities. 90 213 91 The Original Code is not fault-tolerant and is not designed , manufactured or intended for use or resale as online control equipment in hazardous environments requiring fail-safe performance, such as in the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, direct life support machines or weapons systems, in which the failure of the Original Code could lead directly to death, personal injury, or severe physical or environmental damage. GoAhead and its suppliers specifically disclaim any express or implied warranty of fitness for any high risk uses listed above. 214 The Original Code is not fault-tolerant and is not designed , manufactured 215 or intended for use or resale as online control equipment in hazardous 216 environments requiring fail-safe performance, such as in the operation 217 of nuclear facilities, aircraft navigation or communication systems, 218 air traffic control, direct life support machines or weapons systems, 219 in which the failure of the Original Code could lead directly to death, 220 personal injury, or severe physical or environmental damage. GoAhead and 221 its suppliers specifically disclaim any express or implied warranty of 222 fitness for any high risk uses listed above. 92 223 93 224 9. Government Restricted Rights. 94 225 95 For units of the Department of Defense, use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013. Contractor/manufacturer is GoAhead Software, Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, Washington 98004. 96 97 If the Commercial Computer Software Restricted rights clause at FAR 52.227-19 or its successors apply, the Software and Documentation constitute restricted computer software as defined in that clause and the Government shall not have the license for published software set forth in subparagraph (c)(3) of that clause. 98 99 The Original Code (i) was developed at private expense, and no part of it was developed with governmental funds; (ii) is a trade secret of GoAhead (or its licensor(s)) for all purposes of the Freedom of Information Act; (iii) is "restricted computer software" subject to limited utilization as provided in the contract between the vendor and the governmental entity; and (iv) in all respects is proprietary data belonging solely to GoAhead (or its licensor(s)). 226 For units of the Department of Defense, use, duplication, or disclosure 227 by the Government is subject to restrictions as set forth in subparagraph 228 (c)(1)(ii) of the Rights in Technical Data and Computer Software clause 229 at DFARS 252.227-7013. Contractor/manufacturer is GoAhead Software, 230 Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, Washington 98004. 231 232 If the Commercial Computer Software Restricted rights clause at FAR 233 52.227-19 or its successors apply, the Software and Documentation 234 constitute restricted computer software as defined in that clause and 235 the Government shall not have the license for published software set 236 forth in subparagraph (c)(3) of that clause. 237 238 The Original Code (i) was developed at private expense, and no part of it 239 was developed with governmental funds; (ii) is a trade secret of GoAhead 240 (or its licensor(s)) for all purposes of the Freedom of Information Act; 241 (iii) is "restricted computer software" subject to limited utilization as 242 provided in the contract between the vendor and the governmental entity; 243 and (iv) in all respects is proprietary data belonging solely to GoAhead 244 (or its licensor(s)). 100 245 101 246 10. Governing Law and Interpretation. 102 247 103 This Agreement shall be interpreted under and governed by the laws of the State of Washington, without regard to its rules governing the conflict of laws. If any provision of this Agreement is held illegal or unenforceable by a court or tribunal of competent jurisdiction, the remaining provisions of this Agreement shall remain in effect and the invalid provision deemed modified to the least degree necessary to remedy such invalidity. 248 This Agreement shall be interpreted under and governed by the laws of the 249 State of Washington, without regard to its rules governing the conflict of 250 laws. If any provision of this Agreement is held illegal or unenforceable 251 by a court or tribunal of competent jurisdiction, the remaining provisions 252 of this Agreement shall remain in effect and the invalid provision deemed 253 modified to the least degree necessary to remedy such invalidity. 104 254 105 255 11. Entire Agreement. 106 256 107 This Agreement is the complete agreement between GoAhead and You and supersedes all prior agreements, oral or written, with respect to the subject matter hereof. 108 109 If You have any questions concerning this Agreement, You may write to GoAhead Software, Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, Washington 98004 or send e-mail to info@goahead.com. 110 111 BY CLICKING ON THE "Register" BUTTON ON THE REGISTRATION FORM, YOU ACCEPT AND AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS SET FORTH IN THIS AGREEMENT. IF YOU DO NOT WISH TO ACCEPT THIS LICENSE OR YOU DO NOT QUALIFY FOR A LICENSE BASED ON THE TERMS SET FORTH ABOVE, YOU MUST NOT CLICK THE "Register" BUTTON. 257 This Agreement is the complete agreement between GoAhead and You and 258 supersedes all prior agreements, oral or written, with respect to the 259 subject matter hereof. 260 261 If You have any questions concerning this Agreement, You may write to 262 GoAhead Software, Inc., 10900 N.E. 8th Street, Suite 750, Bellevue, 263 Washington 98004 or send e-mail to info@goahead.com. 264 265 BY CLICKING ON THE "Register" BUTTON ON THE REGISTRATION FORM, YOU 266 ACCEPT AND AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS SET 267 FORTH IN THIS AGREEMENT. IF YOU DO NOT WISH TO ACCEPT THIS LICENSE OR 268 YOU DO NOT QUALIFY FOR A LICENSE BASED ON THE TERMS SET FORTH ABOVE, 269 YOU MUST NOT CLICK THE "Register" BUTTON. 112 270 113 271 Exhibit A -
cpukit/httpd/md5.h
r2f73363 ree3afa2 1 1 /* MD5.H - header file for MD5C.C 2 * 3 * $Id$ 2 4 */ 3 5 … … 47 49 48 50 #endif /* _h_MD5 */ 51 -
cpukit/httpd/md5c.c
r2f73363 ree3afa2 1 1 /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm 2 * 3 * $Id$ 2 4 */ 3 5 -
cpukit/httpd/mime.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 23 25 */ 24 26 27 25 28 websMimeType websMimeList[] = { 26 29 { T("application/java"), T(".class") }, … … 33 36 { T("text/css"), T(".css") }, 34 37 { T("text/plain"), T(".txt") }, 38 { T("application/x-javascript"), T(".js") }, 35 39 36 #if MORE_MIME_TYPES40 #ifdef MORE_MIME_TYPES 37 41 { T("application/binary"), T(".exe") }, 38 42 { T("application/compress"), T(".z") }, -
cpukit/httpd/misc.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 9 11 /********************************* Includes ***********************************/ 10 12 11 #if UEMF13 #ifdef UEMF 12 14 #include "uemf.h" 13 15 #else … … 50 52 static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, 51 53 int msize); 54 #if !defined(__rtems__) 55 static int strnlen(char_t *s, unsigned int n); 56 #endif 52 57 static void put_char(strbuf_t *buf, char_t c); 53 58 static void put_string(strbuf_t *buf, char_t *s, int len, … … 59 64 /* 60 65 * "basename" returns a pointer to the last component of a pathname 61 * LINUX and LynxOShave their own basename function62 */ 63 64 #if ! LINUX && ! LYNX && ! __rtems__66 * LINUX, LynxOS and Mac OS X have their own basename function 67 */ 68 69 #if (!defined (LINUX) && !defined (LYNX) && !defined (MACOSX)) 65 70 char_t *basename(char_t *name) 66 71 { 67 72 char_t *cp; 68 73 69 #if NW || WIN74 #if (defined (NW) || defined (WIN)) 70 75 if (((cp = gstrrchr(name, '\\')) == NULL) && 71 76 ((cp = gstrrchr(name, '/')) == NULL)) { … … 83 88 } 84 89 } 85 #endif /* ! LINUX & ! LYNX */90 #endif /* ! LINUX & ! LYNX & ! MACOSX */ 86 91 87 92 /******************************************************************************/ … … 100 105 a_assert(bufsize > 0); 101 106 102 #if WIN || NW107 #if (defined (WIN) || defined (NW)) 103 108 if ((cp = gstrrchr(name, '/')) == NULL && 104 109 (cp = gstrrchr(name, '\\')) == NULL) … … 344 349 } 345 350 } else { 351 /* 04 Apr 02 BgP -- changed so that %X correctly outputs 352 * uppercase hex digits when requested. 346 353 put_ulong(&buf, value, 16, 0, NULL, width, prec, f); 354 */ 355 put_ulong(&buf, value, 16, ('X' == c) , NULL, width, prec, f); 347 356 } 348 357 } … … 409 418 /******************************************************************************/ 410 419 /* 420 * Return the length of a string limited by a given length 421 */ 422 423 #if !defined(__rtems__) 424 static int strnlen(char_t *s, unsigned int n) 425 { 426 unsigned int len; 427 428 len = gstrlen(s); 429 return min(len, n); 430 } 431 #endif 432 433 /******************************************************************************/ 434 /* 411 435 * Add a character to a string buffer 412 436 */ … … 528 552 char_t *ascToUni(char_t *ubuf, char *str, int nBytes) 529 553 { 530 #if UNICODE554 #ifdef UNICODE 531 555 if (MultiByteToWideChar(CP_ACP, 0, str, nBytes / sizeof(char_t), ubuf, 532 556 nBytes / sizeof(char_t)) < 0) { … … 534 558 } 535 559 #else 536 memcpy(ubuf, str, nBytes);560 strncpy(ubuf, str, nBytes); 537 561 #endif 538 562 return ubuf; … … 548 572 char *uniToAsc(char *buf, char_t *ustr, int nBytes) 549 573 { 550 #if UNICODE574 #ifdef UNICODE 551 575 if (WideCharToMultiByte(CP_ACP, 0, ustr, nBytes, buf, nBytes, NULL, 552 576 NULL) < 0) { … … 554 578 } 555 579 #else 556 memcpy(buf, ustr, nBytes);580 strncpy(buf, ustr, nBytes); 557 581 #endif 558 582 return (char*) buf; -
cpukit/httpd/ringq.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 48 50 /********************************* Includes ***********************************/ 49 51 50 #if UEMF52 #ifdef UEMF 51 53 #include "uemf.h" 52 54 #else … … 246 248 247 249 /******************************************************************************/ 248 #if UNICODE250 #ifdef UNICODE 249 251 /* 250 252 * Get a byte from the queue … … 539 541 bfree(B_L, (char*) rq->buf); 540 542 541 #if OLD543 #ifdef OLD 542 544 rq->endp = &newbuf[endp]; 543 545 rq->servp = &newbuf[servp]; -
cpukit/httpd/rom.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 25 27 /******************************** Local Data **********************************/ 26 28 27 #if WEBS_PAGE_ROM29 #ifdef WEBS_PAGE_ROM 28 30 29 31 sym_fd_t romTab; /* Symbol table for web pages */ -
cpukit/httpd/security.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 82 84 #ifdef WEBS_SSL_SUPPORT 83 85 nRet = umGetAccessLimitSecure(accessLimit); 84 if (nRet && ((flags |WEBS_SECURE) == 0)) {86 if (nRet && ((flags & WEBS_SECURE) == 0)) { 85 87 websStats.access++; 86 websError(wp, 200, T("Access Denied\nSecure access is required."));88 websError(wp, 405, T("Access Denied\nSecure access is required.")); 87 89 trace(3, T("SEC: Non-secure access attempted on <%s>\n"), path); 90 /* bugfix 5/24/02 -- we were leaking the memory pointed to by 91 * 'accessLimit'. Thanks to Simon Byholm. 92 */ 93 bfree(B_L, accessLimit); 88 94 return 1; 89 95 } … … 110 116 if (!umUserExists(userid)) { 111 117 websStats.access++; 112 websError(wp, 200, T("Access Denied\nUnknown User"));118 websError(wp, 401, T("Access Denied\nUnknown User")); 113 119 trace(3, T("SEC: Unknown user <%s> attempted to access <%s>\n"), 114 120 userid, path); … … 123 129 if (gstrcmp(password, userpass) != 0) { 124 130 websStats.access++; 125 websError(wp, 200, T("Access Denied\nWrong Password"));131 websError(wp, 401, T("Access Denied\nWrong Password")); 126 132 trace(3, T("SEC: Password fail for user <%s>") 127 133 T("attempt to access <%s>\n"), userid, path); … … 154 160 if (gstrcmp(wp->digest, digestCalc) != 0) { 155 161 websStats.access++; 156 websError(wp, 200, T("Access Denied\nWrong Password"));162 websError(wp, 405, T("Access Denied\nWrong Password")); 157 163 nRet = 1; 158 164 } -
cpukit/httpd/sock.c
r2f73363 ree3afa2 3 3 * 4 4 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. 5 * 6 * $Id$ 5 7 */ 6 8 … … 17 19 #include <stdlib.h> 18 20 19 #if UEMF21 #ifdef UEMF 20 22 #include "uemf.h" 21 23 #else … … 71 73 if ((room = ringqPutBlkMax(rq)) == 0) { 72 74 if (sp->flags & SOCKET_BLOCK) { 73 #if WIN || CE75 #if (defined (WIN) || defined (CE)) 74 76 int errCode; 75 77 if (! socketWaitForEvent(sp, FD_WRITE | SOCKET_WRITABLE, … … 100 102 int socketWriteString(int sid, char_t *buf) 101 103 { 102 #if UNICODE104 #ifdef UNICODE 103 105 char *byteBuf; 104 106 int r, len; … … 248 250 len = ringqLen(lq); 249 251 if (len > 0) { 250 *buf = ballocAscToUni( lq->servp, len);252 *buf = ballocAscToUni((char *)lq->servp, len); 251 253 } else { 252 254 *buf = NULL; … … 299 301 continue; 300 302 } else if (errCode == EWOULDBLOCK || errCode == EAGAIN) { 301 #if WIN || CE303 #if (defined (WIN) || defined (CE)) 302 304 if (sp->flags & SOCKET_BLOCK) { 303 305 int errCode; … … 479 481 *errCode = 0; 480 482 481 #if WIN || CE483 #if (defined (WIN) || defined (CE)) 482 484 if ((sp->flags & SOCKET_ASYNC) 483 485 && ! socketWaitForEvent(sp, FD_CONNECT, errCode)) { … … 491 493 if (sp->flags & SOCKET_BROADCAST) { 492 494 server.sin_family = AF_INET; 493 #if UEMF || LITTLEFOOT495 #if (defined (UEMF) || defined (LITTLEFOOT)) 494 496 server.sin_addr.s_addr = INADDR_BROADCAST; 495 497 #else … … 515 517 if (bytes < 0) { 516 518 *errCode = socketGetError(); 517 #if WIN || CE519 #if (defined (WIN) || defined (CE)) 518 520 sp->currentEvents &= ~FD_WRITE; 519 521 #endif … … 523 525 } else if (bytes == 0 && bytes != toWrite) { 524 526 *errCode = EWOULDBLOCK; 525 #if WIN || CE527 #if (defined (WIN) || defined (CE)) 526 528 sp->currentEvents &= ~FD_WRITE; 527 529 #endif … … 533 535 * more data 534 536 */ 535 #if !UEMF536 #if WIN537 #ifndef UEMF 538 #ifdef WIN 537 539 if (sp->interestEvents & FD_WRITE) { 538 540 emfTime_t blockTime = { 0, 0 }; … … 554 556 struct sockaddr *server) 555 557 { 556 #if VXWORKS558 #ifdef VXWORKS 557 559 char *ptr; 558 560 … … 639 641 recv(sp->sock, buf, sizeof(buf), 0); 640 642 } 641 #if WIN || CE643 #if (defined (WIN) || defined (CE)) 642 644 closesocket(sp->sock); 643 645 #else … … 689 691 int socketGetError() 690 692 { 691 #if WIN || CE693 #if (defined (WIN) || defined (CE)) 692 694 switch (WSAGetLastError()) { 693 695 case WSAEWOULDBLOCK: -
cpukit/httpd/sym.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 17 19 /********************************* Includes ***********************************/ 18 20 19 #if UEMF21 #ifdef UEMF 20 22 #include "uemf.h" 21 23 #else -
cpukit/httpd/uemf.c
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 47 49 if (etype == E_LOG) { 48 50 fmtAlloc(&buf, E_MAX_ERROR, T("%s\n"), fmtBuf); 49 #if DEV 51 /*#ifdef DEV*/ 50 52 } else if (etype == E_ASSERT) { 51 53 fmtAlloc(&buf, E_MAX_ERROR, 52 54 T("Assertion %s, failed at %s %d\n"), fmtBuf, E_ARGS); 53 #endif 55 /*#endif*/ 54 56 } else if (etype == E_USER) { 55 57 fmtAlloc(&buf, E_MAX_ERROR, T("%s\n"), fmtBuf); 56 58 } 59 /* 60 * bugfix -- if etype is not E_LOG, E_ASSERT, or E_USER, the call to 61 * bfreeSafe(B_L, buf) below will fail, because 'buf' is randomly 62 * initialized. To be nice, we format a message saying that this is an 63 * unknown message type, and in doing so give buf a valid value. Thanks 64 * to Simon Byholm. 65 */ 66 else { 67 fmtAlloc(&buf, E_MAX_ERROR, T("Unknown error")); 68 } 57 69 va_end(args); 58 70 -
cpukit/httpd/uemf.h
r2f73363 ree3afa2 5 5 * 6 6 * See the file "license.txt" for usage and redistribution license requirements 7 * 8 * $Id$ 7 9 */ 8 10 … … 18 20 /******************************* Per O/S Includes *****************************/ 19 21 20 #if WIN22 #ifdef WIN 21 23 #include <direct.h> 22 24 #include <io.h> … … 34 36 #endif /* WIN */ 35 37 36 #if CE 38 #ifdef CE 39 #include <errno.h> 37 40 #include <limits.h> 38 41 #include <tchar.h> 39 42 #include <windows.h> 43 #include <winsock.h> 40 44 #include <winnls.h> 41 45 #include "CE/wincompat.h" … … 43 47 #endif /* CE */ 44 48 45 #if NW 49 #ifdef NW 50 #include <direct.h> 51 #include <io.h> 52 #include <sys/stat.h> 53 #include <time.h> 54 #include <sys/types.h> 46 55 #include <stdio.h> 56 #include <stdlib.h> 57 #include <fcntl.h> 58 #include <errno.h> 59 #include <niterror.h> 60 #define EINTR EINUSE 61 #define WEBS 1 62 #include <limits.h> 63 #include <netdb.h> 64 #include <process.h> 65 #include <tiuser.h> 66 #include <sys/time.h> 67 #include <arpa/inet.h> 68 #include <sys/types.h> 69 #include <sys/socket.h> 70 #include <sys/filio.h> 71 #include <netinet/in.h> 47 72 #endif /* NW */ 48 73 49 #if SCOV574 #ifdef SCOV5 50 75 #include <sys/types.h> 51 76 #include <stdio.h> … … 57 82 #endif /* SCOV5 */ 58 83 59 #if UNIX84 #ifdef UNIX 60 85 #include <stdio.h> 61 86 #endif /* UNIX */ … … 79 104 #endif /* LINUX */ 80 105 81 #if LYNX106 #ifdef LYNX 82 107 #include <limits.h> 83 108 #include <stdarg.h> … … 94 119 #endif /* LYNX */ 95 120 96 #if UW 121 #ifdef MACOSX 122 #include <sys/stat.h> 123 #include <stdio.h> 124 #include <stdlib.h> 125 #include <unistd.h> 126 #include <sys/socket.h> 127 #include <netinet/in.h> 128 #include <arpa/inet.h> 129 #include <netdb.h> 130 #include <fcntl.h> 131 #include <errno.h> 132 #endif /* MACOSX */ 133 134 #ifdef UW 97 135 #include <stdio.h> 98 136 #endif /* UW */ 99 137 100 #if VXWORKS138 #ifdef VXWORKS 101 139 #include <vxWorks.h> 102 140 #include <sockLib.h> … … 112 150 #endif /* VXWORKS */ 113 151 114 #if SOLARIS152 #ifdef SOLARIS 115 153 #include <sys/types.h> 116 154 #include <limits.h> … … 128 166 #endif /* SOLARIS */ 129 167 130 #if QNX4168 #ifdef QNX4 131 169 #include <sys/types.h> 132 170 #include <stdio.h> … … 142 180 #endif /* QNX4 */ 143 181 144 #if ECOS182 #ifdef ECOS 145 183 #include <limits.h> 146 184 #include <cyg/infra/cyg_type.h> … … 157 195 #include <string.h> 158 196 159 #if !WEBS197 #ifndef WEBS 160 198 #include "messages.h" 161 199 #endif /* ! WEBS */ … … 167 205 #endif 168 206 169 #if UW207 #ifdef UW 170 208 #define __NO_PACK 1 171 209 #endif /* UW */ 172 210 173 #if SCOV5 || VXWORKS || LINUX || LYNX || __rtems__211 #if (defined (SCOV5) || defined (VXWORKS) || defined (LINUX) || defined (LYNX) || defined (MACOSX) || defined (__rtems__)) 174 212 #ifndef O_BINARY 175 213 #define O_BINARY 0 176 214 #endif /* O_BINARY */ 177 215 #define SOCKET_ERROR -1 178 #endif /* SCOV5 || VXWORKS || LINUX || LYNX */179 180 #if WIN || CE216 #endif /* SCOV5 || VXWORKS || LINUX || LYNX || MACOSX */ 217 218 #if (defined (WIN) || defined (CE)) 181 219 /* 182 220 * __NO_FCNTL means can't access fcntl function. Fcntl.h is still available. … … 194 232 #endif /* WIN || CE */ 195 233 196 #if LINUX && !__rtems__ && ! _STRUCT_TIMEVAL234 #if (defined (LINUX) && !defined(__rtems__) && !defined (_STRUCT_TIMEVAL)) 197 235 struct timeval 198 236 { … … 203 241 #endif /* LINUX && ! _STRUCT_TIMEVAL */ 204 242 205 #if ECOS243 #ifdef ECOS 206 244 #define O_RDONLY 1 207 245 #define O_BINARY 2 … … 219 257 #endif /* ECOS */ 220 258 221 #if QNX4259 #ifdef QNX4 222 260 typedef long fd_mask; 223 261 #define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ 224 262 #endif /* QNX4 */ 263 264 #ifdef NW 265 #define fd_mask fd_set 266 #define INADDR_NONE -1l 267 #define Sleep delay 268 269 #define __NO_FCNTL 1 270 271 #undef R_OK 272 #define R_OK 4 273 #undef W_OK 274 #define W_OK 2 275 #undef X_OK 276 #define X_OK 1 277 #undef F_OK 278 #define F_OK 0 279 #endif /* NW */ 225 280 226 281 /********************************** Unicode ***********************************/ … … 234 289 #define XML_MAX 4096 /* Maximum size for tags/tokens */ 235 290 #define BUF_MAX 4096 /* General sanity check for bufs */ 236 237 #if LITTLEFOOT || WEBS 291 #define FMT_STATIC_MAX 256 /* Maximum for fmtStatic calls */ 292 293 #if (defined (LITTLEFOOT) || defined (WEBS)) 238 294 #define LF_BUF_MAX (510) 239 295 #define LF_PATHSIZE LF_BUF_MAX … … 246 302 #ifndef CHAR_T_DEFINED 247 303 #define CHAR_T_DEFINED 1 248 #if UNICODE304 #ifdef UNICODE 249 305 /* 250 306 * To convert strings to UNICODE. We have a level of indirection so things … … 272 328 #define TSZ(x) (sizeof(x)) 273 329 #define TASTRL(x) (strlen(x) + 1) 274 #if WIN330 #ifdef WIN 275 331 typedef unsigned char uchar_t; 276 332 #endif /* WIN */ … … 302 358 * here, many modules in various parts of the tree are cleaner. 303 359 */ 304 #if LITTLEFOOT && INMEM360 #if (defined (LITTLEFOOT) && defined (INMEM)) 305 361 #include "lf/inmem.h" 306 362 #endif /* LITTLEFOOT && INMEM */ … … 309 365 * Type for unicode systems 310 366 */ 311 #if UNICODE367 #ifdef UNICODE 312 368 313 369 #define gmain wmain … … 368 424 #define gtolower towlower 369 425 #define gtoupper towupper 370 #if CE426 #ifdef CE 371 427 #define gisspace isspace 372 428 #define gisdigit isdigit … … 395 451 #ifndef gopen 396 452 #if INMEM 453 #define gchdir imChdir 454 #define gmkdir imMkdir 455 #define grmdir imRmdir 397 456 #define gclose imClose 398 457 #define gclosedir imClosedir 399 #define gchdir imChdir400 458 #define gchmod imChmod 401 459 #define ggetcwd imGetcwd 402 460 #define glseek imLseek 403 461 #define gloadModule imLoadModule 404 #define gmkdir imMkdir405 462 #define gopen imOpen 406 463 #define gopendir imOpendir … … 408 465 #define greaddir imReaddir 409 466 #define grename imRename 410 #define grmdir imRmdir411 467 #define gstat imStat 412 468 #define gunlink imUnlink 413 469 #define gwrite imWrite 414 470 #else 415 #define gclose close416 #define gclosedir closedir417 471 #if VXWORKS 418 472 #define gchdir vxchdir 419 473 #define gmkdir vxmkdir 420 474 #define grmdir vxrmdir 475 #elif (defined (LYNX) || defined (LINUX) || defined (MACOSX) || defined (SOLARIS)) 476 #define gchdir chdir 477 #define gmkdir(s) mkdir(s,0755) 478 #define grmdir rmdir 421 479 #else 422 #if LYNX || LINUX || SOLARIS 423 #define gmkdir(s) mkdir(s,0755) 424 #else 480 #define gchdir chdir 425 481 #define gmkdir mkdir 426 #endif /* LYNX || LINUX || SOLARIS */427 482 #define grmdir rmdir 428 #define gchdir chdir 429 #endif /* VXWORKS */ 483 #endif /* VXWORKS #elif LYNX || LINUX || MACOSX || SOLARIS*/ 484 #define gclose close 485 #define gclosedir closedir 430 486 #define gchmod chmod 431 487 #define ggetcwd getcwd … … 501 557 #define gmain main 502 558 #endif /* ! VXWORKS */ 503 #if VXWORKS559 #ifdef VXWORKS 504 560 #define fcntl(a, b, c) 505 561 #endif /* VXWORKS */ 506 562 #endif /* ! UNICODE */ 507 563 564 /* 565 * Include inmem.h here because it redefines many of the file access fucntions. 566 * Otherwise there would be lots more #if-#elif-#else-#endif ugliness. 567 */ 568 #ifdef INMEM 569 #include "lf/inmem.h" 570 #endif 571 508 572 /********************************** Defines ***********************************/ 509 573 … … 526 590 #define E_ARGS file, line 527 591 528 #if ASSERT || ASSERT_CE592 #if (defined (ASSERT) || defined (ASSERT_CE)) 529 593 #define a_assert(C) if (C) ; else error(E_L, E_ASSERT, T("%s"), T(#C)) 530 594 #else … … 571 635 long octal; 572 636 long big[2]; 573 #if FLOATING_POINT_SUPPORT637 #ifdef FLOATING_POINT_SUPPORT 574 638 double floating; 575 639 #endif /* FLOATING_POINT_SUPPORT */ … … 580 644 } value; 581 645 582 vtype_t type : 16;646 vtype_t type; 583 647 unsigned int valid : 8; 584 648 unsigned int allocated : 8; /* String was balloced */ … … 750 814 */ 751 815 752 #if ( WIN || CE) && WEBS816 #if ((defined (WIN) || defined (CE)) && defined (WEBS)) 753 817 #define EWOULDBLOCK WSAEWOULDBLOCK 754 818 #define ENETDOWN WSAENETDOWN … … 756 820 #endif /* (WIN || CE) && WEBS) */ 757 821 758 #define SOCKET_EOF 0x1 /* Seen end of file */ 759 #define SOCKET_CONNECTING 0x2 /* Connect in progress */ 760 #define SOCKET_BROADCAST 0x4 /* Broadcast mode */ 761 #define SOCKET_PENDING 0x8 /* Message pending on this socket */ 762 #define SOCKET_FLUSHING 0x10 /* Background flushing */ 763 #define SOCKET_DATAGRAM 0x20 /* Use datagrams */ 764 #define SOCKET_ASYNC 0x40 /* Use async connect */ 765 #define SOCKET_BLOCK 0x80 /* Use blocking I/O */ 766 #define SOCKET_LISTENING 0x100 /* Socket is server listener */ 767 #define SOCKET_CLOSING 0x200 /* Socket is closing */ 768 769 #define SOCKET_PORT_MAX 0xffff /* Max Port size */ 822 #define SOCKET_EOF 0x1 /* Seen end of file */ 823 #define SOCKET_CONNECTING 0x2 /* Connect in progress */ 824 #define SOCKET_BROADCAST 0x4 /* Broadcast mode */ 825 #define SOCKET_PENDING 0x8 /* Message pending on this socket */ 826 #define SOCKET_FLUSHING 0x10 /* Background flushing */ 827 #define SOCKET_DATAGRAM 0x20 /* Use datagrams */ 828 #define SOCKET_ASYNC 0x40 /* Use async connect */ 829 #define SOCKET_BLOCK 0x80 /* Use blocking I/O */ 830 #define SOCKET_LISTENING 0x100 /* Socket is server listener */ 831 #define SOCKET_CLOSING 0x200 /* Socket is closing */ 832 #define SOCKET_CONNRESET 0x400 /* Socket connection was reset */ 833 834 #define SOCKET_PORT_MAX 0xffff /* Max Port size */ 770 835 771 836 /* 772 837 * Socket error values 773 838 */ 774 #define SOCKET_WOULDBLOCK 1 775 #define SOCKET_RESET 2 776 #define SOCKET_NETDOWN 3 777 #define SOCKET_AGAIN 4 778 #define SOCKET_INTR 5 779 #define SOCKET_INVAL 6 839 #define SOCKET_WOULDBLOCK 1 /* Socket would block on I/O */ 840 #define SOCKET_RESET 2 /* Socket has been reset */ 841 #define SOCKET_NETDOWN 3 /* Network is down */ 842 #define SOCKET_AGAIN 4 /* Issue the request again */ 843 #define SOCKET_INTR 5 /* Call was interrupted */ 844 #define SOCKET_INVAL 6 /* Invalid */ 780 845 781 846 /* 782 847 * Handler event masks 783 848 */ 784 #define SOCKET_READABLE 0x2 785 #define SOCKET_WRITABLE 0x4 786 #define SOCKET_EXCEPTION 0x8 849 #define SOCKET_READABLE 0x2 /* Make socket readable */ 850 #define SOCKET_WRITABLE 0x4 /* Make socket writable */ 851 #define SOCKET_EXCEPTION 0x8 /* Interested in exceptions */ 787 852 #define EMF_SOCKET_MESSAGE (WM_USER+13) 788 853 789 #if LITTLEFOOT790 #define SOCKET_BUFSIZ 510 854 #ifdef LITTLEFOOT 855 #define SOCKET_BUFSIZ 510 /* Underlying buffer size */ 791 856 #else 792 #define SOCKET_BUFSIZ 1024 857 #define SOCKET_BUFSIZ 1024 /* Underlying buffer size */ 793 858 #endif /* LITTLEFOOT */ 794 859 … … 831 896 */ 832 897 833 #if NO_BALLOC898 #ifdef NO_BALLOC 834 899 #define balloc(B_ARGS, num) malloc(num) 835 900 #define bfree(B_ARGS, p) free(p) … … 852 917 #define bstrdup(B_ARGS, p) bstrdup(p) 853 918 854 #if UNICODE919 #ifdef UNICODE 855 920 #define bstrdupA(B_ARGS, p) bstrdupA(p) 856 921 #else /* UNICODE */ … … 867 932 extern char_t *bstrdup(B_ARGS_DEC, char_t *s); 868 933 869 #if UNICODE934 #ifdef UNICODE 870 935 extern char *bstrdupA(B_ARGS_DEC, char *s); 871 936 #else /* UNICODE */ … … 882 947 #define B_USER_BUF 0x2 /* User supplied buffer for mem */ 883 948 949 884 950 #if !LINUX && !__rtems__ 885 951 extern char_t *basename(char_t *name); 886 952 #endif /* !LINUX */ 887 953 888 #if UEMF && WEBS954 #if (defined (UEMF) && defined (WEBS)) 889 955 /* 890 956 * The open source webserver uses a different callback/timer mechanism … … 909 975 (int etype, char_t *msg); 910 976 911 #if B_STATS977 #ifdef B_STATS 912 978 #define hAlloc(x) HALLOC(B_L, x) 913 979 #define hAllocEntry(x, y, z) HALLOCENTRY(B_L, x, y, z) … … 934 1000 extern int fmtStatic(char_t *s, int n, char_t *fmt, ...); 935 1001 936 #if UNICODE1002 #ifdef UNICODE 937 1003 extern int ringqPutcA(ringq_t *rq, char c); 938 1004 extern int ringqInsertcA(ringq_t *rq, char c); -
cpukit/httpd/um.c
r2f73363 ree3afa2 54 54 /******************************** Local Data **********************************/ 55 55 56 #ifdef qHierarchicalAccess 57 /* 58 * user-provided function to allow hierarchical access protection. See below. 59 * for details.