diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-11-29 13:20:53 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-11-29 13:20:53 +0000 |
commit | 0a7278e49713596cd0d4b7e2d071e40a6940746f (patch) | |
tree | c1c61b6d608ae574575294eb70bdd15a12362d6a /cpukit/httpd | |
parent | Whitespace removal. (diff) | |
download | rtems-0a7278e49713596cd0d4b7e2d071e40a6940746f.tar.bz2 |
Whitespace removal.
Diffstat (limited to 'cpukit/httpd')
34 files changed, 616 insertions, 616 deletions
diff --git a/cpukit/httpd/asp.c b/cpukit/httpd/asp.c index 57eebb8807..b6402b78ac 100644 --- a/cpukit/httpd/asp.c +++ b/cpukit/httpd/asp.c @@ -11,8 +11,8 @@ /******************************** Description *********************************/ /* - * The ASP module processes ASP pages and executes embedded scripts. It - * support an open scripting architecture with in-built support for + * The ASP module processes ASP pages and executes embedded scripts. It + * support an open scripting architecture with in-built support for * Ejscript(TM). */ @@ -69,7 +69,7 @@ void websAspClose(void) /******************************************************************************/ /* * Process ASP requests and expand all scripting commands. We read the - * entire ASP page into memory and then process. If you have really big + * entire ASP page into memory and then process. If you have really big * documents, it is better to make them plain HTML files rather than ASPs. */ @@ -194,7 +194,7 @@ int websAspRequest(webs_t wp, char_t *lpath) */ if (websValid(wp)) { if (result) { - websWrite(wp, T("<h2><b>ASP Error: %s</b></h2>\n"), + websWrite(wp, T("<h2><b>ASP Error: %s</b></h2>\n"), result); websWrite(wp, T("<pre>%s</pre>"), nextp); bfree(B_L, result); @@ -243,10 +243,10 @@ done: * Define an ASP Ejscript function. Bind an ASP name to a C procedure. */ -int websAspDefine(char_t *name, +int websAspDefine(char_t *name, int (*fn)(int ejid, webs_t wp, int argc, char_t **argv)) { - return ejSetGlobalFunctionDirect(websAspFunctions, name, + return ejSetGlobalFunctionDirect(websAspFunctions, name, (int (*)(int, void*, int, char_t**)) fn); } @@ -260,7 +260,7 @@ int websAspWrite(int ejid, webs_t wp, int argc, char_t **argv) int i; a_assert(websValid(wp)); - + for (i = 0; i < argc; ) { a_assert(argv); if (websWriteBlock(wp, argv[i], gstrlen(argv[i])) < 0) { @@ -305,7 +305,7 @@ static char_t *strtokcmp(char_t *s1, char_t *s2) * Skip white space */ -static char_t *skipWhite(char_t *s) +static char_t *skipWhite(char_t *s) { a_assert(s); diff --git a/cpukit/httpd/balloc.c b/cpukit/httpd/balloc.c index 4c635dafdb..49710ee9ec 100644 --- a/cpukit/httpd/balloc.c +++ b/cpukit/httpd/balloc.c @@ -13,16 +13,16 @@ /* * This module implements a very fast block allocation scheme suitable for * ROMed environments. It maintains block class queues for rapid allocation - * and minimal fragmentation. This module does not coalesce blocks. The - * storage space may be populated statically or via the traditional malloc - * mechanisms. Large blocks greater than the maximum class size may be - * allocated from the O/S or run-time system via malloc. To permit the use + * and minimal fragmentation. This module does not coalesce blocks. The + * storage space may be populated statically or via the traditional malloc + * mechanisms. Large blocks greater than the maximum class size may be + * allocated from the O/S or run-time system via malloc. To permit the use * of malloc, call bopen with flags set to B_USE_MALLOC (this is the default). - * It is recommended that bopen be called first thing in the application. - * If it is not, it will be called with default values on the first call to + * It is recommended that bopen be called first thing in the application. + * If it is not, it will be called with default values on the first call to * balloc(). Note that this code is not designed for multi-threading purposes * and it depends on newly declared variables being initialized to zero. - */ + */ /********************************* Includes ***********************************/ @@ -85,7 +85,7 @@ static int bStatsMemMalloc = 0; /* Malloced memory */ #endif /* B_STATS */ /* - * ROUNDUP4(size) returns the next higher integer value of size that is + * ROUNDUP4(size) returns the next higher integer value of size that is * divisible by 4, or the value of size if size is divisible by 4. * ROUNDUP4() is used in aligning memory allocations on 4-byte boundaries. * @@ -131,10 +131,10 @@ static int ballocGetSize(int size, int *q); /********************************** Code **************************************/ /* * Initialize the balloc module. bopen should be called the very first thing - * after the application starts and bclose should be called the last thing - * before exiting. If bopen is not called, it will be called on the first - * allocation with default values. "buf" points to memory to use of size - * "bufsize". If buf is NULL, memory is allocated using malloc. flags may + * after the application starts and bclose should be called the last thing + * before exiting. If bopen is not called, it will be called on the first + * allocation with default values. "buf" points to memory to use of size + * "bufsize". If buf is NULL, memory is allocated using malloc. flags may * be set to B_USE_MALLOC if using malloc is okay. This routine will allocate * an initial buffer of size bufsize for use by the application. */ @@ -205,7 +205,7 @@ void bclose(void) /******************************************************************************/ /* - * Allocate a block of the requested size. First check the block + * Allocate a block of the requested size. First check the block * queues for a suitable one. */ @@ -289,7 +289,7 @@ void *balloc(B_ARGS_DEC, int size) } else { if (bFreeLeft > memSize) { /* - * The q was empty, and the free list has spare memory so + * The q was empty, and the free list has spare memory so * create a new block out of the primary free block */ bp = (bType*) bFreeNext; @@ -390,7 +390,7 @@ void bfree(B_ARGS_DEC, void *mp) free(bp); return; } - + #ifdef B_VERIFY_CAUSES_SEVERE_OVERHEAD bFillBlock(bp, memSize); #endif @@ -442,7 +442,7 @@ char *bstrdupA(B_ARGS_DEC, char *s) /* * Duplicate an ascii string, allow NULL pointers and then dup an empty string. * If UNICODE, bstrdup above works with wide chars, so we need this routine - * for ascii strings. + * for ascii strings. */ char_t *bstrdup(B_ARGS_DEC, char_t *s) @@ -463,7 +463,7 @@ char_t *bstrdup(B_ARGS_DEC, char_t *s) /******************************************************************************/ /* * Reallocate a block. Allow NULL pointers and just do a malloc. - * Note: if the realloc fails, we return NULL and the previous buffer is + * Note: if the realloc fails, we return NULL and the previous buffer is * preserved. */ @@ -494,7 +494,7 @@ void *brealloc(B_ARGS_DEC, void *mp, int newsize) /******************************************************************************/ /* - * Find the size of the block to be balloc'ed. It takes in a size, finds the + * Find the size of the block to be balloc'ed. It takes in a size, finds the * smallest binary block it fits into, adds an overhead amount and returns. * q is the binary size used to keep track of block sizes in use. Called * from both balloc and bfree. @@ -526,8 +526,8 @@ static void bFillBlock(void *buf, int bufsize) /******************************************************************************/ #ifdef B_STATS /* - * Statistics. Do output via calling the writefn callback function with - * "handle" as the output file handle. + * Statistics. Do output via calling the writefn callback function with + * "handle" as the output file handle. */ void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...)) @@ -568,9 +568,9 @@ void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...)) } mem = count * (1 << (q + B_SHIFT)); total += mem; - (*writefn)(handle, + (*writefn)(handle, T("%2d %5d %4d %6d %4d %5d %4d\n"), - q, 1 << (q + B_SHIFT), count, mem, bStats[q].inuse, + q, 1 << (q + B_SHIFT), count, mem, bStats[q].inuse, bStats[q].inuse * (1 << (q + B_SHIFT)), bStats[q].alloc); } @@ -581,7 +581,7 @@ void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...)) * * bFreeSize Initial memory reserved with bopen call * bStatsMemMalloc memory from calls to system MALLOC - * bStatsMemMax + * bStatsMemMax * bStatsBallocMax largest amount of memory from balloc calls * bStatsMemInUse * bStatsBallocInUse present balloced memory being used @@ -599,7 +599,7 @@ void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...)) (*writefn)(handle, T("Memory currently in use %7d\n"), bStatsMemInUse); (*writefn)(handle, T("Memory currently balloced %7d\n"), bStatsBallocInUse); (*writefn)(handle, T("Max blocks allocated %7d\n"), bStatsBlksMax); - (*writefn)(handle, T("Maximum stack used %7d\n"), + (*writefn)(handle, T("Maximum stack used %7d\n"), (int) bStackStart - (int) bStackMin); (*writefn)(handle, T("Free memory on all queues %7d\n"), total); @@ -618,17 +618,17 @@ void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...)) } memcpy(files, bStatsFiles, len); qsort(files, bStatsFilesMax, sizeof(bStatsFileType), bStatsFileSort); - + (*writefn)(handle, T("\nMemory Currently Allocated\n")); total = 0; - (*writefn)(handle, + (*writefn)(handle, T(" bytes, blocks in use, total times,") T("largest, q\n")); for (fp = files; fp < &files[bStatsFilesMax]; fp++) { if (fp->file[0]) { (*writefn)(handle, T("%18s, %7d, %5d, %6d, %7d,%4d\n"), - fp->file, fp->allocated, fp->count, fp->times, fp->largest, + fp->file, fp->allocated, fp->count, fp->times, fp->largest, fp->q); total += fp->allocated; } @@ -644,7 +644,7 @@ void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...)) cp = (char_t*) ((char*) blkp->ptr + sizeof(bType)); fp = blkp->who; if (gisalnum(*cp)) { - (*writefn)(handle, T("%-50s allocated by %s\n"), cp, + (*writefn)(handle, T("%-50s allocated by %s\n"), cp, fp->file); } } @@ -774,7 +774,7 @@ static void bStatsFree(B_ARGS_DEC, void *ptr, int q, int size) bStats[q].inuse--; /* - * Update the per block stats. Try from the end first + * Update the per block stats. Try from the end first */ for (bp = &bStatsBlks[bStatsBlksMax - 1]; bp >= bStatsBlks; bp--) { if (bp->ptr == ptr) { @@ -832,7 +832,7 @@ void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...)) /******************************************************************************/ /* * verifyUsedBlock verifies that a block which was previously allocated is - * still uncorrupted. + * still uncorrupted. */ static void verifyUsedBlock(bType *bp, int q) @@ -885,7 +885,7 @@ void verifyBallocSpace() /* * First verify all the free blocks. */ - for (q = 0; q < B_MAX_CLASS; q++) { + for (q = 0; q < B_MAX_CLASS; q++) { for (bp = bQhead[q]; bp != NULL; bp = bp->u.next) { verifyFreeBlock(bp, q); } diff --git a/cpukit/httpd/cgi.c b/cpukit/httpd/cgi.c index c2328eab6e..f349e27015 100644 --- a/cpukit/httpd/cgi.c +++ b/cpukit/httpd/cgi.c @@ -11,7 +11,7 @@ /********************************** Description *******************************/ /* * This module implements the /cgi-bin handler. CGI processing differs from - * goforms processing in that each CGI request is executed as a separate + * goforms processing in that each CGI request is executed as a separate * process, rather than within the webserver process. For each CGI request the * environment of the new process must be set to include all the CGI variables * and its standard input and output must be directed to the socket. This @@ -45,7 +45,7 @@ static int cgiMax; /* Size of hAlloc list */ /* * Process a form request. Returns 1 always to indicate it handled the URL */ -int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, +int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, char_t* query) { cgiRec *cgip; @@ -100,7 +100,7 @@ int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, } #endif /* ! VXWORKS */ - + /* * Get the CWD for resetting after launching the child process CGI */ @@ -116,12 +116,12 @@ int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, /* * Build command line arguments. Only used if there is no non-encoded * = character. This is indicative of a ISINDEX query. POST separators - * are & and others are +. argp will point to a balloc'd array of + * are & and others are +. argp will point to a balloc'd array of * pointers. Each pointer will point to substring within the - * query string. This array of string pointers is how the spawn or - * exec routines expect command line arguments to be passed. Since + * query string. This array of string pointers is how the spawn or + * exec routines expect command line arguments to be passed. Since * we don't know ahead of time how many individual items there are in - * the query string, the for loop includes logic to grow the array + * the query string, the for loop includes logic to grow the array * size via brealloc. */ argpsize = 10; @@ -143,9 +143,9 @@ int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, *(argp+n) = NULL; /* * Add all CGI variables to the environment strings to be passed - * to the spawned CGI process. This includes a few we don't + * to the spawned CGI process. This includes a few we don't * already have in the symbol table, plus all those that are in - * the cgiVars symbol table. envp will point to a balloc'd array of + * the cgiVars symbol table. envp will point to a balloc'd array of * pointers. Each pointer will point to a balloc'd string containing * the keyword value pair in the form keyword=value. Since we don't * know ahead of time how many environment strings there will be the @@ -183,14 +183,14 @@ int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, */ if (wp->cgiStdin == NULL) { wp->cgiStdin = websGetCgiCommName(); - } + } stdIn = wp->cgiStdin; stdOut = websGetCgiCommName(); /* * Now launch the process. If not successful, do the cleanup of resources. * If successful, the cleanup will be done after the process completes. */ - if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut)) + if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut)) == -1) { websError(wp, 200, T("failed to spawn CGI task")); for (ep = envp; *ep != NULL; ep++) { @@ -234,7 +234,7 @@ void websCgiGatherOutput (cgiRec *cgip) { gstat_t sbuf; char_t cgiBuf[FNAMESIZE]; - if ((gstat(cgip->stdOut, &sbuf) == 0) && + if ((gstat(cgip->stdOut, &sbuf) == 0) && (sbuf.st_size > cgip->fplacemark)) { int fdout; fdout = gopen(cgip->stdOut, O_RDONLY | O_BINARY, 0444 ); @@ -283,15 +283,15 @@ void websCgiCleanup() * We get here if the CGI process has terminated. Clean up. */ nTries = 0; -/* +/* * Make sure we didn't miss something during a task switch. * Maximum wait is 100 times 10 msecs (1 second). */ while ((cgip->fplacemark == 0) && (nTries < 100)) { websCgiGatherOutput(cgip); -/* - * There are some cases when we detect app exit - * before the file is ready. +/* + * There are some cases when we detect app exit + * before the file is ready. */ if (cgip->fplacemark == 0) { #ifdef WIN diff --git a/cpukit/httpd/default.c b/cpukit/httpd/default.c index 5da812235c..e0f9c54b9b 100644 --- a/cpukit/httpd/default.c +++ b/cpukit/httpd/default.c @@ -35,8 +35,8 @@ static void websDefaultWriteEvent(webs_t wp); /* * Process a default URL request. This will validate the URL and handle "../" * and will provide support for Active Server Pages. As the handler is the - * last handler to run, it always indicates that it has handled the URL - * by returning 1. + * last handler to run, it always indicates that it has handled the URL + * by returning 1. */ int websDefaultHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, @@ -84,11 +84,11 @@ int websDefaultHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, /* * Open the document. Stat for later use. */ - if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, + if (websPageOpen(wp, lpath, path, SOCKET_RDONLY | SOCKET_BINARY, 0666) < 0) { websError(wp, 400, T("Cannot open URL <b>%s</b>"), url); return 1; - } + } if (websPageStat(wp, lpath, path, &sbuf) < 0) { websError(wp, 400, T("Cannot stat page for URL <b>%s</b>"), url); @@ -234,7 +234,7 @@ int websValidateUrl(webs_t wp, char_t *path) * backslash character, like: * * GoAhead is vulnerable to a directory traversal bug. A request such as - * + * * GoAhead-server/../../../../../../../ results in an error message * 'Cannot open URL'. @@ -242,7 +242,7 @@ int websValidateUrl(webs_t wp, char_t *path) * the * web root and read arbitrary files from the server. * Hence a request like: - * + * * GoAhead-server/..%5C..%5C..%5C..%5C..%5C..%5C/winnt/win.ini returns the * contents of the win.ini file. * (Note that the description uses forward slashes (0x2F), but the example @@ -257,12 +257,12 @@ int websValidateUrl(webs_t wp, char_t *path) *token = '/'; token = gstrchr(token, '\\'); } - + token = gstrtok(path, T("/")); /* * Look at each directory segment and process "." and ".." segments - * Don't allow the browser to pop outside the root web. + * Don't allow the browser to pop outside the root web. */ while (token != NULL) { if (gstrcmp(token, T("..")) == 0) { @@ -363,7 +363,7 @@ static void websDefaultWriteEvent(webs_t wp) } /******************************************************************************/ -/* +/* * Closing down. Free resources. */ diff --git a/cpukit/httpd/ej.h b/cpukit/httpd/ej.h index 879dae91a7..c60fdc1682 100644 --- a/cpukit/httpd/ej.h +++ b/cpukit/httpd/ej.h @@ -1,4 +1,4 @@ -/* +/* * ej.h -- Ejscript(TM) header * * Copyright (c) GoAhead Software Inc., 1992-2000. All Rights Reserved. @@ -13,7 +13,7 @@ /******************************** Description *********************************/ -/* +/* * GoAhead Ejscript(TM) header. This defines the Ejscript API and internal * structures. */ @@ -35,7 +35,7 @@ extern int ejArgs(int argc, char_t **argv, char_t *fmt, ...); extern void ejSetResult(int eid, char_t *s); extern int ejOpenEngine(sym_fd_t variables, sym_fd_t functions); extern void ejCloseEngine(int eid); -extern int ejSetGlobalFunction(int eid, char_t *name, +extern int ejSetGlobalFunction(int eid, char_t *name, int (*fn)(int eid, void *handle, int argc, char_t **argv)); extern void ejSetVar(int eid, char_t *var, char_t *value); extern int ejGetVar(int eid, char_t *var, char_t **value); diff --git a/cpukit/httpd/ejIntrn.h b/cpukit/httpd/ejIntrn.h index 401da17891..0cf74fcde6 100644 --- a/cpukit/httpd/ejIntrn.h +++ b/cpukit/httpd/ejIntrn.h @@ -1,4 +1,4 @@ -/* +/* * ejIntrn.h -- Ejscript(TM) header * * Copyright (c) GoAhead Software, Inc., 1992-2000 @@ -13,7 +13,7 @@ /******************************** Description *********************************/ -/* +/* * GoAhead Ejscript(TM) header. This defines the Ejscript API and internal * structures. */ @@ -193,7 +193,7 @@ extern char_t *ejEvalFile(int eid, char_t *path, char_t **emsg); #endif extern int ejRemoveGlobalFunction(int eid, char_t *name); extern void *ejGetGlobalFunction(int eid, char_t *name); -extern int ejSetGlobalFunctionDirect(sym_fd_t functions, char_t *name, +extern int ejSetGlobalFunctionDirect(sym_fd_t functions, char_t *name, int (*fn)(int eid, void *handle, int argc, char_t **argv)); extern void ejError(ej_t* ep, char_t* fmt, ...); extern void ejSetUserHandle(int eid, int handle); diff --git a/cpukit/httpd/ejlex.c b/cpukit/httpd/ejlex.c index 45181d9d83..137643475a 100644 --- a/cpukit/httpd/ejlex.c +++ b/cpukit/httpd/ejlex.c @@ -11,7 +11,7 @@ /******************************** Description *********************************/ /* - * Ejscript lexical analyser. This implementes a lexical analyser for a + * Ejscript lexical analyser. This implementes a lexical analyser for a * a subset of the JavaScript language. */ @@ -508,7 +508,7 @@ static int getLexicalToken(ej_t* ep, int state) } return TOK_LITERAL; - case '0': case '1': case '2': case '3': case '4': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': do { if (tokenAddChar(ep, c) < 0) { @@ -540,7 +540,7 @@ static int getLexicalToken(ej_t* ep, int state) break; } } - if (! gisalpha(*tokq->servp) && *tokq->servp != '$' && + if (! gisalpha(*tokq->servp) && *tokq->servp != '$' && *tokq->servp != '_') { ejError(ep, T("Invalid identifier %s"), tokq->servp); return TOK_ERR; @@ -566,10 +566,10 @@ static int getLexicalToken(ej_t* ep, int state) } } -/* +/* * Skip white space after token to find out whether this is * a function or not. - */ + */ while (c == ' ' || c == '\t' || c == '\r' || c == '\n') { if ((c = inputGetc(ep)) < 0) break; @@ -682,7 +682,7 @@ static void inputPutback(ej_t* ep, int c) /******************************************************************************/ /* - * Convert a hex or octal character back to binary, return original char if + * Convert a hex or octal character back to binary, return original char if * not a hex digit */ diff --git a/cpukit/httpd/ejparse.c b/cpukit/httpd/ejparse.c index fdbb9c1d8a..59fc785752 100644 --- a/cpukit/httpd/ejparse.c +++ b/cpukit/httpd/ejparse.c @@ -174,26 +174,26 @@ char_t *ejEvalFile(int eid, char_t *path, char_t **emsg) ejError(ep, T("Bad handle %d"), eid); return NULL; } - + if (gstat(path, &sbuf) < 0) { gclose(fd); ejError(ep, T("Cant stat %s"), path); return NULL; } - + if ((fileBuf = balloc(B_L, sbuf.st_size + 1)) == NULL) { gclose(fd); ejError(ep, T("Cant malloc %d"), sbuf.st_size); return NULL; } - + if (gread(fd, fileBuf, sbuf.st_size) != (int)sbuf.st_size) { gclose(fd); bfree(B_L, fileBuf); ejError(ep, T("Error reading %s"), path); return NULL; } - + fileBuf[sbuf.st_size] = '\0'; gclose(fd); @@ -292,13 +292,13 @@ char_t *ejEval(int eid, char_t *script, char_t **emsg) int state; void *endlessLoopTest; int loopCounter; - - + + a_assert(script); if (emsg) { *emsg = NULL; - } + } if ((ep = ejPtr(eid)) == NULL) { return NULL; diff --git a/cpukit/httpd/emfdb.c b/cpukit/httpd/emfdb.c index 853a7e1e13..242aa929bb 100644 --- a/cpukit/httpd/emfdb.c +++ b/cpukit/httpd/emfdb.c @@ -29,11 +29,11 @@ * Variable to support the basicSet and basicGet functions. */ -static char_t *basicProdDir = NULL; +static char_t *basicProdDir = NULL; static char_t *basicDefaultDir = T("."); /* Default set to current */ /* - * hAlloc chain list of table schemas to be closed + * hAlloc chain list of table schemas to be closed */ static int dbMaxTables = 0; @@ -46,8 +46,8 @@ static char_t *trim(char_t *str); static int GetColumnIndex(int tid, char_t *colName); /******************************************************************************/ -/* - * Add a schema to the module-internal schema database +/* + * Add a schema to the module-internal schema database */ int dbRegisterDBSchema(dbTable_t *pTableRegister) @@ -57,14 +57,14 @@ int dbRegisterDBSchema(dbTable_t *pTableRegister) a_assert(pTableRegister); - trace(4, T("DB: Registering database table <%s>\n"), + trace(4, T("DB: Registering database table <%s>\n"), pTableRegister->name); /* * Bump up the size of the table array */ - tid = hAllocEntry((void*) &dbListTables, - &dbMaxTables, sizeof(dbTable_t)); + tid = hAllocEntry((void*) &dbListTables, + &dbMaxTables, sizeof(dbTable_t)); /* * Copy the table schema to the last spot in schema array @@ -92,7 +92,7 @@ int dbRegisterDBSchema(dbTable_t *pTableRegister) pTable->columnTypes = balloc(B_L, sizeof(int *) * pTable->nColumns); for (i = 0; (i < pTableRegister->nColumns); i++) { - pTable->columnNames[i] = + pTable->columnNames[i] = bstrdup(B_L, pTableRegister->columnNames[i]); pTable->columnTypes[i] = pTableRegister->columnTypes[i]; } @@ -117,10 +117,10 @@ int dbRegisterDBSchema(dbTable_t *pTableRegister) * with staticly defined schemas. There is only one did in this package: 0. */ -int dbOpen(char_t *tablename, char_t *filename, +int dbOpen(char_t *tablename, char_t *filename, int (*gettime)(int did), int flags) { - basicProdDir = NULL; + basicProdDir = NULL; basicDefaultDir = T("."); dbMaxTables = 0; dbListTables = NULL; @@ -234,7 +234,7 @@ void dbZero(int did) * Find the a row in the table with the given string in the given column */ -int dbSearchStr(int did, char_t *tablename, +int dbSearchStr(int did, char_t *tablename, char_t *colName, char_t *value, int flags) { int tid, nRows, nColumns, column; @@ -252,7 +252,7 @@ int dbSearchStr(int did, char_t *tablename, } else { return DB_ERR_TABLE_NOT_FOUND; } - + nColumns = pTable->nColumns; nRows = pTable->nRows; column = GetColumnIndex(tid, colName); @@ -269,7 +269,7 @@ int dbSearchStr(int did, char_t *tablename, while (row < nRows) { pRow = pTable->rows[row]; if (pRow) { - compareVal = (char_t *)(pRow[column]); + compareVal = (char_t *)(pRow[column]); if (compareVal && (gstrcmp(compareVal, value) == 0)) { return row; } @@ -280,7 +280,7 @@ int dbSearchStr(int did, char_t *tablename, /* * Return -2 if search column was not found */ - trace(3, T("DB: Unable to find column <%s> in table <%s>\n"), + trace(3, T("DB: Unable to find column <%s> in table <%s>\n"), colName, tablename); return DB_ERR_COL_NOT_FOUND; } @@ -316,14 +316,14 @@ int dbAddRow(int did, char_t *tablename) size = pTable->nColumns * max(sizeof(int), sizeof(char_t *)); return hAllocEntry((void***) &(pTable->rows), &(pTable->nRows), size); - } + } return -1; } /******************************************************************************/ /* - * Delete a row in the table. + * Delete a row in the table. */ int dbDeleteRow(int did, char_t *tablename, int row) @@ -353,7 +353,7 @@ int dbDeleteRow(int did, char_t *tablename, int row) * Free up any allocated strings */ while (column < nColumns) { - if (pRow[column] && + if (pRow[column] && (pTable->columnTypes[column] == T_STRING)) { bfree(B_L, (char_t *)pRow[column]); } @@ -367,21 +367,21 @@ int dbDeleteRow(int did, char_t *tablename, int row) bfreeSafe(B_L, pRow); pTable->nRows = hFree((void ***)&pTable->rows, row); - trace(5, T("DB: Deleted row <%d> from table <%s>\n"), + trace(5, T("DB: Deleted row <%d> from table <%s>\n"), row, tablename); } return 0; } else { - trace(3, T("DB: Unable to delete row <%d> from table <%s>\n"), + trace(3, T("DB: Unable to delete row <%d> from table <%s>\n"), row, tablename); } - + return -1; } /*****************************************************************************/ /* - * Grow the rows in the table to the nominated size. + * Grow the rows in the table to the nominated size. */ int dbSetTableNrow(int did, char_t *tablename, int nNewRows) @@ -408,13 +408,13 @@ int dbSetTableNrow(int did, char_t *tablename, int nNewRows) nRet = 0; if (nRows >= nNewRows) { -/* +/* * If number of rows already allocated exceeds requested number, do nothing */ trace(4, T("DB: Ignoring row set to <%d> in table <%s>\n"), nNewRows, tablename); } else { - trace(4, T("DB: Setting rows to <%d> in table <%s>\n"), + trace(4, T("DB: Setting rows to <%d> in table <%s>\n"), nNewRows, tablename); while (pTable->nRows < nNewRows) { if (dbAddRow(did, tablename) < 0) { @@ -422,7 +422,7 @@ int dbSetTableNrow(int did, char_t *tablename, int nNewRows) } } } - } + } return nRet; } @@ -435,7 +435,7 @@ int dbSetTableNrow(int did, char_t *tablename, int nNewRows) int dbGetTableNrow(int did, char_t *tablename) { int tid; - + a_assert(tablename); tid = dbGetTableId(did, tablename); @@ -455,7 +455,7 @@ int dbReadInt(int did, char_t *table, char_t *column, int row, int *returnValue) { int colIndex, *pRow, tid; dbTable_t *pTable; - + a_assert(table); a_assert(column); a_assert(returnValue); @@ -489,7 +489,7 @@ int dbReadInt(int did, char_t *table, char_t *column, int row, int *returnValue) if (pRow) { *returnValue = pRow[colIndex]; return 0; - } + } return DB_ERR_ROW_DELETED; } return DB_ERR_COL_NOT_FOUND; @@ -512,7 +512,7 @@ int dbReadStr(int did, char_t *table, char_t *column, int row, /******************************************************************************/ /* * The dbWriteInt function writes a value into a table at a given row and - * column. The existence of the row and column is verified before the + * column. The existence of the row and column is verified before the * write. 0 is returned on succes, -1 is returned on error. */ @@ -535,7 +535,7 @@ int dbWriteInt(int did, char_t *table, char_t *column, int row, int iData) } pTable = dbListTables[tid]; - + if (pTable) { /* * Make sure that the column exists @@ -565,8 +565,8 @@ int dbWriteInt(int did, char_t *table, char_t *column, int row, int iData) /******************************************************************************/ /* - * The dbWriteStr function writes a string value into a table at a given row - * and column. The existence of the row and column is verified before the + * The dbWriteStr function writes a string value into a table at a given row + * and column. The existence of the row and column is verified before the * write. The column is also checked to confirm it is a string field. * 0 is returned on succes, -1 is returned on error. */ @@ -657,7 +657,7 @@ static int dbWriteKeyValue(int fd, char_t *key, char_t *value) a_assert(key && *key); a_assert(value); - + fmtAlloc(&pLineOut, BUF_MAX, T("%s=%s\n"), key, value); if (pLineOut) { @@ -696,7 +696,7 @@ int dbSave(int did, char_t *filename, int flags) * First write to a temporary file, then switch around later. */ fmtAlloc(&tmpFile, FNAMESIZE, T("%s/data.tmp"), basicGetProductDir()); - if ((fd = gopen(tmpFile, + if ((fd = gopen(tmpFile, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) < 0) { trace(1, T("WARNING: Failed to open file %s\n"), tmpFile); bfree(B_L, tmpFile); @@ -723,14 +723,14 @@ int dbSave(int did, char_t *filename, int flags) * if row is NULL, the row has been deleted, so don't * write it out. */ - if ((pRow == NULL) || (pRow[0] == '\0') || + if ((pRow == NULL) || (pRow[0] == '\0') || (*(char_t *)(pRow[0]) == '\0')) { continue; } /* * Print the ROW=rowNumber directive to the file */ - fmtAlloc(&tmpNum, 20, T("%d"), row); + fmtAlloc(&tmpNum, 20, T("%d"), row); rc = dbWriteKeyValue(fd, KEYWORD_ROW, tmpNum); bfreeSafe(B_L, tmpNum); @@ -739,20 +739,20 @@ int dbSave(int did, char_t *filename, int flags) /* * Print the key-value pairs (COLUMN=value) for data cells */ - for (column = 0; (column < nColumns) && (rc >= 0); + for (column = 0; (column < nColumns) && (rc >= 0); column++, colNames++, colTypes++) { if (*colTypes == T_STRING) { - rc = dbWriteKeyValue(fd, *colNames, + rc = dbWriteKeyValue(fd, *colNames, (char_t *)(pRow[column])); } else { - fmtAlloc(&tmpNum, 20, T("%d"), pRow[column]); + fmtAlloc(&tmpNum, 20, T("%d"), pRow[column]); rc = dbWriteKeyValue(fd, *colNames, tmpNum); bfreeSafe(B_L, tmpNum); } } if (rc < 0) { - trace(1, T("WARNING: Failed to write to file %s\n"), + trace(1, T("WARNING: Failed to write to file %s\n"), tmpFile); nRet = -1; } @@ -812,7 +812,7 @@ static int crack(char_t *buf, char_t **key, char_t **val) /******************************************************************************/ /* - * Parse the file. These files consist of key-value pairs, separated by the + * Parse the file. These files consist of key-value pairs, separated by the * "=" sign. Parsing of tables starts with the "TABLE=value" pair, and rows * are parsed starting with the "ROW=value" pair. */ @@ -955,12 +955,12 @@ int dbGetTableId(int did, char_t *tablename) } } } - + return -1; } /******************************************************************************/ -/* +/* * Return a pointer to the table name, given its ID */ @@ -991,7 +991,7 @@ static char_t *trim(char_t *str) * Return a column index given the column name */ -static int GetColumnIndex(int tid, char_t *colName) +static int GetColumnIndex(int tid, char_t *colName) { int column; dbTable_t *pTable; @@ -1019,10 +1019,10 @@ void basicSetProductDir(char_t *proddir) { int len; - if (basicProdDir != NULL) { + if (basicProdDir != NULL) { bfree(B_L, basicProdDir); } - + basicProdDir = bstrdup(B_L, proddir); /* * Make sure that prefix-directory doesn't end with a '/' diff --git a/cpukit/httpd/form.c b/cpukit/httpd/form.c index 02401eadef..fa163dbed7 100644 --- a/cpukit/httpd/form.c +++ b/cpukit/httpd/form.c @@ -13,7 +13,7 @@ /* * This module implements the /goform handler. It emulates CGI processing * but performs this in-process and not as an external process. This enables - * a very high performance implementation with easy parsing and decoding + * a very high performance implementation with easy parsing and decoding * of query strings and posted data. */ @@ -30,7 +30,7 @@ static sym_fd_t formSymtab = -1; /* Symbol table for form handlers */ * Process a form request. Returns 1 always to indicate it handled the URL */ -int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, +int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, char_t *query) { sym_t *sp; @@ -58,7 +58,7 @@ int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, } /* - * Lookup the C form function first and then try tcl (no javascript support + * Lookup the C form function first and then try tcl (no javascript support * yet). */ sp = symLookup(formSymtab, formName); @@ -92,7 +92,7 @@ int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, * Define a form function in the "form" map space. */ -int websFormDefine(char_t *name, void (*fn)(webs_t wp, char_t *path, +int websFormDefine(char_t *name, void (*fn)(webs_t wp, char_t *path, char_t *query)) { a_assert(name && *name); diff --git a/cpukit/httpd/handler.c b/cpukit/httpd/handler.c index 4f88814b5a..51781a4845 100644 --- a/cpukit/httpd/handler.c +++ b/cpukit/httpd/handler.c @@ -28,7 +28,7 @@ static int urlHandlerOpenCount = 0; /* count of apps */ /**************************** Forward Declarations ****************************/ static int websUrlHandlerSort(const void *p1, const void *p2); -static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, +static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int sid, char_t *url, char_t *path, char_t *query); static char_t *websCondenseMultipleChars(char_t *strToCondense, char_t cCondense); @@ -72,16 +72,16 @@ void websUrlHandlerClose(void) /******************************************************************************/ /* - * Define a new URL handler. urlPrefix is the URL prefix to match. webDir is + * Define a new URL handler. urlPrefix is the URL prefix to match. webDir is * an optional root directory path for a web directory. arg is an optional * arg to pass to the URL handler. flags defines the matching order. Valid - * flags include WEBS_HANDLER_LAST, WEBS_HANDLER_FIRST. If multiple users - * specify last or first, their order is defined alphabetically by the + * flags include WEBS_HANDLER_LAST, WEBS_HANDLER_FIRST. If multiple users + * specify last or first, their order is defined alphabetically by the * urlPrefix. */ int websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir, int arg, - int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webdir, int arg, + int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webdir, int arg, char_t *url, char_t *path, char_t *query), int flags) { websUrlHandlerType *sp; @@ -114,18 +114,18 @@ int websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir, int arg, /* * Sort in decreasing URL length order observing the flags for first and last */ - qsort(websUrlHandler, websUrlHandlerMax, sizeof(websUrlHandlerType), + qsort(websUrlHandler, websUrlHandlerMax, sizeof(websUrlHandlerType), websUrlHandlerSort); return 0; } /******************************************************************************/ /* - * Delete an existing URL handler. We don't reclaim the space of the old + * Delete an existing URL handler. We don't reclaim the space of the old * handler, just NULL the entry. Return -1 if handler is not found. */ -int websUrlHandlerDelete(int (*handler)(webs_t wp, char_t *urlPrefix, +int websUrlHandlerDelete(int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, char_t *query)) { websUrlHandlerType *sp; @@ -172,7 +172,7 @@ static int websUrlHandlerSort(const void *p1, const void *p2) return -1; } } - return -rc; + return -rc; } /******************************************************************************/ @@ -216,7 +216,7 @@ char_t *websGetPublishDir(char_t *path, char_t **urlPrefix) * default handler do the rest. */ -static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, +static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int sid, char_t *url, char_t *path, char_t *query) { int len; @@ -225,7 +225,7 @@ static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, a_assert(path); /* - * Trim the urlPrefix off the path and set the webdirectory. Add one to step + * Trim the urlPrefix off the path and set the webdirectory. Add one to step * over the trailing '/' */ len = gstrlen(urlPrefix) + 1; @@ -236,7 +236,7 @@ static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, /******************************************************************************/ /* * See if any valid handlers are defined for this request. If so, call them - * and continue calling valid handlers until one accepts the request. + * and continue calling valid handlers until one accepts the request. * Return true if a handler was invoked, else return FALSE. */ @@ -255,7 +255,7 @@ int websUrlHandlerRequest(webs_t wp) socketDeleteHandler(wp->sid); wp->state = WEBS_PROCESSING; websStats.handlerHits++; - + websSetRequestPath(wp, websGetDefaultDir(), NULL); /* @@ -265,7 +265,7 @@ int websUrlHandlerRequest(webs_t wp) websCondenseMultipleChars(wp->url, '/'); /* - * We loop over each handler in order till one accepts the request. + * We loop over each handler in order till one accepts the request. * The security handler will handle the request if access is NOT allowed. */ first = 1; @@ -276,12 +276,12 @@ int websUrlHandlerRequest(webs_t wp) websSetEnv(wp); first = 0; } - if ((*sp->handler)(wp, sp->urlPrefix, sp->webDir, sp->arg, + if ((*sp->handler)(wp, sp->urlPrefix, sp->webDir, sp->arg, wp->url, wp->path, wp->query)) { return 1; } if (!websValid(wp)) { - trace(0, + trace(0, T("webs: handler %s called websDone, but didn't return 1\n"), sp->urlPrefix); return 1; @@ -289,7 +289,7 @@ int websUrlHandlerRequest(webs_t wp) } } /* - * If no handler processed the request, then return an error. Note: It is + * If no handler processed the request, then return an error. Note: It is * the handlers responsibility to call websDone */ if (i >= websUrlHandlerMax) { @@ -326,7 +326,7 @@ static int websTidyUrl(webs_t wp) /* * Look at each directory segment and process "." and ".." segments - * Don't allow the browser to pop outside the root web. + * Don't allow the browser to pop outside the root web. */ while (token != NULL) { if (gstrcmp(token, T("..")) == 0) { @@ -393,7 +393,7 @@ static char_t *websCondenseMultipleChars(char_t *strToCondense, char_t cCondense if (pStr != pScan) { *pStr = *pScan; } - + pScan++; pStr++; } diff --git a/cpukit/httpd/md5c.c b/cpukit/httpd/md5c.c index 25c2649f46..6118caf5ff 100644 --- a/cpukit/httpd/md5c.c +++ b/cpukit/httpd/md5c.c @@ -2,7 +2,7 @@ * * $Id$ */ - + /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. diff --git a/cpukit/httpd/misc.c b/cpukit/httpd/misc.c index e08b7c76b4..7d8c6d71c9 100644 --- a/cpukit/httpd/misc.c +++ b/cpukit/httpd/misc.c @@ -105,7 +105,7 @@ char_t *dirname(char_t *buf, char_t *name, int bufsize) a_assert(bufsize > 0); #if (defined (WIN) || defined (NW)) - if ((cp = gstrrchr(name, '/')) == NULL && + if ((cp = gstrrchr(name, '/')) == NULL && (cp = gstrrchr(name, '\\')) == NULL) #else if ((cp = gstrrchr(name, '/')) == NULL) @@ -259,16 +259,16 @@ static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, int msize) int width = 0; int prec = -1; for ( ; c != '\0'; c = *fmt++) { - if (c == '-') { - f |= flag_minus; - } else if (c == '+') { - f |= flag_plus; - } else if (c == ' ') { - f |= flag_space; - } else if (c == '#') { - f |= flag_hash; - } else if (c == '0') { - f |= flag_zero; + if (c == '-') { + f |= flag_minus; + } else if (c == '+') { + f |= flag_plus; + } else if (c == ' ') { + f |= flag_space; + } else if (c == '#') { + f |= flag_hash; + } else if (c == '0') { + f |= flag_zero; } else { break; } @@ -341,10 +341,10 @@ static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, int msize) } else { if (f & flag_hash && value != 0) { if (c == 'x') { - put_ulong(&buf, value, 16, 0, T("0x"), width, + put_ulong(&buf, value, 16, 0, T("0x"), width, prec, f); } else { - put_ulong(&buf, value, 16, 1, T("0X"), width, + put_ulong(&buf, value, 16, 1, T("0X"), width, prec, f); } } else { @@ -471,22 +471,22 @@ static void put_string(strbuf_t *buf, char_t *s, int len, int width, { int i; - if (len < 0) { - len = strnlen(s, prec >= 0 ? prec : ULONG_MAX); - } else if (prec >= 0 && prec < len) { - len = prec; + if (len < 0) { + len = strnlen(s, prec >= 0 ? prec : ULONG_MAX); + } else if (prec >= 0 && prec < len) { + len = prec; } if (width > len && !(f & flag_minus)) { - for (i = len; i < width; ++i) { - put_char(buf, ' '); + for (i = len; i < width; ++i) { + put_char(buf, ' '); } } - for (i = 0; i < len; ++i) { - put_char(buf, s[i]); + for (i = 0; i < len; ++i) { + put_char(buf, s[i]); } if (width > len && f & flag_minus) { - for (i = len; i < width; ++i) { - put_char(buf, ' '); + for (i = len; i < width; ++i) { + put_char(buf, ' '); } } } @@ -504,31 +504,31 @@ static void put_ulong(strbuf_t *buf, unsigned long int value, int base, for (len = 1, x = 1; x < ULONG_MAX / base; ++len, x = x2) { x2 = x * base; - if (x2 > value) { - break; + if (x2 > value) { + break; } } zeros = (prec > len) ? prec - len : 0; width -= zeros + len; - if (prefix != NULL) { - width -= strnlen(prefix, ULONG_MAX); + if (prefix != NULL) { + width -= strnlen(prefix, ULONG_MAX); } if (!(f & flag_minus)) { if (f & flag_zero) { - for (i = 0; i < width; ++i) { - put_char(buf, '0'); + for (i = 0; i < width; ++i) { + put_char(buf, '0'); } } else { - for (i = 0; i < width; ++i) { - put_char(buf, ' '); + for (i = 0; i < width; ++i) { + put_char(buf, ' '); } } } - if (prefix != NULL) { - put_string(buf, prefix, -1, 0, -1, flag_none); + if (prefix != NULL) { + put_string(buf, prefix, -1, 0, -1, flag_none); } - for (i = 0; i < zeros; ++i) { - put_char(buf, '0'); + for (i = 0; i < zeros; ++i) { + put_char(buf, '0'); } for ( ; x > 0; x /= base) { int digit = (value / x) % base; @@ -536,8 +536,8 @@ static void put_ulong(strbuf_t *buf, unsigned long int value, int base, digit)); } if (f & flag_minus) { - for (i = 0; i < width; ++i) { - put_char(buf, ' '); + for (i = 0; i < width; ++i) { + put_char(buf, ' '); } } } diff --git a/cpukit/httpd/ringq.c b/cpukit/httpd/ringq.c index efb9c45a70..5ee1af0f4b 100644 --- a/cpukit/httpd/ringq.c +++ b/cpukit/httpd/ringq.c @@ -36,7 +36,7 @@ * ^ ^ ^ ^ * | | | | * rq->buf rq->servp rq->endp rq->enduf - * + * * The queue is empty when servp == endp. This means that the queue will hold * at most rq->buflen -1 bytes. It is the filler's responsibility to ensure * the ringq is never filled such that servp == endp. @@ -77,7 +77,7 @@ int ringqGrowCalls = 0; * Create a new ringq. "increment" is the amount to increase the size of the * ringq should it need to grow to accomodate data being added. "maxsize" is * an upper limit (sanity level) beyond which the q must not grow. Set maxsize - * to -1 to imply no upper limit. The buffer for the ringq is always + * to -1 to imply no upper limit. The buffer for the ringq is always * dynamically allocated. Set maxsize */ @@ -123,7 +123,7 @@ void ringqClose(ringq_t *rq) /******************************************************************************/ /* - * Return the length of the data in the ringq. Users must fill the queue to + * Return the length of the data in the ringq. Users must fill the queue to * a high water mark of at most one less than the queue size. */ @@ -167,7 +167,7 @@ int ringqGetc(ringq_t *rq) /******************************************************************************/ /* - * Add a char to the queue. Note if being used to store wide strings + * Add a char to the queue. Note if being used to store wide strings * this does not add a trailing '\0'. Grow the q as required. */ @@ -413,7 +413,7 @@ int ringqGetBlk(ringq_t *rq, unsigned char *buf, int size) /******************************************************************************/ /* - * Return the maximum number of bytes the ring q can accept via a single + * Return the maximum number of bytes the ring q can accept via a single * block copy. Useful if the user is doing their own data insertion. */ @@ -423,7 +423,7 @@ int ringqPutBlkMax(ringq_t *rq) a_assert(rq); a_assert(rq->buflen == (rq->endbuf - rq->buf)); - + space = rq->buflen - RINGQ_LEN(rq) - 1; in_a_line = rq->endbuf - rq->endp; @@ -432,7 +432,7 @@ int ringqPutBlkMax(ringq_t *rq) /******************************************************************************/ /* - * Return the maximum number of bytes the ring q can provide via a single + * Return the maximum number of bytes the ring q can provide via a single * block copy. Useful if the user is doing their own data retrieval. */ diff --git a/cpukit/httpd/security.c b/cpukit/httpd/security.c index ca83a72686..be8bf812f2 100644 --- a/cpukit/httpd/security.c +++ b/cpukit/httpd/security.c @@ -24,7 +24,7 @@ /********************************** Defines ***********************************/ /* - * The following #defines change the behaviour of security in the absence + * The following #defines change the behaviour of security in the absence * of User Management. * Note that use of User management functions require prior calling of * umInit() to behave correctly @@ -53,7 +53,7 @@ static int debugSecurity = 0; * Determine if this request should be honored */ -int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, +int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, char_t *query) { char_t *type, *userid, *password, *accessLimit; @@ -77,7 +77,7 @@ int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, if (accessLimit == NULL) { return 0; } - + /* * Check to see if URL must be encrypted */ @@ -116,7 +116,7 @@ int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, if (!umUserExists(userid)) { websStats.access++; websError(wp, 401, T("Access Denied\nUnknown User")); - trace(3, T("SEC: Unknown user <%s> attempted to access <%s>\n"), + trace(3, T("SEC: Unknown user <%s> attempted to access <%s>\n"), userid, path); nRet = 1; } else if (!umUserCanAccessURL(userid, accessLimit)) { @@ -153,7 +153,7 @@ int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, a_assert(wp->digest); a_assert(wp->nonce); a_assert(wp->password); - + digestCalc = websCalcDigest(wp); a_assert(digestCalc); @@ -175,7 +175,7 @@ int websSecurityHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, } #endif websStats.errors++; - websError(wp, 401, + websError(wp, 401, T("Access to this document requires a password")); nRet = 1; } @@ -211,7 +211,7 @@ void websSecurityDelete(void) /******************************************************************************/ /* - * Store the new password, expect a decoded password. Store in websPassword in + * Store the new password, expect a decoded password. Store in websPassword in * the decoded form. */ diff --git a/cpukit/httpd/sock.c b/cpukit/httpd/sock.c index c61f94af27..d962697773 100644 --- a/cpukit/httpd/sock.c +++ b/cpukit/httpd/sock.c @@ -9,7 +9,7 @@ /******************************** Description *********************************/ /* - * Posix Socket Module. This supports blocking and non-blocking buffered + * Posix Socket Module. This supports blocking and non-blocking buffered * socket I/O. */ @@ -41,8 +41,8 @@ static int tryAlternateSendTo(int sock, char *buf, int toWrite, int i, /*********************************** Code *************************************/ /* - * Write to a socket. Absorb as much data as the socket can buffer. Block if - * the socket is in blocking mode. Returns -1 on error, otherwise the number + * Write to a socket. Absorb as much data as the socket can buffer. Block if + * the socket is in blocking mode. Returns -1 on error, otherwise the number * of bytes written. */ @@ -60,7 +60,7 @@ int socketWrite(int sid, char *buf, int bufsize) } /* - * Loop adding as much data to the output ringq as we can absorb. Initiate a + * Loop adding as much data to the output ringq as we can absorb. Initiate a * flush when the ringq is too full and continue. Block in socketFlush if the * socket is in blocking mode. */ @@ -104,7 +104,7 @@ int socketWriteString(int sid, char_t *buf) #ifdef UNICODE char *byteBuf; int r, len; - + len = gstrlen(buf); byteBuf = ballocUniToAsc(buf, len); r = socketWrite(sid, byteBuf, len); @@ -119,12 +119,12 @@ int socketWriteString(int sid, char_t *buf) /* * Read from a socket. Return the number of bytes read if successful. This * may be less than the requested "bufsize" and may be zero. Return -1 for - * errors. Return 0 for EOF. Otherwise return the number of bytes read. + * errors. Return 0 for EOF. Otherwise return the number of bytes read. * If this routine returns zero it indicates an EOF condition. * which can be verified with socketEof() - + * Note: this ignores the line buffer, so a previous socketGets - * which read a partial line may cause a subsequent socketRead to miss some + * which read a partial line may cause a subsequent socketRead to miss some * data. This routine may block if the socket is in blocking mode. * */ @@ -161,7 +161,7 @@ int socketRead(int sid, char *buf, int bufsize) /* * This flush is critical for readers of datagram packets. If the * buffer is not big enough to read the whole datagram in one hit, - * the recvfrom call will fail. + * the recvfrom call will fail. */ ringqFlush(rq); room = ringqPutBlkMax(rq); @@ -181,7 +181,7 @@ int socketRead(int sid, char *buf, int bufsize) } else if (len == 0) { /* * If bytesRead is 0, this is EOF since socketRead should never - * be called unless there is data yet to be read. Set the flag. + * be called unless there is data yet to be read. Set the flag. * Then pass back the number of bytes read. */ if (bytesRead == 0) { @@ -204,10 +204,10 @@ int socketRead(int sid, char *buf, int bufsize) /* * Get a string from a socket. This returns data in *buf in a malloced string * after trimming the '\n'. If there is zero bytes returned, *buf will be set - * to NULL. If doing non-blocking I/O, it returns -1 for error, EOF or when + * to NULL. If doing non-blocking I/O, it returns -1 for error, EOF or when * no complete line yet read. If doing blocking I/O, it will block until an - * entire line is read. If a partial line is read socketInputBuffered or - * socketEof can be used to distinguish between EOF and partial line still + * entire line is read. If a partial line is read socketInputBuffered or + * socketEof can be used to distinguish between EOF and partial line still * buffered. This routine eats and ignores carriage returns. */ @@ -231,7 +231,7 @@ int socketGets(int sid, char_t **buf) if ((rc = socketRead(sid, &c, 1)) < 0) { return rc; } - + if (rc == 0) { /* * If there is a partial line and we are at EOF, pretend we saw a '\n' @@ -308,7 +308,7 @@ int socketFlush(int sid) return -1; } continue; - } + } #endif /* * Ensure we get a FD_WRITE message when the socket can absorb @@ -317,7 +317,7 @@ int socketFlush(int sid) */ if (sp->saveMask < 0 ) { sp->saveMask = sp->handlerMask; - socketRegisterInterest(sp, + socketRegisterInterest(sp, sp->handlerMask | SOCKET_WRITABLE); } return 0; @@ -433,7 +433,7 @@ void socketSetBufferSize(int sid, int in, int line, int out) * is an event of interest as defined by handlerMask (SOCKET_READABLE, ...) */ -void socketCreateHandler(int sid, int handlerMask, socketHandler_t handler, +void socketCreateHandler(int sid, int handlerMask, socketHandler_t handler, int data) { socket_t *sp; @@ -535,7 +535,7 @@ static int socketDoOutput(socket_t *sp, char *buf, int toWrite, int *errCode) * more data */ #ifndef UEMF -#ifdef WIN +#ifdef WIN if (sp->interestEvents & FD_WRITE) { emfTime_t blockTime = { 0, 0 }; emfSetMaxBlockTime(&blockTime); @@ -547,9 +547,9 @@ static int socketDoOutput(socket_t *sp, char *buf, int toWrite, int *errCode) /******************************************************************************/ /* - * If the sendto failed, swap the first two bytes in the + * If the sendto failed, swap the first two bytes in the * sockaddr structure. This is a kludge due to a change in - * VxWorks between versions 5.3 and 5.4, but we want the + * VxWorks between versions 5.3 and 5.4, but we want the * product to run on either. */ static int tryAlternateSendTo(int sock, char *buf, int toWrite, int i, @@ -661,7 +661,7 @@ void socketFree(int sid) for (i = 0; i < socketMax; i++) { if ((sp = socketList[i]) == NULL) { continue; - } + } socketHighestFd = max(socketHighestFd, sp->sock); } } diff --git a/cpukit/httpd/sockGen.c b/cpukit/httpd/sockGen.c index 822aea6407..e3319f3a92 100644 --- a/cpukit/httpd/sockGen.c +++ b/cpukit/httpd/sockGen.c @@ -10,7 +10,7 @@ /******************************** Description *********************************/ /* - * Posix Socket Module. This supports blocking and non-blocking buffered + * Posix Socket Module. This supports blocking and non-blocking buffered * socket I/O. */ @@ -163,7 +163,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) #else hostent = gethostbyname(host); if (hostent != NULL) { - memcpy((char *) &sockaddr.sin_addr, + memcpy((char *) &sockaddr.sin_addr, (char *) hostent->h_addr_list[0], (size_t) hostent->h_length); } else { @@ -221,7 +221,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) */ if (host) { /* - * Connect to the remote server in blocking mode, then go into + * Connect to the remote server in blocking mode, then go into * non-blocking mode if desired. */ if (!dgram) { @@ -250,7 +250,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) } if ((rc = connect(sp->sock, (struct sockaddr *) &sockaddr, - sizeof(sockaddr))) < 0 && + sizeof(sockaddr))) < 0 && (rc = tryAlternateConnect(sp->sock, (struct sockaddr *) &sockaddr)) < 0) { #if (defined (WIN) || defined (CE)) @@ -272,7 +272,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) */ rc = 1; setsockopt(sp->sock, SOL_SOCKET, SO_REUSEADDR, (char *)&rc, sizeof(rc)); - if (bind(sp->sock, (struct sockaddr *) &sockaddr, + if (bind(sp->sock, (struct sockaddr *) &sockaddr, sizeof(sockaddr)) < 0) { socketFree(sid); return -1; @@ -308,9 +308,9 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) /******************************************************************************/ /* - * If the connection failed, swap the first two bytes in the + * If the connection failed, swap the first two bytes in the * sockaddr structure. This is a kludge due to a change in - * VxWorks between versions 5.3 and 5.4, but we want the + * VxWorks between versions 5.3 and 5.4, but we want the * product to run on either. */ @@ -451,20 +451,20 @@ int socketGetInput(int sid, char *buf, int toRead, int *errCode) } else { bytesRead = recv(sp->sock, buf, toRead, 0); } - + /* - * BUG 01865 -- CPU utilization hangs on Windows. The original code used + * BUG 01865 -- CPU utilization hangs on Windows. The original code used * the 'errno' global variable, which is not set by the winsock functions * as it is under *nix platforms. We use the platform independent - * socketGetError() function instead, which does handle Windows correctly. + * socketGetError() function instead, which does handle Windows correctly. * Other, *nix compatible platforms should work as well, since on those * platforms, socketGetError() just returns the value of errno. * Thanks to Jonathan Burgoyne for the fix. */ - if (bytesRead < 0) + if (bytesRead < 0) { *errCode = socketGetError(); - if (*errCode == ECONNRESET) + if (*errCode == ECONNRESET) { sp->flags |= SOCKET_CONNRESET; return 0; @@ -599,7 +599,7 @@ int socketReady(int sid) } else { continue; } - } + } if (sp->flags & SOCKET_CONNRESET) { socketCloseConnection(sid); return 0; @@ -623,7 +623,7 @@ int socketReady(int sid) /******************************************************************************/ /* - * Wait for a handle to become readable or writable and return a number of + * Wait for a handle to become readable or writable and return a number of * noticed events. Timeout is in milliseconds. */ @@ -773,7 +773,7 @@ int socketSelect(int sid, int timeout) */ index = sp->sock / (NBBY * sizeof(fd_mask)); bit = 1 << (sp->sock % (NBBY * sizeof(fd_mask))); - + /* * Set the appropriate bit in the ready masks for the sp->sock. */ @@ -893,11 +893,11 @@ static int socketDoEvent(socket_t *sp) sid = sp->sid; if (sp->currentEvents & SOCKET_READABLE) { - if (sp->flags & SOCKET_LISTENING) { + if (sp->flags & SOCKET_LISTENING) { socketAccept(sp); sp->currentEvents = 0; return 1; - } + } } else { /* @@ -929,11 +929,11 @@ static int socketDoEvent(socket_t *sp) * socket, so we must be very careful after calling the handler. */ if (sp->handler && (sp->handlerMask & sp->currentEvents)) { - (sp->handler)(sid, sp->handlerMask & sp->currentEvents, + (sp->handler)(sid, sp->handlerMask & sp->currentEvents, sp->handler_data); /* * Make sure socket pointer is still valid, then reset the currentEvents. - */ + */ if (socketList && sid < socketMax && socketList[sid] == sp) { sp->currentEvents = 0; } @@ -1008,7 +1008,7 @@ int socketDontBlock() int i; for (i = 0; i < socketMax; i++) { - if ((sp = socketList[i]) == NULL || + if ((sp = socketList[i]) == NULL || (sp->handlerMask & SOCKET_READABLE) == 0) { continue; } diff --git a/cpukit/httpd/socket.c b/cpukit/httpd/socket.c index 23fedb9114..5d121fda20 100644 --- a/cpukit/httpd/socket.c +++ b/cpukit/httpd/socket.c @@ -8,7 +8,7 @@ /******************************** Description *********************************/ /* - * Posix Socket Module. This supports blocking and non-blocking buffered + * Posix Socket Module. This supports blocking and non-blocking buffered * socket I/O. */ @@ -162,7 +162,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) #else hostent = gethostbyname(host); if (hostent != NULL) { - memcpy((char *) &sockaddr.sin_addr, + memcpy((char *) &sockaddr.sin_addr, (char *) hostent->h_addr_list[0], (size_t) hostent->h_length); } else { @@ -220,7 +220,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) */ if (host) { /* - * Connect to the remote server in blocking mode, then go into + * Connect to the remote server in blocking mode, then go into * non-blocking mode if desired. */ if (!dgram) { @@ -249,7 +249,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) } if ((rc = connect(sp->sock, (struct sockaddr *) &sockaddr, - sizeof(sockaddr))) < 0 && + sizeof(sockaddr))) < 0 && (rc = tryAlternateConnect(sp->sock, (struct sockaddr *) &sockaddr)) < 0) { #if WIN || CE @@ -271,7 +271,7 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) */ rc = 1; setsockopt(sp->sock, SOL_SOCKET, SO_REUSEADDR, (char *)&rc, sizeof(rc)); - if (bind(sp->sock, (struct sockaddr *) &sockaddr, + if (bind(sp->sock, (struct sockaddr *) &sockaddr, sizeof(sockaddr)) < 0) { socketFree(sid); return -1; @@ -306,9 +306,9 @@ int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags) /******************************************************************************/ /* - * If the connection failed, swap the first two bytes in the + * If the connection failed, swap the first two bytes in the * sockaddr structure. This is a kludge due to a change in - * VxWorks between versions 5.3 and 5.4, but we want the + * VxWorks between versions 5.3 and 5.4, but we want the * product to run on either. */ @@ -584,7 +584,7 @@ int socketReady(int sid) } else { continue; } - } + } if (sp->currentEvents & sp->handlerMask) { return 1; } @@ -604,7 +604,7 @@ int socketReady(int sid) /******************************************************************************/ /* - * Wait for a handle to become readable or writable and return a number of + * Wait for a handle to become readable or writable and return a number of * noticed events. Timeout is in milliseconds. */ @@ -754,7 +754,7 @@ int socketSelect(int sid, int timeout) */ index = sp->sock / (NBBY * sizeof(fd_mask)); bit = 1 << (sp->sock % (NBBY * sizeof(fd_mask))); - + /* * Set the appropriate bit in the ready masks for the sp->sock. */ @@ -874,11 +874,11 @@ static int socketDoEvent(socket_t *sp) sid = sp->sid; if (sp->currentEvents & SOCKET_READABLE) { - if (sp->flags & SOCKET_LISTENING) { + if (sp->flags & SOCKET_LISTENING) { socketAccept(sp); sp->currentEvents = 0; return 1; - } + } } else { /* @@ -910,11 +910,11 @@ static int socketDoEvent(socket_t *sp) * socket, so we must be very careful after calling the handler. */ if (sp->handler && (sp->handlerMask & sp->currentEvents)) { - (sp->handler)(sid, sp->handlerMask & sp->currentEvents, + (sp->handler)(sid, sp->handlerMask & sp->currentEvents, sp->handler_data); /* * Make sure socket pointer is still valid, then reset the currentEvents. - */ + */ if (socketList && sid < socketMax && socketList[sid] == sp) { sp->currentEvents = 0; } @@ -989,7 +989,7 @@ int socketDontBlock(void) int i; for (i = 0; i < socketMax; i++) { - if ((sp = socketList[i]) == NULL || + if ((sp = socketList[i]) == NULL || (sp->handlerMask & SOCKET_READABLE) == 0) { continue; } diff --git a/cpukit/httpd/uemf.c b/cpukit/httpd/uemf.c index a2c438ac28..d2d1eefe31 100644 --- a/cpukit/httpd/uemf.c +++ b/cpukit/httpd/uemf.c @@ -50,8 +50,8 @@ void error(E_ARGS_DEC, int etype, char_t *fmt, ...) fmtAlloc(&buf, E_MAX_ERROR, T("%s\n"), fmtBuf); /*#ifdef DEV*/ } else if (etype == E_ASSERT) { - fmtAlloc(&buf, E_MAX_ERROR, - T("Assertion %s, failed at %s %d\n"), fmtBuf, E_ARGS); + fmtAlloc(&buf, E_MAX_ERROR, + T("Assertion %s, failed at %s %d\n"), fmtBuf, E_ARGS); /*#endif*/ } else if (etype == E_USER) { fmtAlloc(&buf, E_MAX_ERROR, T("%s\n"), fmtBuf); @@ -60,7 +60,7 @@ void error(E_ARGS_DEC, int etype, char_t *fmt, ...) * bugfix -- if etype is not E_LOG, E_ASSERT, or E_USER, the call to * bfreeSafe(B_L, buf) below will fail, because 'buf' is randomly * initialized. To be nice, we format a message saying that this is an - * unknown message type, and in doing so give buf a valid value. Thanks + * unknown message type, and in doing so give buf a valid value. Thanks * to Simon Byholm. */ else { @@ -129,7 +129,7 @@ void traceRaw(char_t *buf) * Replace the default trace handler. Return a pointer to the old handler. */ -void (*traceSetHandler(void (*function)(int level, char_t *buf))) +void (*traceSetHandler(void (*function)(int level, char_t *buf))) (int level, char *buf) { void (*oldHandler)(int level, char_t *buf); @@ -188,7 +188,7 @@ char_t *strlower(char_t *string) } /******************************************************************************/ -/* +/* * Convert a string to upper case */ @@ -215,7 +215,7 @@ char_t *strupper(char_t *string) /******************************************************************************/ /* * Convert integer to ascii string. Allow a NULL string in which case we - * allocate a dynamic buffer. + * allocate a dynamic buffer. */ char_t *stritoa(int n, char_t *string, int width) diff --git a/cpukit/httpd/uemf.h b/cpukit/httpd/uemf.h index c890b651c6..c286ecccc2 100644 --- a/cpukit/httpd/uemf.h +++ b/cpukit/httpd/uemf.h @@ -13,7 +13,7 @@ /******************************** Description *********************************/ -/* +/* * GoAhead Web Server header. This defines the Web public APIs */ @@ -71,7 +71,7 @@ #include <netinet/in.h> #endif /* NW */ -#ifdef SCOV5 +#ifdef SCOV5 #include <sys/types.h> #include <stdio.h> #include "sys/socket.h" @@ -279,8 +279,8 @@ struct timeval #endif /* NW */ /********************************** Unicode ***********************************/ -/* - * Constants and limits. Also FNAMESIZE and PATHSIZE are currently defined +/* + * Constants and limits. Also FNAMESIZE and PATHSIZE are currently defined * in param.h to be 128 and 512 */ #define TRACE_MAX (4096 - 48) @@ -312,8 +312,8 @@ typedef unsigned short char_t; typedef unsigned short uchar_t; /* - * Text size of buffer macro. A buffer bytes will hold (size / char size) - * characters. + * Text size of buffer macro. A buffer bytes will hold (size / char size) + * characters. */ #define TSZ(x) (sizeof(x) / sizeof(char_t)) @@ -653,7 +653,7 @@ typedef struct { #endif /* __NO_PACK */ /* - * Allocation flags + * Allocation flags */ #define VALUE_ALLOCATE 0x1 @@ -691,7 +691,7 @@ typedef struct { * ^ ^ ^ ^ * | | | | * rq->buf rq->servp rq->endp rq->enduf - * + * * The queue is empty when servp == endp. This means that the queue will hold * at most rq->buflen -1 bytes. It is the fillers responsibility to ensure * the ringq is never filled such that servp == endp. @@ -727,8 +727,8 @@ typedef struct { #endif /* B_STATS */ /* - * Block classes are: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, - * 16384, 32768, 65536 + * Block classes are: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, + * 16384, 32768, 65536 */ typedef struct { union { @@ -810,7 +810,7 @@ extern int cronFree(cron_t *cp); /* SOCKET */ /******************************************************************************/ /* - * Socket flags + * Socket flags */ #if ((defined (WIN) || defined (CE)) && defined (WEBS)) @@ -846,7 +846,7 @@ extern int cronFree(cron_t *cp); /* * Handler event masks */ -#define SOCKET_READABLE 0x2 /* Make socket readable */ +#define SOCKET_READABLE 0x2 /* Make socket readable */ #define SOCKET_WRITABLE 0x4 /* Make socket writable */ #define SOCKET_EXCEPTION 0x8 /* Interested in exceptions */ #define EMF_SOCKET_MESSAGE (WM_USER+13) @@ -858,7 +858,7 @@ extern int cronFree(cron_t *cp); #endif /* LITTLEFOOT */ typedef void (*socketHandler_t)(int sid, int mask, int data); -typedef int (*socketAccept_t)(int sid, char *ipaddr, int port, +typedef int (*socketAccept_t)(int sid, char *ipaddr, int port, int listenSid); typedef struct { char host[64]; /* Host name */ @@ -1025,7 +1025,7 @@ extern int scriptEval(int engine, char_t *cmd, char_t **rslt, int chan); extern void socketClose(void); extern void socketCloseConnection(int sid); -extern void socketCreateHandler(int sid, int mask, socketHandler_t +extern void socketCreateHandler(int sid, int mask, socketHandler_t handler, int arg); extern void socketDeleteHandler(int sid); extern int socketEof(int sid); @@ -1036,7 +1036,7 @@ extern int socketGets(int sid, char_t **buf); extern int socketGetPort(int sid); extern int socketInputBuffered(int sid); extern int socketOpen(void); -extern int socketOpenConnection(char *host, int port, +extern int socketOpenConnection(char *host, int port, socketAccept_t accept, int flags); extern void socketProcess(int hid); extern int socketRead(int sid, char *buf, int len); @@ -1047,7 +1047,7 @@ extern int socketSelect(int hid, int timeout); extern int socketGetHandle(int sid); extern int socketSetBlock(int sid, int flags); extern int socketGetBlock(int sid); -extern int socketAlloc(char *host, int port, socketAccept_t accept, +extern int socketAlloc(char *host, int port, socketAccept_t accept, int flags); extern void socketFree(int sid); extern int socketGetError(void); @@ -1074,9 +1074,9 @@ extern void symSubClose(void); extern void trace(int lev, char_t *fmt, ...); extern void traceRaw(char_t *buf); -extern void (*traceSetHandler(void (*function)(int level, char_t *buf))) +extern void (*traceSetHandler(void (*function)(int level, char_t *buf))) (int level, char_t *buf); - + extern value_t valueInteger(long value); extern value_t valueString(char_t *value, int flags); extern value_t valueErrmsg(char_t *value); diff --git a/cpukit/httpd/um.c b/cpukit/httpd/um.c index e2ccdbbf29..5c59cfd25c 100644 --- a/cpukit/httpd/um.c +++ b/cpukit/httpd/um.c @@ -128,12 +128,12 @@ dbTable_t accessTable = { }; #endif /* #ifdef UEMF */ -/* +/* * Database Identifier returned from dbOpen() */ -static int didUM = -1; +static int didUM = -1; -/* +/* * Configuration database persist filename */ static char_t *saveFilename = NULL; @@ -146,7 +146,7 @@ static bool_t umCheckName(char_t *name); /*********************************** Code *************************************/ /* - * umOpen() registers the UM tables in the fake emf-database + * umOpen() registers the UM tables in the fake emf-database */ int umOpen(void) @@ -175,7 +175,7 @@ int umOpen(void) /******************************************************************************/ /* - * umClose() frees up the UM tables in the fake emf-database + * umClose() frees up the UM tables in the fake emf-database */ void umClose(void) @@ -213,7 +213,7 @@ int umCommit(char_t *filename) } a_assert (saveFilename && *saveFilename); - trace(3, T("UM: Writing User Configuration to file <%s>\n"), + trace(3, T("UM: Writing User Configuration to file <%s>\n"), saveFilename); return dbSave(didUM, saveFilename, 0); @@ -236,7 +236,7 @@ int umRestore(char_t *filename) a_assert(saveFilename && *saveFilename); - trace(3, T("UM: Loading User Configuration from file <%s>\n"), + trace(3, T("UM: Loading User Configuration from file <%s>\n"), saveFilename); /* @@ -248,7 +248,7 @@ int umRestore(char_t *filename) /******************************************************************************/ /* - * Encrypt/Decrypt a text string. + * Encrypt/Decrypt a text string. * Returns the number of characters encrypted. */ @@ -269,7 +269,7 @@ static int umEncryptString(char_t *textString) * Do not produce encrypted text with embedded linefeeds or tabs. * Simply use existing character. */ - if (enChar && !gisspace(enChar)) + if (enChar && !gisspace(enChar)) *textString = enChar; /* * Increment all pointers. @@ -305,11 +305,11 @@ static char_t *umGetFirstRowData(char_t *tableName, char_t *columnName) row = 0; /* - * Move through table until we retrieve the first row with non-null + * Move through table until we retrieve the first row with non-null * column data. */ columnData = NULL; - while ((check = dbReadStr(didUM, tableName, columnName, row++, + while ((check = dbReadStr(didUM, tableName, columnName, row++, &columnData)) == 0 || (check == DB_ERR_ROW_DELETED)) { if (columnData && *columnData) { return columnData; @@ -321,11 +321,11 @@ static char_t *umGetFirstRowData(char_t *tableName, char_t *columnName) /******************************************************************************/ /* - * umGetNextRowData() - return a pointer to the first non-blank + * umGetNextRowData() - return a pointer to the first non-blank * key value following the given one. */ -static char_t *umGetNextRowData(char_t *tableName, char_t *columnName, +static char_t *umGetNextRowData(char_t *tableName, char_t *columnName, char_t *keyLast) { char_t *key; @@ -341,7 +341,7 @@ static char_t *umGetNextRowData(char_t *tableName, char_t *columnName, row = 0; key = NULL; - while ((((check = dbReadStr(didUM, tableName, columnName, row++, + while ((((check = dbReadStr(didUM, tableName, columnName, row++, &key)) == 0) || (check == DB_ERR_ROW_DELETED)) && ((key == NULL) || (gstrcmp(key, keyLast) != 0))) { } @@ -354,7 +354,7 @@ static char_t *umGetNextRowData(char_t *tableName, char_t *columnName, /* * Move through table until we retrieve the next row with a non-null key */ - while (((check = dbReadStr(didUM, tableName, columnName, row++, &key)) + while (((check = dbReadStr(didUM, tableName, columnName, row++, &key)) == 0) || (check == DB_ERR_ROW_DELETED)) { if (key && *key && (gstrcmp(key, keyLast) != 0)) { return key; @@ -369,7 +369,7 @@ static char_t *umGetNextRowData(char_t *tableName, char_t *columnName, * umAddUser() - Adds a user to the "users" table. */ -int umAddUser(char_t *user, char_t *pass, char_t *group, +int umAddUser(char_t *user, char_t *pass, char_t *group, bool_t prot, bool_t disabled) { int row; @@ -424,7 +424,7 @@ int umAddUser(char_t *user, char_t *pass, char_t *group, dbWriteStr(didUM, UM_USER_TABLENAME, UM_PASS, row, password); bfree(B_L, password); dbWriteStr(didUM, UM_USER_TABLENAME, UM_GROUP, row, group); - dbWriteInt(didUM, UM_USER_TABLENAME, UM_PROT, row, prot); + dbWriteInt(didUM, UM_USER_TABLENAME, UM_PROT, row, prot); dbWriteInt(didUM, UM_USER_TABLENAME, UM_DISABLE, row, disabled); return 0; @@ -446,14 +446,14 @@ int umDeleteUser(char_t *user) */ if (umGetUserProtected(user)) { return UM_ERR_PROTECTED; - } + } /* * If found, delete the user from the database */ if ((row = dbSearchStr(didUM, UM_USER_TABLENAME, UM_NAME, user, 0)) >= 0) { return dbDeleteRow(didUM, UM_USER_TABLENAME, row); - } + } return UM_ERR_NOT_FOUND; } @@ -472,7 +472,7 @@ char_t *umGetFirstUser(void) /******************************************************************************/ /* * umGetNextUser() Returns the next user found in the "users" table after - * the given user. + * the given user. */ char_t *umGetNextUser(char_t *userLast) @@ -697,14 +697,14 @@ int umSetUserProtected(char_t *user, bool_t protect) * umAddGroup() adds a group to the "Group" table */ -int umAddGroup(char_t *group, short priv, accessMeth_t am, +int umAddGroup(char_t *group, short priv, accessMeth_t am, bool_t prot, bool_t disabled) { int row; a_assert(group && *group); trace(3, T("UM: Adding group <%s>\n"), group); - + /* * Do not allow duplicates */ @@ -761,14 +761,14 @@ int umDeleteGroup(char_t *group) */ if (umGetGroupInUse(group)) { return UM_ERR_IN_USE; - } + } /* * Check to see if the group is delete-protected */ if (umGetGroupProtected(group)) { return UM_ERR_PROTECTED; - } + } /* * Find the row of the group to delete @@ -812,14 +812,14 @@ bool_t umGetGroupInUse(char_t *group) */ if (dbSearchStr(didUM, UM_USER_TABLENAME, UM_GROUP, group, 0) >= 0) { return TRUE; - } + } /* * Second, check the access limit table */ if (dbSearchStr(didUM, UM_ACCESS_TABLENAME, UM_GROUP, group, 0) >= 0) { return TRUE; - } + } return FALSE; } @@ -919,7 +919,7 @@ int umSetGroupPrivilege(char_t *group, short privilege) row = dbSearchStr(didUM, UM_GROUP_TABLENAME, UM_NAME, group, 0); if (row >= 0) { - return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PRIVILEGE, row, + return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PRIVILEGE, row, (int)privilege); } else { return UM_ERR_NOT_FOUND; @@ -960,7 +960,7 @@ int umSetGroupEnabled(char_t *group, bool_t enabled) row = dbSearchStr(didUM, UM_GROUP_TABLENAME, UM_NAME, group, 0); if (row >= 0) { - return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_DISABLE, row, + return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_DISABLE, row, (int) !enabled); } else { return UM_ERR_NOT_FOUND; @@ -1001,7 +1001,7 @@ int umSetGroupProtected(char_t *group, bool_t protect) row = dbSearchStr(didUM, UM_GROUP_TABLENAME, UM_NAME, group, 0); if (row >= 0) { - return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PROT, row, + return dbWriteInt(didUM, UM_GROUP_TABLENAME, UM_PROT, row, (int) protect); } else { return UM_ERR_NOT_FOUND; @@ -1085,7 +1085,7 @@ char_t *umGetFirstAccessLimit(void) /******************************************************************************/ /* - * umGetNextAccessLimit() - return a pointer to the first non-blank + * umGetNextAccessLimit() - return a pointer to the first non-blank * access limit following the given one */ @@ -1124,7 +1124,7 @@ accessMeth_t umGetAccessLimitMethod(char_t *url) if (row >= 0) { dbReadInt(didUM, UM_ACCESS_TABLENAME, UM_METHOD, row, &am); - } + } return (accessMeth_t) am; } @@ -1181,7 +1181,7 @@ int umSetAccessLimitSecure(char_t *url, short secure) row = dbSearchStr(didUM, UM_ACCESS_TABLENAME, UM_NAME, url, 0); if (row >= 0) { - return dbWriteInt(didUM, UM_ACCESS_TABLENAME, UM_SECURE, row, + return dbWriteInt(didUM, UM_ACCESS_TABLENAME, UM_SECURE, row, (int)secure); } else { return UM_ERR_NOT_FOUND; @@ -1238,7 +1238,7 @@ char_t *umGetAccessLimit(char_t *url) { char_t *urlRet, *urlCheck, *lastChar; int len; - + a_assert(url && *url); urlRet = NULL; urlCheck = bstrdup(B_L, url); @@ -1257,13 +1257,13 @@ char_t *umGetAccessLimit(char_t *url) lastChar = urlCheck + len; lastChar--; - while ((lastChar >= urlCheck) && ((*lastChar == '/') || + while ((lastChar >= urlCheck) && ((*lastChar == '/') || (*lastChar == '\\'))) { *lastChar = 0; lastChar--; } - while ((lastChar >= urlCheck) && (*lastChar != '/') && + while ((lastChar >= urlCheck) && (*lastChar != '/') && (*lastChar != '\\')) { *lastChar = 0; lastChar--; @@ -1286,7 +1286,7 @@ accessMeth_t umGetAccessMethodForURL(char_t *url) { accessMeth_t amRet; char_t *urlHavingLimit, *group; - + urlHavingLimit = umGetAccessLimit(url); if (urlHavingLimit) { group = umGetAccessLimitGroup(urlHavingLimit); @@ -1315,7 +1315,7 @@ bool_t umUserCanAccessURL(char_t *user, char_t *url) accessMeth_t amURL; char_t *group, *usergroup, *urlHavingLimit; short priv; - + a_assert(user && *user); a_assert(url && *url); @@ -1372,15 +1372,15 @@ bool_t umUserCanAccessURL(char_t *user, char_t *url) } /* - * If the access method for the URL is AM_NONE then + * If the access method for the URL is AM_NONE then * the file "doesn't exist". */ if (amURL == AM_NONE) { return FALSE; - } - + } + /* - * If Access Limit has a group specified, then the user must be a + * If Access Limit has a group specified, then the user must be a * member of that group */ if (group && *group) { @@ -1399,10 +1399,10 @@ bool_t umUserCanAccessURL(char_t *user, char_t *url) } #endif - } + } /* - * Otherwise, user can access the URL + * Otherwise, user can access the URL */ return TRUE; diff --git a/cpukit/httpd/umui.c b/cpukit/httpd/umui.c index 971b059bc7..329a76adff 100644 --- a/cpukit/httpd/umui.c +++ b/cpukit/httpd/umui.c @@ -30,22 +30,22 @@ static void formAddUser(webs_t wp, char_t *path, char_t *query); static void formDeleteUser(webs_t wp, char_t *path, char_t *query); static void formDisplayUser(webs_t wp, char_t *path, char_t *query); -static int aspGenerateUserList(int eid, webs_t wp, +static int aspGenerateUserList(int eid, webs_t wp, int argc, char_t **argv); static void formAddGroup(webs_t wp, char_t *path, char_t *query); static void formDeleteGroup(webs_t wp, char_t *path, char_t *query); -static int aspGenerateGroupList(int eid, webs_t wp, +static int aspGenerateGroupList(int eid, webs_t wp, int argc, char_t **argv); static void formAddAccessLimit(webs_t wp, char_t *path, char_t *query); static void formDeleteAccessLimit(webs_t wp, char_t *path, char_t *query); -static int aspGenerateAccessLimitList(int eid, webs_t wp, +static int aspGenerateAccessLimitList(int eid, webs_t wp, int argc, char_t **argv); -static int aspGenerateAccessMethodList(int eid, webs_t wp, +static int aspGenerateAccessMethodList(int eid, webs_t wp, int argc, char_t **argv); -static int aspGeneratePrivilegeList(int eid, webs_t wp, +static int aspGeneratePrivilegeList(int eid, webs_t wp, int argc, char_t **argv); static void formSaveUserManagement(webs_t wp, char_t *path, char_t *query); @@ -92,12 +92,12 @@ static void formAddUser(webs_t wp, char_t *path, char_t *query) a_assert(wp); - userid = websGetVar(wp, T("user"), T("")); - pass1 = websGetVar(wp, T("password"), T("")); - pass2 = websGetVar(wp, T("passconf"), T("")); - group = websGetVar(wp, T("group"), T("")); - enabled = websGetVar(wp, T("enabled"), T("")); - ok = websGetVar(wp, T("ok"), T("")); + userid = websGetVar(wp, T("user"), T("")); + pass1 = websGetVar(wp, T("password"), T("")); + pass2 = websGetVar(wp, T("passconf"), T("")); + group = websGetVar(wp, T("group"), T("")); + enabled = websGetVar(wp, T("enabled"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); @@ -163,8 +163,8 @@ static void formDeleteUser(webs_t wp, char_t *path, char_t *query) a_assert(wp); - userid = websGetVar(wp, T("user"), T("")); - ok = websGetVar(wp, T("ok"), T("")); + userid = websGetVar(wp, T("user"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); @@ -198,8 +198,8 @@ static void formDisplayUser(webs_t wp, char_t *path, char_t *query) a_assert(wp); - userid = websGetVar(wp, T("user"), T("")); - ok = websGetVar(wp, T("ok"), T("")); + userid = websGetVar(wp, T("user"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websWrite(wp, T("<body>")); @@ -234,14 +234,14 @@ static int aspGenerateUserList(int eid, webs_t wp, int argc, char_t **argv) a_assert(wp); - nBytes = websWrite(wp, + nBytes = websWrite(wp, T("<SELECT NAME=\"user\" SIZE=\"3\" TITLE=\"Select a User\">")); row = 0; userid = umGetFirstUser(); nBytesSent = 0; while (userid && (nBytes > 0)) { - nBytes = websWrite(wp, T("<OPTION VALUE=\"%s\">%s\n"), + nBytes = websWrite(wp, T("<OPTION VALUE=\"%s\">%s\n"), userid, userid); userid = umGetNextUser(userid); nBytesSent += nBytes; @@ -267,11 +267,11 @@ static void formAddGroup(webs_t wp, char_t *path, char_t *query) a_assert(wp); - group = websGetVar(wp, T("group"), T("")); - method = websGetVar(wp, T("method"), T("")); - enabled = websGetVar(wp, T("enabled"), T("")); - privilege = websGetVar(wp, T("privilege"), T("")); - ok = websGetVar(wp, T("ok"), T("")); + group = websGetVar(wp, T("group"), T("")); + method = websGetVar(wp, T("method"), T("")); + enabled = websGetVar(wp, T("enabled"), T("")); + privilege = websGetVar(wp, T("privilege"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); @@ -319,7 +319,7 @@ static void formAddGroup(webs_t wp, char_t *path, char_t *query) websWrite(wp, T("Unable to add group, \"%s\", code: %d "), group, nCheck); } else { - websWrite(wp, T("Group, \"%s\" was successfully added."), + websWrite(wp, T("Group, \"%s\" was successfully added."), group); } } @@ -340,8 +340,8 @@ static void formDeleteGroup(webs_t wp, char_t *path, char_t *query) a_assert(wp); - group = websGetVar(wp, T("group"), T("")); - ok = websGetVar(wp, T("ok"), T("")); + group = websGetVar(wp, T("group"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); @@ -379,7 +379,7 @@ static int aspGenerateGroupList(int eid, webs_t wp, int argc, char_t **argv) row = 0; nBytesSent = 0; - nBytes = websWrite(wp, + nBytes = websWrite(wp, T("<SELECT NAME=\"group\" SIZE=\"3\" TITLE=\"Select a Group\">")); /* * Add a special "<NONE>" element to allow de-selection @@ -412,11 +412,11 @@ static void formAddAccessLimit(webs_t wp, char_t *path, char_t *query) a_assert(wp); - url = websGetVar(wp, T("url"), T("")); - group = websGetVar(wp, T("group"), T("")); - method = websGetVar(wp, T("method"), T("")); - secure = websGetVar(wp, T("secure"), T("")); - ok = websGetVar(wp, T("ok"), T("")); + url = websGetVar(wp, T("url"), T("")); + group = websGetVar(wp, T("group"), T("")); + method = websGetVar(wp, T("method"), T("")); + secure = websGetVar(wp, T("secure"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); @@ -466,8 +466,8 @@ static void formDeleteAccessLimit(webs_t wp, char_t *path, char_t *query) a_assert(wp); - url = websGetVar(wp, T("url"), T("")); - ok = websGetVar(wp, T("ok"), T("")); + url = websGetVar(wp, T("url"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); @@ -475,10 +475,10 @@ static void formDeleteAccessLimit(webs_t wp, char_t *path, char_t *query) if (gstricmp(ok, T("ok")) != 0) { websWrite(wp, T("Delete Access Limit Cancelled")); } else if (umDeleteAccessLimit(url) != 0) { - websWrite(wp, T("ERROR: Unable to delete Access Limit for [%s]"), + websWrite(wp, T("ERROR: Unable to delete Access Limit for [%s]"), url); } else { - websWrite(wp, T("Access Limit for [%s], was successfully deleted."), + websWrite(wp, T("Access Limit for [%s], was successfully deleted."), url); } @@ -492,7 +492,7 @@ static void formDeleteAccessLimit(webs_t wp, char_t *path, char_t *query) * Generate HTML to create a list box containing the access limits */ -static int aspGenerateAccessLimitList(int eid, webs_t wp, +static int aspGenerateAccessLimitList(int eid, webs_t wp, int argc, char_t **argv) { char_t *url; @@ -502,7 +502,7 @@ static int aspGenerateAccessLimitList(int eid, webs_t wp, row = nBytesSent = 0; url = umGetFirstAccessLimit(); - nBytes = websWrite(wp, + nBytes = websWrite(wp, T("<SELECT NAME=\"url\" SIZE=\"3\" TITLE=\"Select a URL\">")); while (url && (nBytes > 0)) { @@ -521,22 +521,22 @@ static int aspGenerateAccessLimitList(int eid, webs_t wp, * Generate HTML to create a list box containing the access methods */ -static int aspGenerateAccessMethodList(int eid, webs_t wp, +static int aspGenerateAccessMethodList(int eid, webs_t wp, int argc, char_t **argv) { int nBytes; a_assert(wp); - nBytes = websWrite(wp, + nBytes = websWrite(wp, T("<SELECT NAME=\"method\" SIZE=\"3\" TITLE=\"Select a Method\">")); - nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">FULL ACCESS\n"), + nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">FULL ACCESS\n"), AM_FULL); - nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">BASIC ACCESS\n"), + nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">BASIC ACCESS\n"), AM_BASIC); - nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\" SELECTED>DIGEST ACCESS\n"), + nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\" SELECTED>DIGEST ACCESS\n"), AM_DIGEST); - nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">NO ACCESS\n"), + nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">NO ACCESS\n"), AM_NONE); nBytes += websWrite(wp, T("</SELECT>")); @@ -547,7 +547,7 @@ static int aspGenerateAccessMethodList(int eid, webs_t wp, * Generate HTML to create a list box containing privileges */ -static int aspGeneratePrivilegeList(int eid, webs_t wp, +static int aspGeneratePrivilegeList(int eid, webs_t wp, int argc, char_t **argv) { int nBytes; @@ -558,7 +558,7 @@ static int aspGeneratePrivilegeList(int eid, webs_t wp, nBytes += websWrite(wp, T("MULTIPLE TITLE=\"Choose Privileges\">")); nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">READ\n"), PRIV_READ); nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">EXECUTE\n"), PRIV_WRITE); - nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">ADMINISTRATE\n"), + nBytes += websWrite(wp, T("<OPTION VALUE=\"%d\">ADMINISTRATE\n"), PRIV_ADMIN); nBytes += websWrite(wp, T("</SELECT>")); @@ -576,7 +576,7 @@ static void formSaveUserManagement(webs_t wp, char_t *path, char_t *query) a_assert(wp); - ok = websGetVar(wp, T("ok"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); @@ -605,7 +605,7 @@ static void formLoadUserManagement(webs_t wp, char_t *path, char_t *query) a_assert(wp); - ok = websGetVar(wp, T("ok"), T("")); + ok = websGetVar(wp, T("ok"), T("")); websHeader(wp); websMsgStart(wp); diff --git a/cpukit/httpd/url.c b/cpukit/httpd/url.c index 07a99cc843..da99f3f78a 100644 --- a/cpukit/httpd/url.c +++ b/cpukit/httpd/url.c @@ -47,7 +47,7 @@ char_t *websUrlType(char_t *url, char_t *buf, int charCnt) gstrcpy(buf, T("text/plain")); return buf; } - if (websUrlParse(url, &parsebuf, NULL, NULL, NULL, NULL, NULL, + if (websUrlParse(url, &parsebuf, NULL, NULL, NULL, NULL, NULL, NULL, &ext) < 0) { gstrcpy(buf, T("text/plain")); return buf; @@ -72,8 +72,8 @@ char_t *websUrlType(char_t *url, char_t *buf, int charCnt) * This must be freed by the caller. NOTE: tag is not yet fully supported. */ -int websUrlParse(char_t *url, char_t **pbuf, char_t **phost, char_t **ppath, - char_t **pport, char_t **pquery, char_t **pproto, char_t **ptag, +int websUrlParse(char_t *url, char_t **pbuf, char_t **phost, char_t **ppath, + char_t **pport, char_t **pquery, char_t **pproto, char_t **ptag, char_t **pext) { char_t *tok, *cp, *host, *path, *port, *proto, *tag, *query, *ext; @@ -128,7 +128,7 @@ int websUrlParse(char_t *url, char_t **pbuf, char_t **phost, char_t **ppath, } if ((cp = gstrchr(tok, '/')) != NULL) { /* - * If a full URL is supplied, we need to copy the host and port + * If a full URL is supplied, we need to copy the host and port * portions into static buffers. */ c = *cp; @@ -155,7 +155,7 @@ int websUrlParse(char_t *url, char_t **pbuf, char_t **phost, char_t **ppath, query = cp; path = tok; tok = query; - } + } /* * Parse the fragment identifier diff --git a/cpukit/httpd/wbase64.c b/cpukit/httpd/wbase64.c index 87659eeb6a..5cf8c8b0b5 100644 --- a/cpukit/httpd/wbase64.c +++ b/cpukit/httpd/wbase64.c @@ -29,7 +29,7 @@ static char_t map64[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -83,7 +83,7 @@ int websDecode64(char_t *outbuf, char_t *string, int outlen) error(E_L, E_LOG, T("Bad string: %s at %c index %d"), string, c, i); return -1; - } + } shiftbuf = shiftbuf | (c << shift); shift -= 6; } diff --git a/cpukit/httpd/webcomp.c b/cpukit/httpd/webcomp.c index 6b19b3ba18..f19063f5b3 100644 --- a/cpukit/httpd/webcomp.c +++ b/cpukit/httpd/webcomp.c @@ -88,7 +88,7 @@ static int compile(char_t *fileList, char_t *prefix) time(&now); fprintf(stdout, "/*\n * webrom.c -- Compiled Web Pages\n *\n"); - fprintf(stdout, " * Compiled by GoAhead WebCompile: %s */\n\n", + fprintf(stdout, " * Compiled by GoAhead WebCompile: %s */\n\n", gctime(&now)); fprintf(stdout, "#include \"wsIntrn.h\"\n\n"); fprintf(stdout, "#ifndef WEBS_PAGE_ROM\n"); @@ -109,7 +109,7 @@ static int compile(char_t *fileList, char_t *prefix) } if (gstat(file, &sbuf) == 0 && sbuf.st_mode & S_IFDIR) { continue; - } + } if ((fd = gopen(file, O_RDONLY | O_BINARY)) < 0) { fprintf(stderr, "Can't open file %s\n", file); return -1; @@ -170,12 +170,12 @@ static int compile(char_t *fileList, char_t *prefix) fprintf(stdout, " { T(\"/%s\"), 0, 0 },\n", cp); continue; } - fprintf(stdout, " { T(\"/%s\"), page_%d, %d },\n", cp, nFile, + fprintf(stdout, " { T(\"/%s\"), page_%d, %d },\n", cp, nFile, sbuf.st_size); nFile++; } - fclose(lp); - + fclose(lp); + fprintf(stdout, " { 0, 0, 0 },\n"); fprintf(stdout, "};\n"); fprintf(stdout, "#endif /* WEBS_PAGE_ROM */\n"); diff --git a/cpukit/httpd/webmain.c b/cpukit/httpd/webmain.c index b57ea3136a..eca5735cef 100644 --- a/cpukit/httpd/webmain.c +++ b/cpukit/httpd/webmain.c @@ -57,7 +57,7 @@ typedef struct { /* The following holds the pointer to an allocated websTimer_t structure . * Using this method only one timer can be active at a time, but - * for the WebServer, this should be OK. + * for the WebServer, this should be OK. */ websTimer_t *tp; @@ -75,7 +75,7 @@ static void memLeaks(void); #endif static timer_t timer_id; static void rtems_httpd_daemon(rtems_task_argument args); - + /*********************************** Code *************************************/ /* * Main -- entry point from RTEMS @@ -90,7 +90,7 @@ int rtems_initialize_webserver(void) * Default HTTPD priority. **********************************************************************/ priority = 40; - + sc = rtems_task_create(rtems_build_name('H', 'T', 'P', 'D'), priority, 8*1024, RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR | @@ -106,7 +106,7 @@ int rtems_initialize_webserver(void) if (sc != RTEMS_SUCCESSFUL) { return(RTEMS_UNSATISFIED); - } + } return(RTEMS_SUCCESSFUL); @@ -116,7 +116,7 @@ static void rtems_httpd_daemon(rtems_task_argument args) { /* - * Initialize the memory allocator. Allow use of malloc and start with a + * Initialize the memory allocator. Allow use of malloc and start with a * 10K heap. */ bopen(NULL, (10 * 1024), B_USE_MALLOC); @@ -185,14 +185,14 @@ static int initWebs(void) socketOpen(); /* - * Define the local Ip address, host name, default home page and the + * Define the local Ip address, host name, default home page and the * root web directory. */ if (gethostname(host, sizeof(host)) < 0) { error(E_L, E_LOG, T("Can't get hostname")); return -1; } - + /* intaddr.s_addr = (unsigned long) hostGetByName(host); */ if ((hp = gethostbyname(host)) == NULL) { error(E_L, E_LOG, T("Can't get host address")); @@ -228,7 +228,7 @@ static int initWebs(void) #endif websSetPassword(password); -/* +/* * Open the web server on the given port. If that port is taken, try * the next sequential port for up to "retries" attempts. */ @@ -236,14 +236,14 @@ static int initWebs(void) /* * First create the URL handlers. Note: handlers are called in sorted order - * with the longest path handler examined first. Here we define the security + * with the longest path handler examined first. Here we define the security * handler, forms handler and the default web page handler. */ - websUrlHandlerDefine(T(""), NULL, 0, websSecurityHandler, + websUrlHandlerDefine(T(""), NULL, 0, websSecurityHandler, WEBS_HANDLER_FIRST); websUrlHandlerDefine(T("/goform"), NULL, 0, websFormHandler, 0); - websUrlHandlerDefine(T(""), NULL, 0, websDefaultHandler, - WEBS_HANDLER_LAST); + websUrlHandlerDefine(T(""), NULL, 0, websDefaultHandler, + WEBS_HANDLER_LAST); /* * Now define two test procedures. Replace these with your application @@ -255,14 +255,14 @@ static int initWebs(void) /* * Create a handler for the default home page */ - websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0); + websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0); return 0; } /******************************************************************************/ /* * Test Javascript binding for ASP. This will be invoked when "aspTest" is - * embedded in an ASP page. See web/asp.asp for usage. Set browser to + * embedded in an ASP page. See web/asp.asp for usage. Set browser to * "localhost/asp.asp" to test. */ @@ -286,8 +286,8 @@ static void formTest(webs_t wp, char_t *path, char_t *query) { char_t *name, *address; - name = websGetVar(wp, T("name"), T("Joe Smith")); - address = websGetVar(wp, T("address"), T("1212 Milky Way Ave.")); + name = websGetVar(wp, T("name"), T("Joe Smith")); + address = websGetVar(wp, T("address"), T("1212 Milky Way Ave.")); websHeader(wp); websWrite(wp, T("<body><h2>Name: %s, Address: %s</h2>\n"), name, address); @@ -342,7 +342,7 @@ void *emfCreateTimer(int delay, void (*routine)(long arg), long arg) bfree(B_L, tp); return NULL; } - + #if 0 act.sa_flags = 0; sigemptyset(&act.sa_mask); @@ -387,7 +387,7 @@ static void timerProc(int signo) websTimer_t wtp = *tp; /* Copy the timer structure to a local first and delete it before calling - * the function, since the function could create another timer. In this + * the function, since the function could create another timer. In this * implementation, only one timer can be allocated at a time. */ @@ -420,7 +420,7 @@ static int websHomePageHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, /******************************************************************************/ #if B_STATS -static void memLeaks() +static void memLeaks() { int fd=1; diff --git a/cpukit/httpd/webs.c b/cpukit/httpd/webs.c index 938710cf55..5c22606782 100644 --- a/cpukit/httpd/webs.c +++ b/cpukit/httpd/webs.c @@ -127,11 +127,11 @@ int websOpenServer(int port, int retries) /* * Optional request log support */ - websLogFd = gopen(websLogname, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY, + websLogFd = gopen(websLogname, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY, 0666); a_assert(websLogFd >= 0); #endif - + return websOpenListen(port, retries); } @@ -154,7 +154,7 @@ void websCloseServer(void) */ websCloseListen(); -/* +/* * Close each open browser connection and free all resources */ for (wid = websMax; webs && wid >= 0; wid--) { @@ -207,7 +207,7 @@ int websOpenListen(int port, int retries) error(E_L, E_USER, T("Couldn't open a socket on ports %d - %d"), orig, port - 1); return -1; - } + } /* * Determine the full URL address to access the home page for this web server @@ -222,7 +222,7 @@ int websOpenListen(int port, int retries) websIpaddrUrl = bstrdup(B_L, websIpaddr); } else { fmtAlloc(&websHostUrl, WEBS_MAX_URL + 80, T("%s:%d"), websHost, port); - fmtAlloc(&websIpaddrUrl, WEBS_MAX_URL + 80, T("%s:%d"), + fmtAlloc(&websIpaddrUrl, WEBS_MAX_URL + 80, T("%s:%d"), websIpaddr, port); } trace(0, T("webs: Listening for HTTP requests at address %s\n"), @@ -278,8 +278,8 @@ int websAccept(int sid, char *ipaddr, int port, int listenSid) * Check if this is a request from a browser on this system. This is useful * to know for permitting administrative operations only for local access */ - if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 || - gstrcmp(wp->ipaddr, websIpaddr) == 0 || + if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 || + gstrcmp(wp->ipaddr, websIpaddr) == 0 || gstrcmp(wp->ipaddr, websHost) == 0) { wp->flags |= WEBS_LOCAL_REQUEST; } @@ -317,18 +317,18 @@ static void websSocketEvent(int sid, int mask, int iwp) if (mask & SOCKET_READABLE) { websReadEvent(wp); - } + } if (mask & SOCKET_WRITABLE) { if (websValid(wp) && wp->writeSocket) { (*wp->writeSocket)(wp); } - } + } } /******************************************************************************/ /* * The webs read handler. This is the primary read event loop. It uses a - * state machine to track progress while parsing the HTTP request. + * state machine to track progress while parsing the HTTP request. * Note: we never block as the socket is always in non-blocking mode. */ @@ -356,7 +356,7 @@ void websReadEvent(webs_t wp) /* * Get more input into "text". Returns 0, if more data is needed - * to continue, -1 if finished with the request, or 1 if all + * to continue, -1 if finished with the request, or 1 if all * required data is available for current state. */ while ((rc = websGetInput(wp, &text, &nbytes)) == 0) { @@ -371,7 +371,7 @@ void websReadEvent(webs_t wp) } /* - * This is the state machine for the web server. + * This is the state machine for the web server. */ switch(wp->state) { case WEBS_BEGIN: @@ -384,7 +384,7 @@ void websReadEvent(webs_t wp) } wp->state = WEBS_HEADER; break; - + case WEBS_HEADER: /* * Store more of the HTTP header. As we are doing line reads, we @@ -422,12 +422,12 @@ void websReadEvent(webs_t wp) * nbytes += 1; */ - } else + } else #endif if (wp->query) { if (wp->query[0] && !(wp->flags & WEBS_POST_DATA)) { /* - * Special case where the POST request also had query data + * Special case where the POST request also had query data * specified in the URL, ie. url?query_data. In this case * the URL query data is separated by a '&' from the posted * query data. @@ -533,18 +533,18 @@ void websReadEvent(webs_t wp) /******************************************************************************/ /* - * Get input from the browser. Return TRUE (!0) if the request has been - * handled. Return -1 on errors or if the request has been processed, + * Get input from the browser. Return TRUE (!0) if the request has been + * handled. Return -1 on errors or if the request has been processed, * 1 if input read, and 0 to instruct the caller to call again for more input. * * Note: socketRead will Return the number of bytes read if successful. This * may be less than the requested "bufsize" and may be zero. It returns -1 for - * errors. It returns 0 for EOF. Otherwise it returns the number of bytes - * read. Since this may be zero, callers should use socketEof() to + * errors. It returns 0 for EOF. Otherwise it returns the number of bytes + * read. Since this may be zero, callers should use socketEof() to * distinguish between this and EOF. */ -static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes) +static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes) { char_t *text; char buf[WEBS_SOCKET_BUFSIZ+1]; @@ -592,7 +592,7 @@ static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes) } else { /* Valid data */ /* - * Convert to UNICODE if necessary. First be sure the string + * Convert to UNICODE if necessary. First be sure the string * is NULL terminated. */ buf[nbytes] = '\0'; @@ -621,7 +621,7 @@ static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes) #ifdef WEBS_SSL_SUPPORT if (wp->flags & WEBS_SECURE) { /* - * If state is WEBS_BEGIN and the request is secure, a -1 will + * If state is WEBS_BEGIN and the request is secure, a -1 will * usually indicate SSL negotiation */ if (wp->state == WEBS_BEGIN) { @@ -638,8 +638,8 @@ static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes) if (eof) { /* - * If this is a post request without content length, process - * the request as we now have all the data. Otherwise just + * If this is a post request without content length, process + * the request as we now have all the data. Otherwise just * close the connection. */ if (wp->state == WEBS_POST) { @@ -666,7 +666,7 @@ static int websGetInput(webs_t wp, char_t **ptext, int *pnbytes) * because if we don't receive the entire header in the first pass * this code assumes we were only expecting a one line header, which * is not necessarily the case. So we weren't processing the whole - * header and weren't fufilling requests properly. + * header and weren't fufilling requests properly. */ #ifdef UNUSED if (wp->state == WEBS_HEADER && ringqLen(&wp->header) <= 0) { @@ -765,7 +765,7 @@ static int websParseFirst(webs_t wp, char_t *text) * at the start of the URL. Non-proxied will just be local path names. */ host = path = port = proto = query = ext = NULL; - if (websUrlParse(url, &buf, &host, &path, &port, &query, &proto, + if (websUrlParse(url, &buf, &host, &path, &port, &query, &proto, NULL, &ext) < 0) { websError(wp, 400, T("Bad URL format")); return -1; @@ -787,7 +787,7 @@ static int websParseFirst(webs_t wp, char_t *text) wp->path = bstrdup(B_L, path); wp->protocol = bstrdup(B_L, proto); wp->protoVersion = bstrdup(B_L, protoVer); - + if ((testPort = socketGetPort(wp->listenSid)) >= 0) { wp->port = testPort; } else { @@ -803,13 +803,13 @@ static int websParseFirst(webs_t wp, char_t *text) #ifdef WEBS_PROXY_SUPPORT /* - * Determine if this is a request for local webs data. If it is not a proxied + * Determine if this is a request for local webs data. If it is not a proxied * request from the browser, we won't see the "http://" or the system name, so * we assume it must be talking to us directly for local webs data. * Note: not fully implemented yet. */ - if (gstrstr(wp->url, T("http://")) == NULL || - ((gstrcmp(wp->host, T("localhost")) == 0 || + if (gstrstr(wp->url, T("http://")) == NULL || + ((gstrcmp(wp->host, T("localhost")) == 0 || gstrcmp(wp->host, websHost) == 0) && (wp->port == websPort))) { wp->flags |= WEBS_LOCAL_PAGE; if (gstrcmp(wp->path, T("/")) == 0) { @@ -841,7 +841,7 @@ static void websParseRequest(webs_t wp) */ websSetVar(wp, T("HTTP_AUTHORIZATION"), T("")); -/* +/* * Parse the header and create the Http header keyword variables * We rewrite the header as we go for non-local requests. NOTE: this * modifies the header string directly and tokenizes each line with '\0'. @@ -893,7 +893,7 @@ static void websParseRequest(webs_t wp) */ authType = bstrdup (B_L, value); a_assert (authType); -/* +/* * Truncate authType at the next non-alpha character */ cp = authType; @@ -1055,7 +1055,7 @@ static void websParseRequest(webs_t wp) wp->clen = gatoi(value); if (wp->clen > 0) { - wp->flags |= WEBS_CLEN; + wp->flags |= WEBS_CLEN; websSetVar(wp, T("CONTENT_LENGTH"), value); } else @@ -1172,7 +1172,7 @@ void websSetEnv(webs_t wp) if (*keyword) { /* - * If keyword has already been set, append the new value to what has + * If keyword has already been set, append the new value to what has * been stored. */ if ((valCheck = websGetVar(wp, keyword, NULL)) != 0) { @@ -1197,7 +1197,7 @@ void websSetEnv(webs_t wp) /******************************************************************************/ /* * Define a webs (CGI) variable for this connection. Also create in relevant - * scripting engines. Note: the incoming value may be volatile. + * scripting engines. Note: the incoming value may be volatile. */ void websSetVar(webs_t wp, char_t *var, char_t *value) @@ -1250,7 +1250,7 @@ char_t *websGetVar(webs_t wp, char_t *var, char_t *defaultGetValue) a_assert(websValid(wp)); a_assert(var && *var); - + if ((sp = symLookup(wp->cgiVars, var)) != NULL) { a_assert(sp->content.type == string); if (sp->content.value.string) { @@ -1271,7 +1271,7 @@ int websCompareVar(webs_t wp, char_t *var, char_t *value) { a_assert(websValid(wp)); a_assert(var && *var); - + if (gstrcmp(value, websGetVar(wp, var, T(" __UNDEF__ "))) == 0) { return 1; } @@ -1295,7 +1295,7 @@ void websTimeoutCancel(webs_t wp) /******************************************************************************/ /* - * Output a HTTP response back to the browser. If redirect is set to a + * Output a HTTP response back to the browser. If redirect is set to a * URL, the browser will be sent to this location. */ @@ -1324,12 +1324,12 @@ void websResponse(webs_t wp, int code, char_t *message, char_t *redirect) websWrite(wp, T("HTTP/1.1 %d %s\r\n"), code, websErrorMsg(code)); } -/* +/* * By license terms the following line of code must not be modified. */ websWrite(wp, T("Server: %s\r\n"), WEBS_NAME); -/* +/* * Timestamp/Date is usually the next to go */ if ((date = websGetDateString(NULL)) != NULL) { @@ -1341,23 +1341,23 @@ void websResponse(webs_t wp, int code, char_t *message, char_t *redirect) */ if (code == 401) { if (!(wp->flags & WEBS_AUTH_DIGEST)) { - websWrite(wp, T("WWW-Authenticate: Basic realm=\"%s\"\r\n"), + websWrite(wp, T("WWW-Authenticate: Basic realm=\"%s\"\r\n"), websGetRealm()); #ifdef DIGEST_ACCESS_SUPPORT } else { char_t *nonce, *opaque; /* $$$ before... (note commas instead of semicolons...) - nonce = websCalcNonce(wp), - opaque = websCalcOpaque(wp), + nonce = websCalcNonce(wp), + opaque = websCalcOpaque(wp), $$$ after */ nonce = websCalcNonce(wp); - opaque = websCalcOpaque(wp); + opaque = websCalcOpaque(wp); /* ...$$$ end */ - websWrite(wp, + websWrite(wp, T("WWW-Authenticate: Digest realm=\"%s\", domain=\"%s\",") T("qop=\"%s\", nonce=\"%s\", opaque=\"%s\",") - T("algorithm=\"%s\", stale=\"%s\"\r\n"), + T("algorithm=\"%s\", stale=\"%s\"\r\n"), websGetRealm(), websGetHostUrl(), T("auth"), @@ -1376,8 +1376,8 @@ void websResponse(webs_t wp, int code, char_t *message, char_t *redirect) websWrite(wp, T("Pragma: no-cache\r\nCache-Control: no-cache\r\n")); websWrite(wp, T("Content-Type: text/html\r\n")); /* - * We don't do a string length here as the message may be multi-line. - * Ie. <CR><LF> will count as only one and we will have a content-length + * We don't do a string length here as the message may be multi-line. + * Ie. <CR><LF> will count as only one and we will have a content-length * that is too short. * * websWrite(wp, T("Content-Length: %s\r\n"), message); @@ -1436,7 +1436,7 @@ void websRedirect(webs_t wp, char_t *url) /* * Add human readable message for completeness. Should not be required. */ - fmtAlloc(&msgbuf, WEBS_MAX_URL + 80, + fmtAlloc(&msgbuf, WEBS_MAX_URL + 80, T("<html><head></head><body>\r\n\ This document has moved to a new <a href=\"%s\">location</a>.\r\n\ Please update your documents to reflect the new location.\r\n\ @@ -1449,7 +1449,7 @@ void websRedirect(webs_t wp, char_t *url) } /******************************************************************************/ -/* +/* * Output an error message and cleanup */ @@ -1478,7 +1478,7 @@ void websError(webs_t wp, int code, char_t *fmt, ...) #ifdef qRichErrorPage if (!reEntry) { - /* + /* * The dmfRichError function that we're about to call may very well call * websError() as part of its work. If that happens, we do NOT want to * get into a never-ending recursive call chain. When we get back here @@ -1506,7 +1506,7 @@ void websError(webs_t wp, int code, char_t *fmt, ...) * Ensure we have plenty of room */ buf = NULL; - fmtAlloc(&buf, WEBS_BUFSIZE, msg, websErrorMsg(code), + fmtAlloc(&buf, WEBS_BUFSIZE, msg, websErrorMsg(code), websErrorMsg(code), wp->url, userMsg); websResponse(wp, code, buf, NULL); @@ -1544,7 +1544,7 @@ int websWrite(webs_t wp, char_t *fmt, ...) va_list vargs; char_t *buf; int rc; - + a_assert(websValid(wp)); va_start(vargs, fmt); @@ -1555,7 +1555,7 @@ int websWrite(webs_t wp, char_t *fmt, ...) if (fmtValloc(&buf, WEBS_BUFSIZE, fmt, vargs) >= WEBS_BUFSIZE) { trace(0, T("webs: websWrite lost data, buffer overflow\n")); } - + va_end(vargs); a_assert(buf); if (buf) { @@ -1568,9 +1568,9 @@ int websWrite(webs_t wp, char_t *fmt, ...) /******************************************************************************/ /* * Write a block of data of length "nChars" to the user's browser. Public - * write block procedure. If unicode is turned on this function expects + * write block procedure. If unicode is turned on this function expects * buf to be a unicode string and it converts it to ASCII before writing. - * See websWriteDataNonBlock to always write binary or ASCII data with no + * See websWriteDataNonBlock to always write binary or ASCII data with no * unicode conversion. This returns the number of char_t's processed. * It spins until nChars are flushed to the socket. For non-blocking * behavior, use websWriteDataNonBlock. @@ -1594,7 +1594,7 @@ int websWriteBlock(webs_t wp, char_t *buf, int nChars) */ pBuf = asciiBuf = ballocUniToAsc(buf, nChars); - while (nChars > 0) { + while (nChars > 0) { #ifdef WEBS_SSL_SUPPORT if (wp->flags & WEBS_SECURE) { if ((len = websSSLWrite(wp->wsp, pBuf, nChars)) < 0) { @@ -1669,7 +1669,7 @@ void websDecodeUrl(char_t *decoded, char_t *token, int len) { char_t *ip, *op; int num, i, c; - + a_assert(decoded); a_assert(token); @@ -1731,10 +1731,10 @@ static void websLog(webs_t wp, int code) { *newLine = '\0'; } - fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%s\t%s\t%s\tcode = %d\n"), + fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%s\t%s\t%s\tcode = %d\n"), timeStr, wp->ipaddr, wp->url, code); #else - fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%d %s %d %d\n"), time(0), + fmtAlloc(&buf, WEBS_MAX_URL + 80, T("%d %s %d %d\n"), time(0), wp->url, code, wp->written); #endif len = gstrlen(buf); @@ -1828,7 +1828,7 @@ void websDone(webs_t wp, int code) /* * If using Keep Alive (HTTP/1.1) we keep the socket open for a period - * while waiting for another request on the socket. + * while waiting for another request on the socket. */ if (wp->flags & WEBS_KEEP_ALIVE) { if (socketFlush(wp->sid) == 0) { @@ -1837,7 +1837,7 @@ void websDone(webs_t wp, int code) if (wp->header.buf) { ringqFlush(&wp->header); } - socketCreateHandler(wp->sid, SOCKET_READABLE, websSocketEvent, + socketCreateHandler(wp->sid, SOCKET_READABLE, websSocketEvent, (int) wp); websTimeoutCancel(wp); wp->timeout = emfSchedCallback(WEBS_TIMEOUT, websTimeout, @@ -2242,7 +2242,7 @@ void websSetRequestPath(webs_t wp, char_t *dir, char_t *path) a_assert(websValid(wp)); - if (dir) { + if (dir) { tmp = wp->dir; wp->dir = bstrdup(B_L, dir); if (tmp) { @@ -2372,17 +2372,17 @@ char_t *websGetRealm(void) #ifdef WEBS_IF_MODIFIED_SUPPORT /******************************************************************************/ -/* - * These functions are intended to closely mirror the syntax for HTTP-date +/* + * These functions are intended to closely mirror the syntax for HTTP-date * from RFC 2616 (HTTP/1.1 spec). This code was submitted by Pete Bergstrom. */ -/* +/* * RFC1123Date = wkday "," SP date1 SP time SP "GMT" * RFC850Date = weekday "," SP date2 SP time SP "GMT" * ASCTimeDate = wkday SP date3 SP time SP 4DIGIT * - * Each of these functions tries to parse the value and update the index to + * Each of these functions tries to parse the value and update the index to * the point it leaves off parsing. */ @@ -2390,11 +2390,11 @@ typedef enum { JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC } Mont typedef enum { SUN, MON, TUE, WED, THU, FRI, SAT } WeekdayEnumeration; /******************************************************************************/ -/* +/* * Parse an N-digit value */ -static int parseNDIGIT(char_t *buf, int digits, int *index) +static int parseNDIGIT(char_t *buf, int digits, int *index) { int tmpIndex, returnValue; @@ -2406,7 +2406,7 @@ static int parseNDIGIT(char_t *buf, int digits, int *index) } } *index = tmpIndex; - + return returnValue; } @@ -2415,10 +2415,10 @@ static int parseNDIGIT(char_t *buf, int digits, int *index) * Return an index into the month array */ -static int parseMonth(char_t *buf, int *index) +static int parseMonth(char_t *buf, int *index) { -/* - * "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | +/* + * "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | * "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec" */ int tmpIndex, returnValue; @@ -2493,11 +2493,11 @@ static int parseMonth(char_t *buf, int *index) } /******************************************************************************/ -/* +/* * Parse a year value (either 2 or 4 digits) */ -static int parseYear(char_t *buf, int *index) +static int parseYear(char_t *buf, int *index) { int tmpIndex, returnValue; @@ -2510,7 +2510,7 @@ static int parseYear(char_t *buf, int *index) returnValue = parseNDIGIT(buf, 2, &tmpIndex); if (returnValue >= 0) { /* - * Assume that any year earlier than the start of the + * Assume that any year earlier than the start of the * epoch for time_t (1970) specifies 20xx */ if (returnValue < 70) { @@ -2527,8 +2527,8 @@ static int parseYear(char_t *buf, int *index) } /******************************************************************************/ -/* - * The formulas used to build these functions are from "Calendrical Calculations", +/* + * The formulas used to build these functions are from "Calendrical Calculations", * by Nachum Dershowitz, Edward M. Reingold, Cambridge University Press, 1997. */ @@ -2541,11 +2541,11 @@ const int GregorianEpoch = 1; * Determine if year is a leap year */ -int GregorianLeapYearP(long year) +int GregorianLeapYearP(long year) { int result; long tmp; - + tmp = year % 400; if ((year % 4 == 0) && @@ -2565,14 +2565,14 @@ int GregorianLeapYearP(long year) * Return the fixed date from the gregorian date */ -long FixedFromGregorian(long month, long day, long year) +long FixedFromGregorian(long month, long day, long year) { long fixedDate; - fixedDate = (long)(GregorianEpoch - 1 + 365 * (year - 1) + + fixedDate = (long)(GregorianEpoch - 1 + 365 * (year - 1) + floor((year - 1) / 4.0) - - floor((double)(year - 1) / 100.0) + - floor((double)(year - 1) / 400.0) + + floor((double)(year - 1) / 100.0) + + floor((double)(year - 1) / 400.0) + floor((367.0 * ((double)month) - 362.0) / 12.0)); if (month <= 2) { @@ -2593,7 +2593,7 @@ long FixedFromGregorian(long month, long day, long year) * Return the gregorian year from a fixed date */ -long GregorianYearFromFixed(long fixedDate) +long GregorianYearFromFixed(long fixedDate) { long result, d0, n400, d1, n100, d2, n4, d3, n1, d4, year; @@ -2618,13 +2618,13 @@ long GregorianYearFromFixed(long fixedDate) } /******************************************************************************/ -/* +/* * Returns the Gregorian date from a fixed date * (not needed for this use, but included for completeness */ #if 0 -GregorianFromFixed(long fixedDate, long *month, long *day, long *year) +GregorianFromFixed(long fixedDate, long *month, long *day, long *year) { long priorDays, correction; @@ -2645,14 +2645,14 @@ GregorianFromFixed(long fixedDate, long *month, long *day, long *year) #endif /******************************************************************************/ -/* +/* * Returns the difference between two Gregorian dates */ long GregorianDateDifference( long month1, long day1, long year1, - long month2, long day2, long year2) + long month2, long day2, long year2) { - return FixedFromGregorian(month2, day2, year2) - + return FixedFromGregorian(month2, day2, year2) - FixedFromGregorian(month1, day1, year1); } @@ -2664,9 +2664,9 @@ long GregorianDateDifference( long month1, long day1, long year1, #define SECONDS_PER_DAY 24*60*60 -static int parseTime(char_t *buf, int *index) +static int parseTime(char_t *buf, int *index) { -/* +/* * Format of buf is - 2DIGIT ":" 2DIGIT ":" 2DIGIT */ int returnValue, tmpIndex, hourValue, minuteValue, secondValue; @@ -2701,17 +2701,17 @@ static int parseTime(char_t *buf, int *index) * Return the equivalent of time() given a gregorian date */ -static time_t dateToTimet(int year, int month, int day) +static time_t dateToTimet(int year, int month, int day) { long dayDifference; - /* - * Bug fix by Jeff Reeder (Jun 14, 2002): The 'month' parameter is - * numbered from 0 (Jan == 0), but FixedFromGregorian() takes - * months numbered from 1 (January == 1). We need to add 1 - * to the month + /* + * Bug fix by Jeff Reeder (Jun 14, 2002): The 'month' parameter is + * numbered from 0 (Jan == 0), but FixedFromGregorian() takes + * months numbered from 1 (January == 1). We need to add 1 + * to the month */ - dayDifference = FixedFromGregorian(month + 1, day, year) - + dayDifference = FixedFromGregorian(month + 1, day, year) - FixedFromGregorian(1, 1, 1970); return dayDifference * SECONDS_PER_DAY; @@ -2723,9 +2723,9 @@ static time_t dateToTimet(int year, int month, int day) * (corresponds to documentation for time() function) */ -static time_t parseDate1or2(char_t *buf, int *index) +static time_t parseDate1or2(char_t *buf, int *index) { -/* +/* * Format of buf is either * 2DIGIT SP month SP 4DIGIT * or @@ -2740,23 +2740,23 @@ static time_t parseDate1or2(char_t *buf, int *index) dayValue = monthValue = yearValue = -1; if (buf[tmpIndex] == T(',')) { -/* - * Skip over the ", " +/* + * Skip over the ", " */ - tmpIndex += 2; + tmpIndex += 2; dayValue = parseNDIGIT(buf, 2, &tmpIndex); if (dayValue >= 0) { /* * Skip over the space or hyphen */ - tmpIndex++; + tmpIndex++; monthValue = parseMonth(buf, &tmpIndex); if (monthValue >= 0) { /* * Skip over the space or hyphen */ - tmpIndex++; + tmpIndex++; yearValue = parseYear(buf, &tmpIndex); } } @@ -2765,17 +2765,17 @@ static time_t parseDate1or2(char_t *buf, int *index) (monthValue >= 0) && (yearValue >= 0)) { if (yearValue < 1970) { -/* - * Allow for Microsoft IE's year 1601 dates +/* + * Allow for Microsoft IE's year 1601 dates */ - returnValue = 0; + returnValue = 0; } else { returnValue = dateToTimet(yearValue, monthValue, dayValue); } *index = tmpIndex; } } - + return returnValue; } @@ -2784,7 +2784,7 @@ static time_t parseDate1or2(char_t *buf, int *index) * Return the number of seconds between Jan 1, 1970 and the parsed date */ -static time_t parseDate3Time(char_t *buf, int *index) +static time_t parseDate3Time(char_t *buf, int *index) { /* * Format of buf is month SP ( 2DIGIT | ( SP 1DIGIT )) @@ -2799,25 +2799,25 @@ static time_t parseDate3Time(char_t *buf, int *index) monthValue = parseMonth(buf, &tmpIndex); if (monthValue >= 0) { -/* - * Skip over the space +/* + * Skip over the space */ - tmpIndex++; + tmpIndex++; if (buf[tmpIndex] == T(' ')) { /* - * Skip over this space too + * Skip over this space too */ - tmpIndex++; + tmpIndex++; dayValue = parseNDIGIT(buf, 1, &tmpIndex); } else { dayValue = parseNDIGIT(buf, 2, &tmpIndex); } -/* +/* * Now get the time and time SP 4DIGIT */ timeValue = parseTime(buf, &tmpIndex); if (timeValue >= 0) { -/* +/* * Now grab the 4DIGIT year value */ yearValue = parseYear(buf, &tmpIndex); @@ -2831,7 +2831,7 @@ static time_t parseDate3Time(char_t *buf, int *index) returnValue += timeValue; *index = tmpIndex; } - + return returnValue; } @@ -2840,12 +2840,12 @@ static time_t parseDate3Time(char_t *buf, int *index) /* * Although this looks like a trivial function, I found I was replicating the implementation * seven times in the parseWeekday function. In the interests of minimizing code size - * and redundancy, it is broken out into a separate function. The cost of an extra + * and redundancy, it is broken out into a separate function. The cost of an extra * function call I can live with given that it should only be called once per HTTP request. */ -static int bufferIndexIncrementGivenNTest(char_t *buf, int testIndex, char_t testChar, - int foundIncrement, int notfoundIncrement) +static int bufferIndexIncrementGivenNTest(char_t *buf, int testIndex, char_t testChar, + int foundIncrement, int notfoundIncrement) { if (buf[testIndex] == testChar) { return foundIncrement; @@ -2859,9 +2859,9 @@ static int bufferIndexIncrementGivenNTest(char_t *buf, int testIndex, char_t tes * Return an index into a logical weekday array */ -static int parseWeekday(char_t *buf, int *index) +static int parseWeekday(char_t *buf, int *index) { -/* +/* * Format of buf is either * "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun" * or @@ -2939,7 +2939,7 @@ static time_t dateParse(time_t tip, char_t *cmd) */ timeValue = parseTime(cmd, &index); if (timeValue >= 0) { -/* +/* * Now match up that "GMT" string for completeness * Compute the final value if there were no problems in the parse */ @@ -2950,7 +2950,7 @@ static time_t dateParse(time_t tip, char_t *cmd) } } } else { -/* +/* * Try the other form - wkday SP date3 SP time SP 4DIGIT */ tmpIndex = index; diff --git a/cpukit/httpd/webs.h b/cpukit/httpd/webs.h index 90932b1452..1bf96f8256 100644 --- a/cpukit/httpd/webs.h +++ b/cpukit/httpd/webs.h @@ -1,4 +1,4 @@ -/* +/* * webs.h -- GoAhead Web public header * * Copyright (c) GoAhead Software Inc., 1992-2000. All Rights Reserved. @@ -13,7 +13,7 @@ /******************************** Description *********************************/ -/* +/* * GoAhead Web Server header. This defines the Web public APIs. * Include this header for files that contain ASP or Form procedures. * Include wsIntrn.h when creating URL handlers. @@ -45,18 +45,18 @@ #define WEBS_HTTP_PORT T("httpPort") #define CGI_BIN T("cgi-bin") -/* +/* * Request flags. Also returned by websGetRequestFlags(). */ -#define WEBS_LOCAL_PAGE 0x1 /* Request for local webs page */ +#define WEBS_LOCAL_PAGE 0x1 /* Request for local webs page */ #define WEBS_KEEP_ALIVE 0x2 /* HTTP/1.1 keep alive */ #define WEBS_DONT_USE_CACHE 0x4 /* Not implemented cache support */ #define WEBS_COOKIE 0x8 /* Cookie supplied in request */ #define WEBS_IF_MODIFIED 0x10 /* If-modified-since in request */ #define WEBS_POST_REQUEST 0x20 /* Post request operation */ #define WEBS_LOCAL_REQUEST 0x40 /* Request from this system */ -#define WEBS_HOME_PAGE 0x80 /* Request for the home page */ -#define WEBS_ASP 0x100 /* ASP request */ +#define WEBS_HOME_PAGE 0x80 /* Request for the home page */ +#define WEBS_ASP 0x100 /* ASP request */ #define WEBS_HEAD_REQUEST 0x200 /* Head request */ #define WEBS_CLEN 0x400 /* Request had a content length */ #define WEBS_FORM 0x800 /* Request is a form */ @@ -74,7 +74,7 @@ #define WEBS_HANDLER_FIRST 0x1 /* Process this handler first */ #define WEBS_HANDLER_LAST 0x2 /* Process this handler last */ -/* +/* * Per socket connection webs structure */ typedef struct websRec { @@ -133,7 +133,7 @@ typedef websRec websType; /******************************** Prototypes **********************************/ extern int websAccept(int sid, char *ipaddr, int port, int listenSid); -extern int websAspDefine(char_t *name, +extern int websAspDefine(char_t *name, int (*fn)(int ejid, webs_t wp, int argc, char_t **argv)); extern int websAspRequest(webs_t wp, char_t *lpath); extern void websCloseListen(void); @@ -145,7 +145,7 @@ extern void websError(webs_t wp, int code, char_t *msg, ...); /* function websErrorMsg() made extern 03 Jun 02 BgP */ extern char_t *websErrorMsg(int code); extern void websFooter(webs_t wp); -extern int websFormDefine(char_t *name, void (*fn)(webs_t wp, +extern int websFormDefine(char_t *name, void (*fn)(webs_t wp, char_t *path, char_t *query)); extern char_t *websGetDefaultDir(void); extern char_t *websGetDefaultPage(void); @@ -174,8 +174,8 @@ extern void websPageClose(webs_t wp); extern int websPublish(char_t *urlPrefix, char_t *path); extern void websRedirect(webs_t wp, char_t *url); extern void websSecurityDelete(void); -extern int websSecurityHandler(webs_t wp, char_t *urlPrefix, - char_t *webDir, int arg, char_t *url, char_t *path, +extern int websSecurityHandler(webs_t wp, char_t *urlPrefix, + char_t *webDir, int arg, char_t *url, char_t *path, char_t *query); extern void websSetDefaultDir(char_t *dir); extern void websSetDefaultPage(char_t *page); @@ -193,16 +193,16 @@ extern void websSetRequestWritten(webs_t wp, int written); extern void websSetVar(webs_t wp, char_t *var, char_t *value); extern int websTestVar(webs_t wp, char_t *var); extern void websTimeoutCancel(webs_t wp); -extern int websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir, - int arg, int (*fn)(webs_t wp, char_t *urlPrefix, - char_t *webDir, int arg, char_t *url, char_t *path, +extern int websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir, + int arg, int (*fn)(webs_t wp, char_t *urlPrefix, + char_t *webDir, int arg, char_t *url, char_t *path, char_t *query), int flags); extern int websUrlHandlerDelete(int (*fn)(webs_t wp, char_t *urlPrefix, - char_t *webDir, int arg, char_t *url, char_t *path, + char_t *webDir, int arg, char_t *url, char_t *path, char_t *query)); extern int websUrlHandlerRequest(webs_t wp); -extern int websUrlParse(char_t *url, char_t **buf, char_t **host, - char_t **path, char_t **port, char_t **query, +extern int websUrlParse(char_t *url, char_t **buf, char_t **host, + char_t **path, char_t **port, char_t **query, char_t **proto, char_t **tag, char_t **ext); extern char_t *websUrlType(char_t *webs, char_t *buf, int charCnt); extern int websWrite(webs_t wp, char_t* fmt, ...); @@ -221,7 +221,7 @@ extern void websTimeout(void *arg, int id); extern void websReadEvent(webs_t wp); /* - * Prototypes for functions available when running as part of the + * Prototypes for functions available when running as part of the * GoAhead Embedded Management Framework (EMF) */ #ifdef EMF diff --git a/cpukit/httpd/websSSL.c b/cpukit/httpd/websSSL.c index 6c2e4ce5da..a3c3fdc232 100644 --- a/cpukit/httpd/websSSL.c +++ b/cpukit/httpd/websSSL.c @@ -65,8 +65,8 @@ extern void SSLC_add_all_algorithms(void); /*************************** Forward Declarations *****************************/ -static int websSSLSetCertStuff(SSL_CTX *ctx, - char *cert_file, +static int websSSLSetCertStuff(SSL_CTX *ctx, + char *cert_file, char *key_file); static int websSSLVerifyCallback(int ok, X509_STORE_CTX *ctx); static RSA *websSSLTempRSACallback(SSL *s, int is_export, int keylength); @@ -91,12 +91,12 @@ int websSSLOpen() { char *certFile, *keyFile, *CApath, *CAfile; SSL_METHOD *meth; - + /* * Install and initialize the SSL library */ apps_startup(); - trace(7, T("SSL: Initializing SSL\n")); + trace(7, T("SSL: Initializing SSL\n")); #ifdef SSLC SSL_library_init(); @@ -117,7 +117,7 @@ int websSSLOpen() a_assert(sslctx); if (sslctx == NULL) { - trace(2, T("SSL: Unable to create SSL context!\n")); + trace(2, T("SSL: Unable to create SSL context!\n")); return -1; } @@ -135,7 +135,7 @@ int websSSLOpen() CAfile = DEFAULT_CA_FILE; if ((!SSL_CTX_load_verify_locations(sslctx, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(sslctx))) { - trace(2, T("SSL: Unable to set cert verification locations!\n")); + trace(2, T("SSL: Unable to set cert verification locations!\n")); websSSLClose(); return -1; } @@ -168,11 +168,11 @@ int websSSLOpen() /* * Open the socket */ - sslListenSock = socketOpenConnection(NULL, SSL_PORT, + sslListenSock = socketOpenConnection(NULL, SSL_PORT, websSSLAccept, SOCKET_BLOCK); if (sslListenSock < 0) { - trace(2, T("SSL: Unable to open SSL socket on port <%d>!\n"), + trace(2, T("SSL: Unable to open SSL socket on port <%d>!\n"), SSL_PORT); return -1; } @@ -197,7 +197,7 @@ int websSSLIsOpen() void websSSLClose() { - trace(7, T("SSL: Closing SSL\n")); + trace(7, T("SSL: Closing SSL\n")); if (sslctx != NULL) { SSL_CTX_free(sslctx); @@ -245,8 +245,8 @@ int websSSLAccept(int sid, char *ipaddr, int port, int listenSid) * Check if this is a request from a browser on this system. This is useful * to know for permitting administrative operations only for local access */ - if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 || - gstrcmp(wp->ipaddr, websIpaddr) == 0 || + if (gstrcmp(wp->ipaddr, T("127.0.0.1")) == 0 || + gstrcmp(wp->ipaddr, websIpaddr) == 0 || gstrcmp(wp->ipaddr, websHost) == 0) { wp->flags |= WEBS_LOCAL_REQUEST; } @@ -288,12 +288,12 @@ static void websSSLSocketEvent(int sid, int mask, int iwp) if (mask & SOCKET_READABLE) { websSSLReadEvent(wp); - } + } if (mask & SOCKET_WRITABLE) { if (wp->writeSocket) { (*wp->writeSocket)(wp); } - } + } } /******************************************************************************/ @@ -432,10 +432,10 @@ int websSSLSetCertStuff(SSL_CTX *ctx, char *certFile, char *keyFile) a_assert (certFile); if (certFile != NULL) { - if (SSL_CTX_use_certificate_file(ctx, certFile, + if (SSL_CTX_use_certificate_file(ctx, certFile, SSL_FILETYPE_PEM) <= 0) { trace(2, T("SSL: Unable to set certificate file <%s>\n"), - certFile); + certFile); return -1; } @@ -445,17 +445,17 @@ int websSSLSetCertStuff(SSL_CTX *ctx, char *certFile, char *keyFile) if (SSL_CTX_use_PrivateKey_file(ctx, keyFile, SSL_FILETYPE_PEM) <= 0) { trace(2, T("SSL: Unable to set private key file <%s>\n"), - keyFile); + keyFile); return -1; } -/* +/* * Now we know that a key and cert have been set against - * the SSL context + * the SSL context */ if (!SSL_CTX_check_private_key(ctx)) { trace(2, T("SSL: Check of private key file <%s> FAILED!\n"), - keyFile); + keyFile); return -1; } } @@ -477,11 +477,11 @@ int websSSLSetCertFile(char_t *certFile) return -1; } - if (SSL_CTX_use_certificate_file(sslctx, certFile, + if (SSL_CTX_use_certificate_file(sslctx, certFile, SSL_FILETYPE_PEM) <= 0) { return -1; } -/* +/* * Confirm that the certificate and the private key jive. */ if (!SSL_CTX_check_private_key(sslctx)) { @@ -508,7 +508,7 @@ int websSSLSetKeyFile(char_t *keyFile) if (SSL_CTX_use_PrivateKey_file(sslctx, keyFile, SSL_FILETYPE_PEM) <= 0) { return -1; } -/* +/* * Confirm that the certificate and the private key jive. */ if (!SSL_CTX_check_private_key(sslctx)) { @@ -548,7 +548,7 @@ static RSA *websSSLTempRSACallback(SSL *ssl, int isExport, int keyLength) /******************************************************************************/ /* - * Free SSL resources + * Free SSL resources */ int websSSLFree(websSSL_t *wsp) @@ -557,7 +557,7 @@ int websSSLFree(websSSL_t *wsp) return -1; } -/* +/* * Make sure we re-use sessions */ if (wsp->ssl != NULL) { @@ -584,7 +584,7 @@ int websSSLEof(websSSL_t *wsp) if ((wsp == NULL) || (wsp->bio == NULL)) { return -1; - } + } return BIO_eof(wsp->bio); } @@ -601,7 +601,7 @@ int websSSLRead(websSSL_t *wsp, char_t *buf, int len) if ((wsp == NULL) || (wsp->bio == NULL)) { return -1; - } + } return BIO_read(wsp->bio, buf, len); } @@ -626,14 +626,14 @@ int websSSLGets(websSSL_t *wsp, char_t **buf) if ((wsp == NULL) || (wsp->bio == NULL)) { return -1; - } + } while (1) { if ((rc = BIO_read(wsp->bio, &c, 1)) < 0) { return rc; } - + if (rc == 0) { /* * If there is a partial line and we are at EOF, pretend we saw a '\n' @@ -655,7 +655,7 @@ int websSSLGets(websSSL_t *wsp, char_t **buf) return len; } else if (c == '\r') { continue; - } + } /* * Append character to buf */ @@ -682,7 +682,7 @@ int websSSLWrite(websSSL_t *wsp, char_t *buf, int len) if ((wsp == NULL) || (wsp->bio == NULL)) { return -1; - } + } return BIO_write(wsp->bio, buf, len); } @@ -698,7 +698,7 @@ int websSSLFlush(websSSL_t *wsp) if ((wsp == NULL) || (wsp->bio == NULL)) { return -1; - } + } return BIO_flush(wsp->bio); } diff --git a/cpukit/httpd/websSSL.h b/cpukit/httpd/websSSL.h index 62bcc44930..8e09703476 100644 --- a/cpukit/httpd/websSSL.h +++ b/cpukit/httpd/websSSL.h @@ -1,4 +1,4 @@ -/* +/* * websSSL.h -- SSL Patch header * * Copyright (c) GoAhead Software Inc., 1992-2000. All Rights Reserved. @@ -13,8 +13,8 @@ /******************************** Description *********************************/ -/* - * Header file for the GoAhead Patch for SSL. This defines the interface to +/* + * Header file for the GoAhead Patch for SSL. This defines the interface to * integrate SSL into the GoAhead Webserver. */ diff --git a/cpukit/httpd/websda.c b/cpukit/httpd/websda.c index a4a95775b8..21d8ac6921 100644 --- a/cpukit/httpd/websda.c +++ b/cpukit/httpd/websda.c @@ -74,7 +74,7 @@ char *websMD5binary(unsigned char *buf, int length) /*****************************************************************************/ /* - * Convenience call to websMD5binary + * Convenience call to websMD5binary * (Performs char_t to char conversion and back) */ @@ -115,9 +115,9 @@ char_t *websMD5(char_t *string) /******************************************************************************/ /* - * Get a Nonce value for passing along to the client. This function - * composes the string "RANDOMKEY:timestamp:myrealm" and - * calculates the MD5 digest placing it in output. + * Get a Nonce value for passing along to the client. This function + * composes the string "RANDOMKEY:timestamp:myrealm" and + * calculates the MD5 digest placing it in output. */ char_t *websCalcNonce(webs_t wp) @@ -141,10 +141,10 @@ char_t *websCalcNonce(webs_t wp) prenonce = NULL; #ifdef DIGEST_ACCESS_SUPPORT fmtAlloc(&prenonce, 256, T("%s:%s:%s"), RANDOMKEY, gasctime(newtime), - wp->realm); + wp->realm); #else - fmtAlloc(&prenonce, 256, T("%s:%s:%s"), RANDOMKEY, gasctime(newtime), - RANDOMKEY); + fmtAlloc(&prenonce, 256, T("%s:%s:%s"), RANDOMKEY, gasctime(newtime), + RANDOMKEY); #endif a_assert(prenonce); /* @@ -218,8 +218,8 @@ char_t *websCalcDigest(webs_t wp) if (!wp->qop) { fmtAlloc(&preDigest, 255, T("%s:%s:%s"), a1prime, wp->nonce, a2prime); } else { - fmtAlloc(&preDigest, 255, T("%s:%s:%s:%s:%s:%s"), - a1prime, + fmtAlloc(&preDigest, 255, T("%s:%s:%s:%s:%s:%s"), + a1prime, wp->nonce, wp->nc, wp->cnonce, diff --git a/cpukit/httpd/websda.h b/cpukit/httpd/websda.h index 3852ab8f53..1bb5424d90 100644 --- a/cpukit/httpd/websda.h +++ b/cpukit/httpd/websda.h @@ -1,4 +1,4 @@ -/* +/* * websda.h -- GoAhead Digest Access Authentication public header * * Copyright (c) GoAhead Software Inc., 1992-2000. All Rights Reserved. @@ -13,9 +13,9 @@ /******************************** Description *********************************/ -/* - * GoAhead Digest Access Authentication header. This defines the Digest - * access authentication public APIs. Include this header for files that +/* + * GoAhead Digest Access Authentication header. This defines the Digest + * access authentication public APIs. Include this header for files that * use DAA functions */ diff --git a/cpukit/httpd/websuemf.c b/cpukit/httpd/websuemf.c index 1b4c78c894..262956ee5f 100644 --- a/cpukit/httpd/websuemf.c +++ b/cpukit/httpd/websuemf.c @@ -147,7 +147,7 @@ void emfReschedCallback(int schedid, int delay) { sched_t *s; - if (sched == NULL || schedid == -1 || schedid >= schedMax || + if (sched == NULL || schedid == -1 || schedid >= schedMax || (s = sched[schedid]) == NULL) { return; } @@ -160,7 +160,7 @@ void emfUnschedCallback(int schedid) { sched_t *s; - if (sched == NULL || schedid == -1 || schedid >= schedMax || + if (sched == NULL || schedid == -1 || schedid >= schedMax || (s = sched[schedid]) == NULL) { return; } @@ -177,7 +177,7 @@ void emfSchedProcess(void) { sched_t *s; int schedid; - static int next = 0; + static int next = 0; /* * If schedMax is 0, there are no tasks scheduled, so just return. @@ -206,7 +206,7 @@ void emfSchedProcess(void) } if (schedid == next) { /* - * We've gone all the way through the queue without finding + * We've gone all the way through the queue without finding * anything to do so just return. */ return; diff --git a/cpukit/httpd/wsIntrn.h b/cpukit/httpd/wsIntrn.h index 9d143917e4..b6e89d5571 100644 --- a/cpukit/httpd/wsIntrn.h +++ b/cpukit/httpd/wsIntrn.h @@ -1,4 +1,4 @@ -/* +/* * wsIntrn.h -- Internal GoAhead Web server header * * Copyright (c) GoAhead Software Inc., 1992-2000. All Rights Reserved. @@ -7,13 +7,13 @@ * * $Id$ */ - + #ifndef _h_WEBS_INTERNAL #define _h_WEBS_INTERNAL 1 /******************************** Description *********************************/ -/* +/* * Internal GoAhead Web Server header. This defines the Web private APIs * Include this header when you want to create URL handlers. */ @@ -21,7 +21,7 @@ /*********************************** Defines **********************************/ /* - * Define this to enable logging of web accesses to a file + * Define this to enable logging of web accesses to a file * #define WEBS_LOG_SUPPORT 1 * * Define this to enable HTTP/1.1 keep alive support @@ -129,7 +129,7 @@ #include "webs.h" /********************************** Defines ***********************************/ -/* +/* * Read handler flags and state */ #define WEBS_BEGIN 0x1 /* Beginning state */ @@ -147,10 +147,10 @@ /* * URL handler structure. Stores the leading URL path and the handler * function to call when the URL path is seen. - */ + */ typedef struct { - int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, - char_t *url, char_t *path, + int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, + char_t *url, char_t *path, char_t *query); /* Callback URL handler function */ char_t *webDir; /* Web directory if required */ char_t *urlPrefix; /* URL leading prefix */ @@ -159,7 +159,7 @@ typedef struct { int flags; /* Flags */ } websUrlHandlerType; -/* +/* * Webs statistics */ typedef struct { @@ -179,7 +179,7 @@ typedef struct { extern websStatsType websStats; /* Web access stats */ -/* +/* * Error code list */ typedef struct { @@ -187,7 +187,7 @@ typedef struct { char_t *msg; /* HTTP error message */ } websErrorType; -/* +/* * Mime type list */ typedef struct { @@ -244,8 +244,8 @@ extern void websFormOpen(void); extern void websFormClose(void); extern int websAspWrite(int ejid, webs_t wp, int argc, char_t **argv); extern void websDefaultClose(void); -extern int websDefaultHandler(webs_t wp, char_t *urlPrefix, - char_t *webDir, int arg, char_t *url, char_t *path, +extern int websDefaultHandler(webs_t wp, char_t *urlPrefix, + char_t *webDir, int arg, char_t *url, char_t *path, char_t *query); extern int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, char_t *query); @@ -258,7 +258,7 @@ extern char_t *websGetCgiCommName(void); extern int websLaunchCgiProc(char_t *cgiPath, char_t **argp, char_t **envp, char_t *stdIn, char_t *stdOut); extern int websOpen(int sid); -extern void websResponse(webs_t wp, int code, char_t *msg, +extern void websResponse(webs_t wp, int code, char_t *msg, char_t *redirect); extern int websJavaScriptEval(webs_t wp, char_t *script); extern int websPageReadData(webs_t wp, char *buf, int nBytes); @@ -276,10 +276,10 @@ extern void websRomPageClose(int fd); extern int websRomPageReadData(webs_t wp, char *buf, int len); extern int websRomPageStat(char_t *path, websStatType *sbuf); extern long websRomPageSeek(webs_t wp, long offset, int origin); -extern void websSetRequestSocketHandler(webs_t wp, int mask, +extern void websSetRequestSocketHandler(webs_t wp, int mask, void (*fn)(webs_t wp)); extern int websSolutionHandler(webs_t wp, char_t *urlPrefix, - char_t *webDir, int arg, char_t *url, char_t *path, + char_t *webDir, int arg, char_t *url, char_t *path, char_t *query); extern void websUrlHandlerClose(void); extern int websUrlHandlerOpen(void); @@ -290,7 +290,7 @@ extern char_t* websGetDateString(websStatType* sbuf); extern int strcmpci(char_t* s1, char_t* s2); /* - * Prototypes for functions available when running as part of the + * Prototypes for functions available when running as part of the * GoAhead Embedded Management Framework (EMF) */ #ifdef EMF |