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("

ASP Error: %s

\n"), + websWrite(wp, T("

ASP Error: %s

\n"), result); websWrite(wp, T("
%s
"), 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 %s"), url); return 1; - } + } if (websPageStat(wp, lpath, path, &sbuf) < 0) { websError(wp, 400, T("Cannot stat page for URL %s"), 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 #endif /* NW */ -#ifdef SCOV5 +#ifdef SCOV5 #include #include #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("")); @@ -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("")); /* * Add a special "" 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("")); - nBytes += websWrite(wp, T("