code style cleanup

This commit is contained in:
Danny Mayer
2001-07-08 05:09:35 +00:00
parent 0a2d5c9905
commit 68c2ccc953
26 changed files with 564 additions and 573 deletions

View File

@@ -15,48 +15,51 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: DLLMain.c,v 1.1 2001/07/06 05:20:33 mayer Exp $ */
/* $Id: DLLMain.c,v 1.2 2001/07/08 05:08:54 mayer Exp $ */
#include <windows.h>
#include <stdio.h>
BOOL InitSockets(void);
void isc_time_initepoch();
//__declspec(dllexport) extern FILE (*__imp__iob)[];
/*
* Called when we enter the DLL
*/
__declspec(dllexport) BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL,
DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
// The DLL is loading due to process
// initialization or a call to LoadLibrary.
case DLL_PROCESS_ATTACH:
if(!InitSockets())
return(FALSE);
isc_time_initepoch();
break;
switch (fdwReason)
{
/*
* The DLL is loading due to process
* initialization or a call to LoadLibrary.
*/
case DLL_PROCESS_ATTACH:
if (!InitSockets())
return (FALSE);
isc_time_initepoch();
break;
// The attached process creates a new thread.
case DLL_THREAD_ATTACH:
break;
/* The attached process creates a new thread. */
case DLL_THREAD_ATTACH:
break;
// The thread of the attached process terminates.
case DLL_THREAD_DETACH:
break;
/* The thread of the attached process terminates. */
case DLL_THREAD_DETACH:
break;
// The DLL is unloading from a process due to
// process termination or a call to FreeLibrary.
case DLL_PROCESS_DETACH:
break;
/*
* The DLL is unloading from a process due to
* process termination or a call to FreeLibrary.
*/
case DLL_PROCESS_DETACH:
break;
default:
break;
default:
break;
}
return(TRUE);
return (TRUE);
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: app.c,v 1.1 2001/07/06 05:21:44 mayer Exp $ */
/* $Id: app.c,v 1.2 2001/07/08 05:08:55 mayer Exp $ */
#include <config.h>
@@ -41,7 +41,7 @@
#include <isc/thread.h>
static isc_eventlist_t on_run;
static isc_mutex_t lock;
static isc_mutex_t lock;
static isc_boolean_t shutdown_requested = ISC_FALSE;
static isc_boolean_t running = ISC_FALSE;
/*
@@ -55,9 +55,9 @@ static isc_boolean_t want_reload = ISC_FALSE;
static isc_boolean_t blocked = ISC_FALSE;
static isc_thread_t blockedthread;
static isc_thread_t blockedthread;
// Events to wait for
/* Events to wait for */
#define NUM_EVENTS 2
@@ -71,7 +71,7 @@ DWORD dwWaitResult;
/*
* We need to remember which thread is the main thread...
*/
static isc_thread_t main_thread;
static isc_thread_t main_thread;
isc_result_t
isc_app_start(void) {
@@ -87,10 +87,10 @@ isc_app_start(void) {
if (result != ISC_R_SUCCESS)
return (result);
// Create the reload event in a non-signaled state
/* Create the reload event in a non-signaled state */
hEvents[RELOAD_EVENT] = CreateEvent(NULL, FALSE, FALSE, NULL);
// Create the shutdown event in a non-signaled state
/* Create the shutdown event in a non-signaled state */
hEvents[SHUTDOWN_EVENT] = CreateEvent(NULL, FALSE, FALSE, NULL);
ISC_LIST_INIT(on_run);
@@ -99,8 +99,7 @@ isc_app_start(void) {
isc_result_t
isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
void *arg)
{
void *arg) {
isc_event_t *event;
isc_task_t *cloned_task = NULL;
isc_result_t result;
@@ -175,13 +174,13 @@ isc_app_run(void) {
while (!want_shutdown) {
dwWaitResult = WaitForMultipleObjects(NUM_EVENTS,hEvents, FALSE, INFINITE);
// See why we returned
/* See why we returned */
if(WaitSucceeded(dwWaitResult, NUM_EVENTS)) {
if (WaitSucceeded(dwWaitResult, NUM_EVENTS)) {
/*
* The return was due to one of the events being signaled
*/
switch(WaitSucceededIndex(dwWaitResult)) {
switch (WaitSucceededIndex(dwWaitResult)) {
case RELOAD_EVENT:
want_reload = ISC_TRUE;
break;

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: condition.c,v 1.16 2001/07/06 05:05:51 mayer Exp $ */
/* $Id: condition.c,v 1.17 2001/07/08 05:08:56 mayer Exp $ */
#include <config.h>
@@ -131,8 +131,7 @@ isc_condition_wait(isc_condition_t *cond, isc_mutex_t *mutex) {
isc_result_t
isc_condition_waituntil(isc_condition_t *cond, isc_mutex_t *mutex,
isc_time_t *t)
{
isc_time_t *t) {
DWORD milliseconds;
isc_uint64_t microseconds;
isc_time_t now;

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: entropy.c,v 1.2 2001/07/06 05:22:46 mayer Exp $ */
/* $Id: entropy.c,v 1.3 2001/07/08 05:08:57 mayer Exp $ */
/*
* This is the system depenedent part of the ISC entropy API.
@@ -57,7 +57,7 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
added = 0;
while (desired > 0) {
ndesired = ISC_MIN(desired, sizeof(buf));
if(!CryptGenRandom(hcryptprov, ndesired, buf)) {
if (!CryptGenRandom(hcryptprov, ndesired, buf)) {
CryptReleaseContext(hcryptprov, 0);
source->bad = ISC_TRUE;
goto out;
@@ -248,11 +248,11 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
*/
err = CryptAcquireContext(&hcryptprov, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
if(!err){
if (!err){
errval = GetLastError();
ret = ISC_R_IOERROR;
goto errout;
}
ret = ISC_R_IOERROR;
goto errout;
}
source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
if (source == NULL) {

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: errno2result.c,v 1.1 2001/07/06 05:23:58 mayer Exp $ */
/* $Id: errno2result.c,v 1.2 2001/07/08 05:08:58 mayer Exp $ */
#include <config.h>
@@ -66,8 +66,7 @@ isc__errno2result(int posixerrno) {
* Note this will cause a memory leak unless the memory allocated here
* is freed by calling LocalFree
*/
char * FormatError(int error)
{
char * FormatError(int error) {
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -75,39 +74,37 @@ char * FormatError(int error)
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
(LPTSTR) &lpMsgBuf,
0,
NULL);
return(lpMsgBuf);
return (lpMsgBuf);
}
char * __cdecl NTstrMessage(int err)
{
char * __cdecl NTstrMessage(int err) {
char *retmsg = NULL;
DWORD errval = err; /* Copy the error value first in case of other errors */
/* Get the Winsock2 error messages */
if(errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) {
if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) {
retmsg = GetWSAErrorMessage(errval);
if(retmsg != NULL)
return(retmsg);
if (retmsg != NULL)
return (retmsg);
}
/*
* If it's not one of the standard Unix error codes,
* try a system error message
*/
if(errval > (DWORD) _sys_nerr) {
if (errval > (DWORD) _sys_nerr) {
return (FormatError(errval));
}
else {
return(strerror(errval));
return (strerror(errval));
}
}
char * __cdecl NTstrerror(int err)
{
char * __cdecl NTstrerror(int err) {
DWORD errval = err; /* Copy the error value first in case of other errors */
@@ -117,12 +114,10 @@ char * __cdecl NTstrerror(int err)
/*
* This is a replacement for perror, but it also reports the error value.
*/
void __cdecl NTperror(char *errmsg)
{
void __cdecl NTperror(char *errmsg) {
int errval = errno; /* Copy the error value first in case of other errors */
fprintf(stderr, "%s: %s\n", errmsg, NTstrMessage(errval));
}
/*
* This function returns the error string related to Winsock2 errors.
@@ -134,159 +129,209 @@ char * GetWSAErrorMessage(int errval) {
char *msg;
switch(errval) {
switch (errval) {
case WSAEINTR: msg = "Interrupted system call";
break;
case WSAEINTR:
msg = "Interrupted system call";
break;
case WSAEBADF: msg = "Bad file number";
break;
case WSAEBADF:
msg = "Bad file number";
break;
case WSAEACCES: msg = "Permission denied";
break;
case WSAEACCES:
msg = "Permission denied";
break;
case WSAEFAULT: msg = "Bad address";
break;
case WSAEFAULT:
msg = "Bad address";
break;
case WSAEINVAL: msg = "Invalid argument";
break;
case WSAEINVAL:
msg = "Invalid argument";
break;
case WSAEMFILE: msg = "Too many open sockets";
break;
case WSAEMFILE:
msg = "Too many open sockets";
break;
case WSAEWOULDBLOCK: msg = "Operation would block";
break;
case WSAEWOULDBLOCK:
msg = "Operation would block";
break;
case WSAEINPROGRESS: msg = "Operation now in progress";
break;
case WSAEINPROGRESS:
msg = "Operation now in progress";
break;
case WSAEALREADY: msg = "Operation already in progress";
break;
case WSAEALREADY:
msg = "Operation already in progress";
break;
case WSAENOTSOCK: msg = "Socket operation on non-socket";
break;
case WSAENOTSOCK:
msg = "Socket operation on non-socket";
break;
case WSAEDESTADDRREQ: msg = "Destination address required";
break;
case WSAEDESTADDRREQ:
msg = "Destination address required";
break;
case WSAEMSGSIZE: msg = "Message too long";
break;
case WSAEMSGSIZE:
msg = "Message too long";
break;
case WSAEPROTOTYPE: msg = "Protocol wrong type for socket";
break;
case WSAEPROTOTYPE:
msg = "Protocol wrong type for socket";
break;
case WSAENOPROTOOPT: msg = "Bad protocol option";
break;
case WSAENOPROTOOPT:
msg = "Bad protocol option";
break;
case WSAEPROTONOSUPPORT:msg = "Protocol not supported";
break;
case WSAEPROTONOSUPPORT:
msg = "Protocol not supported";
break;
case WSAESOCKTNOSUPPORT:msg = "Socket type not supported";
break;
case WSAESOCKTNOSUPPORT:
msg = "Socket type not supported";
break;
case WSAEOPNOTSUPP: msg = "Operation not supported on socket";
break;
case WSAEOPNOTSUPP:
msg = "Operation not supported on socket";
break;
case WSAEPFNOSUPPORT: msg = "Protocol family not supported";
break;
case WSAEPFNOSUPPORT:
msg = "Protocol family not supported";
break;
case WSAEAFNOSUPPORT: msg = "Address family not supported";
break;
case WSAEAFNOSUPPORT:
msg = "Address family not supported";
break;
case WSAEADDRINUSE: msg = "Address already in use";
break;
case WSAEADDRINUSE:
msg = "Address already in use";
break;
case WSAEADDRNOTAVAIL: msg = "Can't assign requested address";
break;
case WSAEADDRNOTAVAIL:
msg = "Can't assign requested address";
break;
case WSAENETDOWN: msg = "Network is down";
break;
case WSAENETDOWN:
msg = "Network is down";
break;
case WSAENETUNREACH: msg = "Network is unreachable";
break;
case WSAENETUNREACH:
msg = "Network is unreachable";
break;
case WSAENETRESET: msg = "Net connection reset";
break;
case WSAENETRESET:
msg = "Net connection reset";
break;
case WSAECONNABORTED: msg = "Software caused connection abort";
break;
case WSAECONNABORTED:
msg = "Software caused connection abort";
break;
case WSAECONNRESET: msg = "Connection reset by peer";
break;
case WSAECONNRESET:
msg = "Connection reset by peer";
break;
case WSAENOBUFS: msg = "No buffer space available";
break;
case WSAENOBUFS:
msg = "No buffer space available";
break;
case WSAEISCONN: msg = "Socket is already connected";
break;
case WSAEISCONN:
msg = "Socket is already connected";
break;
case WSAENOTCONN: msg = "Socket is not connected";
break;
case WSAENOTCONN:
msg = "Socket is not connected";
break;
case WSAESHUTDOWN: msg = "Can't send after socket shutdown";
break;
case WSAESHUTDOWN:
msg = "Can't send after socket shutdown";
break;
case WSAETOOMANYREFS: msg = "Too many references: can't splice";
break;
case WSAETOOMANYREFS:
msg = "Too many references: can't splice";
break;
case WSAETIMEDOUT: msg = "Connection timed out";
break;
case WSAETIMEDOUT:
msg = "Connection timed out";
break;
case WSAECONNREFUSED: msg = "Connection refused";
break;
case WSAECONNREFUSED:
msg = "Connection refused";
break;
case WSAELOOP: msg = "Too many levels of symbolic links";
break;
case WSAELOOP:
msg = "Too many levels of symbolic links";
break;
case WSAENAMETOOLONG: msg = "File name too long";
break;
case WSAENAMETOOLONG:
msg = "File name too long";
break;
case WSAEHOSTDOWN: msg = "Host is down";
break;
case WSAEHOSTDOWN:
msg = "Host is down";
break;
case WSAEHOSTUNREACH: msg = "No route to host";
break;
case WSAEHOSTUNREACH:
msg = "No route to host";
break;
case WSAENOTEMPTY: msg = "Directory not empty";
break;
case WSAENOTEMPTY:
msg = "Directory not empty";
break;
case WSAEPROCLIM: msg = "Too many processes";
break;
case WSAEPROCLIM:
msg = "Too many processes";
break;
case WSAEUSERS: msg = "Too many users";
break;
case WSAEUSERS:
msg = "Too many users";
break;
case WSAEDQUOT: msg = "Disc quota exceeded";
break;
case WSAEDQUOT:
msg = "Disc quota exceeded";
break;
case WSAESTALE: msg = "Stale NFS file handle";
break;
case WSAESTALE:
msg = "Stale NFS file handle";
break;
case WSAEREMOTE: msg = "Too many levels of remote in path";
break;
case WSAEREMOTE:
msg = "Too many levels of remote in path";
break;
case WSASYSNOTREADY: msg = "Network system is unavailable";
break;
case WSASYSNOTREADY:
msg = "Network system is unavailable";
break;
case WSAVERNOTSUPPORTED:msg = "Winsock version out of range";
break;
case WSAVERNOTSUPPORTED:
msg = "Winsock version out of range";
break;
case WSANOTINITIALISED: msg = "WSAStartup not yet called";
break;
case WSANOTINITIALISED:
msg = "WSAStartup not yet called";
break;
case WSAEDISCON: msg = "Graceful shutdown in progress";
break;
case WSAEDISCON:
msg = "Graceful shutdown in progress";
break;
/*
case WSAHOST_NOT_FOUND: msg = "Host not found";
break;
case WSAHOST_NOT_FOUND:
msg = "Host not found";
break;
case WSANO_DATA: msg = "No host data of that type was found";
break;
case WSANO_DATA:
msg = "No host data of that type was found";
break;
*/
default: msg = NULL;
break;
default:
msg = NULL;
break;
}
return msg;
return (msg);
}
/*
@@ -298,56 +343,75 @@ char * GetCryptErrorMessage(int errval) {
char *msg;
switch(errval) {
switch (errval) {
case NTE_BAD_FLAGS:
msg = "The dwFlags parameter has an illegal value.";
break;
msg = "The dwFlags parameter has an illegal value.";
break;
case NTE_BAD_KEYSET:
msg = "The Registry entry for the key container could not be opened and may not exist.";
break;
msg = "The Registry entry for the key container could not be opened and may not exist.";
break;
case NTE_BAD_KEYSET_PARAM:
msg = "The pszContainer or pszProvider parameter is set to an illegal value.";
break;
msg = "The pszContainer or pszProvider parameter is set to an illegal value.";
break;
case NTE_BAD_PROV_TYPE:
msg = "The value of the dwProvType parameter is out of range. All provider types must be from 1 to 999, inclusive.";
break;
msg = "The value of the dwProvType parameter is out of range. All provider types must be from 1 to 999, inclusive.";
break;
case NTE_BAD_SIGNATURE:
msg = "The provider DLL signature did not verify correctly. Either the DLL or the digital signature has been tampered with.";
break;
msg = "The provider DLL signature did not verify correctly. Either the DLL or the digital signature has been tampered with.";
break;
case NTE_EXISTS:
msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key container already exists.";
break;
msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key"
" container already exists.";
break;
case NTE_KEYSET_ENTRY_BAD:
msg = "The Registry entry for the pszContainer key container was found (in the HKEY_CURRENT_USER window), but is corrupt. See the section System Administration for details about CryptoAPI's Registry usage.";
break;
msg = "The Registry entry for the pszContainer key container"
" was found (in the HKEY_CURRENT_USER window), but is"
" corrupt. See the section System Administration for"
" details about CryptoAPI's Registry usage.";
break;
case NTE_KEYSET_NOT_DEF:
msg = "No Registry entry exists in the HKEY_CURRENT_USER window for the key container specified by pszContainer.";
break;
msg = "No Registry entry exists in the HKEY_CURRENT_USER"
" window for the key container specified by pszContainer.";
break;
case NTE_NO_MEMORY:
msg = "The CSP ran out of memory during the operation.";
break;
msg = "The CSP ran out of memory during the operation.";
break;
case NTE_PROV_DLL_NOT_FOUND:
msg = "The provider DLL file does not exist or is not on the current path.";
break;
msg = "The provider DLL file does not exist or is not on the"
" current path.";
break;
case NTE_PROV_TYPE_ENTRY_BAD:
msg = "The Registry entry for the provider type specified by dwProvType is corrupt. This error may relate to either the user default CSP list or the machine default CSP list. See the section System Administration for details about CryptoAPI's Registry usage.";
break;
msg = "The Registry entry for the provider type specified by"
" dwProvType is corrupt. This error may relate to"
" either the user default CSP list or the machine"
" default CSP list. See the section System"
" Administration for details about CryptoAPI's"
" Registry usage.";
break;
case NTE_PROV_TYPE_NO_MATCH:
msg = "The provider type specified by dwProvType does not match the provider type found in the Registry. Note that this error can only occur when pszProvider specifies an actual CSP name.";
break;
msg = "The provider type specified by dwProvType does not"
" match the provider type found in the Registry. Note"
" that this error can only occur when pszProvider"
" specifies an actual CSP name.";
break;
case NTE_PROV_TYPE_NOT_DEF:
msg = "No Registry entry exists for the provider type specified by dwProvType.";
break;
msg = "No Registry entry exists for the provider type"
" specified by dwProvType.";
break;
case NTE_PROVIDER_DLL_FAIL:
msg = "The provider DLL file could not be loaded, and may not exist. If it exists, then the file is not a valid DLL.";
break;
msg = "The provider DLL file could not be loaded, and"
" may not exist. If it exists, then the file is"
" not a valid DLL.";
break;
case NTE_SIGNATURE_FILE_BAD:
msg = "An error occurred while loading the DLL file image, prior to verifying its signature.";
break;
msg = "An error occurred while loading the DLL file image,"
" prior to verifying its signature.";
break;
default: msg = NULL;
break;
default:
msg = NULL;
break;
}
return msg;
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: file.c,v 1.8 2001/07/06 21:57:22 gson Exp $ */
/* $Id: file.c,v 1.9 2001/07/08 05:09:00 mayer Exp $ */
#include <config.h>
@@ -66,10 +66,10 @@ gettemp(char *path, int *doopen) {
if (*trv == '\\') {
*trv = '\0';
if (stat(path, &sbuf))
return(0);
return (0);
if (!S_ISDIR(sbuf.st_mode)) {
errno = ENOTDIR;
return(0);
return (0);
}
*trv = '\\';
break;
@@ -79,19 +79,24 @@ gettemp(char *path, int *doopen) {
for (;;) {
if (doopen) {
if ((*doopen =
<<<<<<< file.c
open(path, O_CREAT|O_EXCL|O_RDWR, _S_IREAD | _S_IWRITE)) >= 0)
return (1);
=======
open(path, O_CREAT | O_EXCL | O_RDWR,
_S_IREAD | _S_IWRITE)) >= 0)
return(1);
>>>>>>> 1.8
if (errno != EEXIST)
return(0);
return (0);
}
else if (stat(path, &sbuf))
return(errno == ENOENT ? 1 : 0);
return (errno == ENOENT ? 1 : 0);
/* tricky little algorithm for backward compatibility */
for (trv = start;;) {
if (!*trv)
return(0);
return (0);
if (*trv == 'z')
*trv++ = 'a';
else {
@@ -151,14 +156,26 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
*/
if (stat(oldname, &sbuf) != 0) {
errno = ENOENT;
return(-1);
return (-1);
}
/*
* Rename to a backup the new file if it still exists
*/
<<<<<<< file.c
if (stat(newname, &sbuf) == 0) {
=======
if (stat(newname, &sbuf) == 0)
>>>>>>> 1.8
exists = TRUE;
<<<<<<< file.c
strcpy(buf, newname);
strcat(buf, ".XXXXX");
tmpfd = mkstemp(buf);
if (tmpfd > 0)
_close(tmpfd);
DeleteFile(buf);
=======
strcpy(buf, newname);
strcat(buf, ".XXXXX");
@@ -168,22 +185,37 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
DeleteFile(buf);
if (exists == TRUE)
>>>>>>> 1.8
_chmod(newname, _S_IREAD | _S_IWRITE);
<<<<<<< file.c
filestatus = MoveFile(newname, buf);
=======
filestatus = MoveFile(newname, buf);
if (filestatus == 0) {
>>>>>>> 1.8
}
<<<<<<< file.c
/* Now rename the file to the new name
=======
/*
* Now rename the file to the new name
>>>>>>> 1.8
*/
_chmod(oldname, _S_IREAD | _S_IWRITE);
filestatus = MoveFile(oldname, newname);
<<<<<<< file.c
if (filestatus == 0) {
/* Try and rename the backup back to the original name if the backup got created
=======
if (filestatus == 0) {
/*
* Try to rename the backup back to the original name
* if the backup got created
>>>>>>> 1.8
*/
if (exists == TRUE) {
filestatus = MoveFile(buf, newname);
@@ -324,7 +356,7 @@ isc_file_openunique(char *templet, FILE **fp) {
REQUIRE(fp != NULL && *fp == NULL);
/*
* Win32 does not have mkstemp.
* Win32 does not have mkstemp. Using emulation above.
*/
fd = mkstemp(templet);
@@ -409,8 +441,14 @@ isc_file_progname(const char *filename, char *progname, size_t namelen) {
* Strip the path from the name
*/
s = isc_file_basename(filename);
<<<<<<< file.c
if (s == NULL) {
return (ISC_R_NOSPACE);
}
=======
if (s == NULL)
return (ISC_R_NOSPACE);
>>>>>>> 1.8
/*
* Strip any and all suffixes

View File

@@ -15,26 +15,29 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: bind_registry.h,v 1.1 2001/07/06 05:45:21 mayer Exp $ */
/* $Id: bind_registry.h,v 1.2 2001/07/08 05:09:21 mayer Exp $ */
#ifndef _BIND_REGISTRY_H
#define _BIND_REGISTRY_H
#define BIND_SUBKEY "Software\\ISC\\BIND"
#define BIND_SESSION "CurrentSession"
#define BIND_SESSION_SUBKEY "Software\\ISC\\BIND\\CurrentSession"
/*
* BIND makes use of the following Registry keys in various places, especially
* furing startup and installation
*/
#define BIND_SUBKEY "Software\\ISC\\BIND"
#define BIND_SESSION "CurrentSession"
#define BIND_SESSION_SUBKEY "Software\\ISC\\BIND\\CurrentSession"
#define BIND_UNINSTALL_SUBKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ISC BIND"
#define EVENTLOG_APP_SUBKEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application"
#define BIND_MESSAGE_SUBKEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\named"
#define XFER_MESSAGE_SUBKEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\named-xfer"
#define BIND_MESSAGE_NAME "named"
#define XFER_MESSAGE_NAME "named-xfer"
#define EVENTLOG_APP_SUBKEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application"
#define BIND_MESSAGE_SUBKEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\named"
#define BIND_MESSAGE_NAME "named"
#define BIND_CONFIGFILE 0
#define BIND_DEBUGLEVEL 1
#define BIND_QUERYLOG 2
#define BIND_FOREGROUND 3
#define BIND_CONFIGFILE 0
#define BIND_DEBUGLEVEL 1
#define BIND_QUERYLOG 2
#define BIND_FOREGROUND 3
#define BIND_PORT 4
#endif

View File

@@ -15,68 +15,73 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: bindevt.h,v 1.1 2001/07/06 05:46:37 mayer Exp $ */
/* $Id: bindevt.h,v 1.2 2001/07/08 05:09:22 mayer Exp $ */
//
// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
/*
* This is used for the event log for both logging the messages and
* later on by the event viewer when looking at the events
*/
/*
* Values are 32 bit values layed out as follows:
*
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +---+-+-+-----------------------+-------------------------------+
* |Sev|C|R| Facility | Code |
* +---+-+-+-----------------------+-------------------------------+
*
* where
*
* Sev - is the severity code
*
* 00 - Success
* 01 - Informational
* 10 - Warning
* 11 - Error
*
* C - is the Customer code flag
*
* R - is a reserved bit
*
* Facility - is the facility code
*
* Code - is the facility's status code
*
*
* Define the facility codes
*/
/*
* Define the severity codes
*/
//
// Define the severity codes
//
/*
* MessageId: BIND_ERR_MSG
*
* MessageText:
*
* %1
*/
#define BIND_ERR_MSG ((DWORD)0xC0000001L)
/*
* MessageId: BIND_WARN_MSG
*
* MessageText:
*
* %1
*/
#define BIND_WARN_MSG ((DWORD)0x80000002L)
//
// MessageId: BIND_ERR_MSG
//
// MessageText:
//
// %1
//
#define BIND_ERR_MSG ((DWORD)0xC0000001L)
//
// MessageId: BIND_WARN_MSG
//
// MessageText:
//
// %1
//
#define BIND_WARN_MSG ((DWORD)0x80000002L)
//
// MessageId: BIND_INFO_MSG
//
// MessageText:
//
// %1
//
#define BIND_INFO_MSG ((DWORD)0x40000003L)
/*
* MessageId: BIND_INFO_MSG
*
* MessageText:
*
* %1
*/
#define BIND_INFO_MSG ((DWORD)0x40000003L)

View File

@@ -43,9 +43,6 @@
LIBISC_EXTERNAL_DATA extern const struct in_addr6 in6addr_any;
LIBISC_EXTERNAL_DATA extern const struct in_addr6 in6addr_loopback;
//#define in6addr_any _in6addr_any
//#define in6addr_loopback _in6addr_loopback
#ifndef ISC_PLATFORM_HAVEIN6PKTINFO
struct in6_pktinfo {
struct in6_addr ipi6_addr; /* src/dst IPv6 address */

View File

@@ -15,13 +15,11 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: keyboard.h,v 1.1 2001/07/06 05:51:43 mayer Exp $ */
/* $Id: keyboard.h,v 1.2 2001/07/08 05:09:27 mayer Exp $ */
#ifndef ISC_KEYBOARD_H
#define ISC_KEYBOARD_H 1
//#include <termios.h>
#include <isc/lang.h>
#include <isc/result.h>
@@ -29,7 +27,6 @@ ISC_LANG_BEGINDECLS
typedef struct {
int fd;
// struct termios saved_mode;
isc_result_t result;
} isc_keyboard_t;

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: net.h,v 1.13 2001/07/06 05:51:44 mayer Exp $ */
/* $Id: net.h,v 1.14 2001/07/08 05:09:29 mayer Exp $ */
#ifndef ISC_NET_H
#define ISC_NET_H 1
@@ -82,14 +82,6 @@
#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
#endif
/*
* Make the number of available sockets large
* The number of sockets needed can get large and memory's cheap
* This must be defined before winsock2.h gets included as the
* macro is used there.
*/
//#define FD_SETSIZE 16384
#include <winsock2.h>
#include <sys/types.h>
@@ -144,7 +136,7 @@ typedef isc_uint16_t in_port_t;
break; \
} \
} \
} while(0)
} while (0)
#undef FD_SET
#define FD_SET(fd, set) do { \
@@ -160,7 +152,7 @@ typedef isc_uint16_t in_port_t;
((fd_set FAR *)(set))->fd_count++; \
} \
} \
} while(0)
} while (0)
/*
* Windows Sockets errors redefined as regular Berkeley error constants.
@@ -196,10 +188,8 @@ typedef isc_uint16_t in_port_t;
#define ETIMEDOUT WSAETIMEDOUT
#define ECONNREFUSED WSAECONNREFUSED
#define ELOOP WSAELOOP
//#define ENAMETOOLONG WSAENAMETOOLONG
#define EHOSTDOWN WSAEHOSTDOWN
#define EHOSTUNREACH WSAEHOSTUNREACH
//#define ENOTEMPTY WSAENOTEMPTY
#define EPROCLIM WSAEPROCLIM
#define EUSERS WSAEUSERS
#define EDQUOT WSAEDQUOT

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: ntfile.h,v 1.1 2001/07/06 05:56:25 mayer Exp $ */
/* $Id: ntfile.h,v 1.2 2001/07/08 05:09:30 mayer Exp $ */
/* This file has been necessitated by the fact that the iov array is local
* to the module, so passing the FILE ptr to a file I/O function in a
@@ -49,6 +49,9 @@ isc_ntfile_sync(FILE *f);
FILE*
isc_ntfile_getaddress(int r);
int
isc_ntfile_printf(const char *format, ...);
int
isc_ntfile_fprintf(FILE *fp, const char *format, ...);

View File

@@ -15,11 +15,12 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: ntpaths.h,v 1.1 2001/07/06 05:57:19 mayer Exp $ */
/* $Id: ntpaths.h,v 1.2 2001/07/08 05:09:31 mayer Exp $ */
/* Windows-specific path definitions
* These routines are used to set up and return system-specific path information
* about the files enumerated in NtPaths
/*
* Windows-specific path definitions
* These routines are used to set up and return system-specific path
* information about the files enumerated in NtPaths
*/

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: platform.h,v 1.1 2001/07/06 05:59:09 mayer Exp $ */
/* $Id: platform.h,v 1.2 2001/07/08 05:09:33 mayer Exp $ */
#ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H 1
@@ -23,19 +23,16 @@
/*****
***** Platform-dependent defines.
*****/
//#define ISC_PLATFORM_NEEDVSNPRINTF
#define ISC_PLATFORM_USETHREADS
/***
*** Network.
***/
#define ISC_PLATFORM_HAVEIPV6
//#define ISC_PLATFORM_NEEDIN6ADDRANY
#define ISC_PLATFORM_NEEDPORTT
#undef MSG_TRUNC
#define ISC_PLATFORM_NEEDNTOP
#define ISC_PLATFORM_NEEDPTON
#define ISC_PLATFORM_NEEDATON
//#define ISC_NET_BSD44MSGHDR
#define ISC_PLATFORM_QUADFORMAT "I64"

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: thread.h,v 1.14 2001/07/06 05:51:45 mayer Exp $ */
/* $Id: thread.h,v 1.15 2001/07/08 05:09:35 mayer Exp $ */
#ifndef ISC_THREAD_H
#define ISC_THREAD_H 1
@@ -29,12 +29,12 @@
* Inlines to help with wait retrun checking
*/
// check handle for NULL and INVALID_HANDLE
/* check handle for NULL and INVALID_HANDLE */
inline BOOL IsValidHandle( HANDLE hHandle) {
return ((hHandle != NULL) && (hHandle != INVALID_HANDLE_VALUE));
}
// validate wait return codes...
/* validate wait return codes... */
inline BOOL WaitSucceeded( DWORD dwWaitResult, DWORD dwHandleCount) {
return ((dwWaitResult >= WAIT_OBJECT_0) &&
(dwWaitResult < WAIT_OBJECT_0 + dwHandleCount));
@@ -53,7 +53,7 @@ inline BOOL WaitFailed( DWORD dwWaitResult) {
return (dwWaitResult == WAIT_FAILED);
}
// compute object indices for waits...
/* compute object indices for waits... */
inline DWORD WaitSucceededIndex( DWORD dwWaitResult) {
return (dwWaitResult - WAIT_OBJECT_0);
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: interfaceiter.c,v 1.1 2001/07/06 05:25:20 mayer Exp $ */
/* $Id: interfaceiter.c,v 1.2 2001/07/08 05:09:02 mayer Exp $ */
/*
* Note that this code will need to be revisited to support IPv6 Interfaces.
@@ -56,11 +56,11 @@
struct isc_interfaceiter {
unsigned int magic; /* Magic number. */
isc_mem_t *mctx;
int socket;
isc_mem_t *mctx;
int socket;
INTERFACE_INFO IFData; /* Current Interface Info */
int numIF; /* Current Interface count */
int totalIF; /* Total Number of Interfaces */
int numIF; /* Current Interface count */
int totalIF; /* Total Number of Interfaces */
INTERFACE_INFO *buf; /* Buffer for WSAIoctl data. */
unsigned int bufsize; /* Bytes allocated. */
INTERFACE_INFO *pos; /* Current offset in IF List */
@@ -74,9 +74,9 @@ struct isc_interfaceiter {
* We assume no sane system will have more than than 1K of IP addresses on
* all of its adapters.
*/
#define IFCONF_SIZE_INITIAL 16
#define IFCONF_SIZE_INCREMENT 64
#define IFCONF_SIZE_MAX 1040
#define IFCONF_SIZE_INITIAL 16
#define IFCONF_SIZE_INCREMENT 64
#define IFCONF_SIZE_MAX 1040
static void
get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src) {
@@ -255,10 +255,10 @@ internal_current(isc_interfaceiter_t *iter, int family) {
*/
if ((iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0) {
get_addr(family, &iter->current.dstaddress,
(struct sockaddr *)&(iter->IFData.iiBroadcastAddress));
(struct sockaddr *)&(iter->IFData.iiBroadcastAddress));
}
if(ifNamed == FALSE)
if (ifNamed == FALSE)
sprintf(iter->current.name, "TCP/IP Interface %d", iter->numIF);
/*
* Get the network mask.
@@ -273,10 +273,9 @@ internal_current(isc_interfaceiter_t *iter, int family) {
get_addr(family, &iter->current.netmask,
(struct sockaddr *)&(iter->IFData.iiNetmask));
break;
case AF_INET6: {
case AF_INET6:
break;
}
}
return (ISC_R_SUCCESS);
}
@@ -301,12 +300,12 @@ internal_next(isc_interfaceiter_t *iter) {
* the list in reverse order
*/
if(iter->numIF == 0)
if (iter->numIF == 0)
{
iter->pos = (INTERFACE_INFO *)(iter->buf + (iter->totalIF));
}
iter->pos--;
if(&(iter->pos) < &(iter->buf))
if (&(iter->pos) < &(iter->buf))
return (ISC_R_NOMORE);
memset(&(iter->IFData), 0, sizeof(INTERFACE_INFO));
@@ -322,8 +321,7 @@ internal_next(isc_interfaceiter_t *iter) {
isc_result_t
isc_interfaceiter_current(isc_interfaceiter_t *iter,
isc_interface_t *ifdata)
{
isc_interface_t *ifdata) {
REQUIRE(iter->result == ISC_R_SUCCESS);
memcpy(ifdata, &iter->current, sizeof(*ifdata));
return (ISC_R_SUCCESS);
@@ -381,3 +379,4 @@ isc_interfaceiter_destroy(isc_interfaceiter_t **iterp)
isc_mem_put(iter->mctx, iter, sizeof *iter);
*iterp = NULL;
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: keyboard.c,v 1.1 2001/07/06 05:27:37 mayer Exp $ */
/* $Id: keyboard.c,v 1.2 2001/07/08 05:09:04 mayer Exp $ */
#include <config.h>
@@ -37,8 +37,6 @@
isc_result_t
isc_keyboard_open(isc_keyboard_t *keyboard) {
int fd;
isc_result_t ret;
// struct termios current_mode;
REQUIRE(keyboard != NULL);
@@ -47,35 +45,11 @@ isc_keyboard_open(isc_keyboard_t *keyboard) {
return (ISC_R_IOERROR);
keyboard->fd = fd;
/*
if (tcgetattr(fd, &keyboard->saved_mode) < 0) {
ret = ISC_R_IOERROR;
goto errout;
}
current_mode = keyboard->saved_mode;
current_mode.c_iflag &=
~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
current_mode.c_oflag &= ~OPOST;
current_mode.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
current_mode.c_cflag &= ~(CSIZE|PARENB);
current_mode.c_cflag |= CS8;
current_mode.c_cc[VMIN] = 1;
current_mode.c_cc[VTIME] = 0;
if (tcsetattr(fd, TCSAFLUSH, &current_mode) < 0) {
ret = ISC_R_IOERROR;
goto errout;
}
*/
keyboard->result = ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
// errout:
return (ret);
}
isc_result_t
@@ -85,8 +59,6 @@ isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleeptime) {
if (sleeptime > 0 && keyboard->result != ISC_R_CANCELED)
(void)Sleep(sleeptime*1000);
// (void)tcsetattr(keyboard->fd, TCSAFLUSH, &keyboard->saved_mode);
keyboard->fd = -1;
return (ISC_R_SUCCESS);
@@ -96,7 +68,6 @@ isc_result_t
isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) {
ssize_t cc;
unsigned char c;
// cc_t *controlchars;
REQUIRE(keyboard != NULL);
REQUIRE(cp != NULL);
@@ -106,13 +77,7 @@ isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) {
keyboard->result = ISC_R_IOERROR;
return (keyboard->result);
}
/*
controlchars = keyboard->saved_mode.c_cc;
if (c == controlchars[VINTR] || c == controlchars[VQUIT]) {
keyboard->result = ISC_R_CANCELED;
return (keyboard->result);
}
*/
*cp = c;
return (ISC_R_SUCCESS);
@@ -122,3 +87,4 @@ isc_boolean_t
isc_keyboard_canceled(isc_keyboard_t *keyboard) {
return (ISC_TF(keyboard->result == ISC_R_CANCELED));
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: netdb.h,v 1.1 2001/07/06 05:32:44 mayer Exp $ */
/* $Id: netdb.h,v 1.2 2001/07/08 05:09:07 mayer Exp $ */
#ifndef NETDB_H
#define NETDB_H 1
@@ -124,7 +124,7 @@ struct addrinfo {
#define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
/*
* Constants for lwres_getnameinfo()
* Constants for getnameinfo()
*/
#undef NI_MAXHOST
#undef NI_MAXSERV
@@ -133,7 +133,7 @@ struct addrinfo {
#define NI_MAXSERV 32
/*
* Flag values for lwres_getnameinfo()
* Flag values for getnameinfo()
*/
#undef NI_NOFQDN
#undef NI_NUMERICHOST

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: ntfile.c,v 1.1 2001/07/06 05:34:06 mayer Exp $ */
/* $Id: ntfile.c,v 1.2 2001/07/08 05:09:08 mayer Exp $ */
/* This file has been necessitated by the fact that the iov array is local
* to the module, so passing the FILE ptr to a file I/O function in a
@@ -32,23 +32,23 @@
FILE *
isc_ntfile_fopen(const char *filename, const char *mode) {
return(fopen(filename, mode));
return (fopen(filename, mode));
}
int
isc_ntfile_fclose(FILE *f) {
return(fclose(f));
return (fclose(f));
}
int
isc_ntfile_fseek(FILE *f, long offset, int whence) {
return(fseek(f, offset, whence));
return (fseek(f, offset, whence));
}
size_t
isc_ntfile_fread(void *ptr, size_t size, size_t nmemb, FILE *f) {
return(fread(ptr, size, nmemb, f));
return (fread(ptr, size, nmemb, f));
}
size_t
@@ -56,19 +56,19 @@ isc_ntfile_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f) {
int r;
r = fwrite(ptr, size, nmemb, f);
fflush(f);
return(r);
return (r);
}
int
isc_ntfile_flush(FILE *f) {
return(fflush(f));
return (fflush(f));
}
int
isc_ntfile_sync(FILE *f) {
return(_commit(_fileno(f)));
return (_commit(_fileno(f)));
}
FILE *
@@ -76,6 +76,18 @@ isc_ntfile_getaddress(int r) {
return (&_iob[r]);
}
int
isc_ntfile_printf(const char *format, ...) {
int r;
FILE *fp = stdout;
va_list ap;
va_start(ap, format);
r = vfprintf(fp, format, ap);
va_end(ap);
fflush(fp);
return (r);
}
int
isc_ntfile_fprintf(FILE *fp, const char *format, ...) {
int r;
@@ -92,7 +104,7 @@ isc_ntfile_vfprintf(FILE *fp, const char *format, va_list alist) {
int r;
r = vfprintf(fp, format, alist);
fflush(fp);
return(r);
return (r);
}
int
@@ -100,7 +112,7 @@ isc_ntfile_fputc(int iv, FILE *fp) {
int r;
r = fputc(iv, fp);
fflush(fp);
return(r);
return (r);
}
int
@@ -108,37 +120,37 @@ isc_ntfile_fputs(const char *bf, FILE *fp) {
int r;
r = fputs(bf, fp);
fflush(fp);
return(r);
return (r);
}
int
isc_ntfile_fgetc(FILE *fp) {
return(fgetc(fp));
return (fgetc(fp));
}
int
isc_ntfile_fgetpos(FILE *fp, fpos_t *pos) {
return(fgetpos(fp, pos));
return (fgetpos(fp, pos));
}
char *
isc_ntfile_fgets(char *ch, int r, FILE *fp) {
return(fgets(ch,r, fp));
return (fgets(ch,r, fp));
}
int
isc_ntfile_getc(FILE *fp) {
return(getc(fp));
return (getc(fp));
}
FILE *
isc_ntfile_freopen(const char *path, const char *mode, FILE *fp) {
return(freopen(path, mode,fp));
return (freopen(path, mode,fp));
}
FILE *
isc_ntfile_fdopen(int handle, const char *mode) {
return(fdopen(handle, mode));
return (fdopen(handle, mode));
}
/*
* open(), close(), read(), write(), fsync()
@@ -174,5 +186,5 @@ isc_ntfile_write(int fd, char *buf, int len){
int r;
r = _write(fd, buf, len);
_commit(fd);
return(r);
return (r);
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: ntpaths.c,v 1.1 2001/07/06 05:35:09 mayer Exp $ */
/* $Id: ntpaths.c,v 1.2 2001/07/08 05:09:09 mayer Exp $ */
/*
* This file fetches the required path information that is specific
@@ -51,13 +51,15 @@ isc_ntpaths_init()
BOOL keyFound = TRUE;
memset(namedBase, 0, MAX_PATH);
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey)
!= ERROR_SUCCESS)
keyFound = FALSE;
if(keyFound == TRUE)
if (keyFound == TRUE)
{
// Get the named directory
if(RegQueryValueEx(hKey, "InstallDir", NULL, NULL, (LPBYTE)namedBase, &baseLen) != ERROR_SUCCESS)
/* Get the named directory */
if (RegQueryValueEx(hKey, "InstallDir", NULL, NULL,
(LPBYTE)namedBase, &baseLen) != ERROR_SUCCESS)
keyFound = FALSE;
}
@@ -65,8 +67,9 @@ isc_ntpaths_init()
GetSystemDirectory(systemDir, MAX_PATH);
if(keyFound == FALSE)
strcpy(namedBase, systemDir); // Use the System Directory as a default
if (keyFound == FALSE)
/* Use the System Directory as a default */
strcpy(namedBase, systemDir);
strcpy(ns_confFile, namedBase);
strcat(ns_confFile, "\\etc\\named.conf");
@@ -92,30 +95,30 @@ isc_ntpaths_init()
char *
isc_ntpaths_get(int ind) {
if(!Initialized) {
if (!Initialized) {
isc_ntpaths_init();
}
switch (ind) {
case NAMED_CONF_PATH:
return(ns_confFile);
return (ns_confFile);
break;
case LWRES_CONF_PATH:
return(lwresd_confFile);
return (lwresd_confFile);
break;
case RESOLV_CONF_PATH:
return(lwresd_resolvconfFile);
return (lwresd_resolvconfFile);
break;
case RNDC_CONF_PATH:
return(rndc_confFile);
return (rndc_confFile);
break;
case NAMED_PID_PATH:
return(ns_defaultpidfile);
return (ns_defaultpidfile);
break;
case LWRESD_PID_PATH:
return(lwresd_defaultpidfile);
return (lwresd_defaultpidfile);
break;
default:
return(NULL);
return (NULL);
}
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.c,v 1.1 2001/07/06 05:36:13 mayer Exp $ */
/* $Id: os.c,v 1.2 2001/07/08 05:09:11 mayer Exp $ */
#include <windows.h>
@@ -27,10 +27,10 @@ static void
initialize_action(void) {
BOOL bSuccess;
if(bInit)
if (bInit)
return;
GetSystemInfo (&SystemInfo);
GetSystemInfo(&SystemInfo);
osVer.dwOSVersionInfoSize = sizeof(osVer);
bSuccess = GetVersionEx(&osVer);
bInit = TRUE;

View File

@@ -15,9 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.1 2001/07/06 05:37:46 mayer Exp $ */
//#define ISC_SOCKET_DEBUG 1
/* $Id: socket.c,v 1.2 2001/07/08 05:09:12 mayer Exp $ */
#define MAKE_EXTERNAL 1
#include <config.h>
@@ -149,7 +147,7 @@ struct iovec {
struct msghdr {
void *msg_name; /* optional address */
u_int msg_namelen; /* size of address */
WSABUF *msg_iov; /* scatter/gather array */
WSABUF *msg_iov; /* scatter/gather array */
u_int msg_iovlen; /* # elements in msg_iov */
void *msg_control; /* ancillary data, see below */
u_int msg_controllen; /* ancillary data buffer len */
@@ -284,10 +282,10 @@ BOOL InitSockets()
if ( err != 0 )
{
/* Tell the user that we could not find a usable Winsock DLL */
return(FALSE);
return (FALSE);
}
return(TRUE);
return (TRUE);
}
int internal_pipe( int filedes[2])
@@ -313,36 +311,38 @@ internal_sendmsg(int sock, const struct msghdr *msg, int flags)
msg->msg_iovlen,
&BytesSent,
Flags,
msg->msg_name,
msg->msg_namelen,
msg->msg_name,
msg->msg_namelen,
NULL,
NULL);
if (Error == SOCKET_ERROR) {
BytesSent = -1;
// There is an error...
/* There is an error... */
Error = WSAGetLastError();
if (Error == WSAEWOULDBLOCK) {
// WSAEWOULDBLOCK means we have to wait for an FD_WRITE
// before we can send.
/*
* WSAEWOULDBLOCK means we have to wait for an FD_WRITE
* before we can send.
*/
errno = EWOULDBLOCK;
} else if (Error == WSA_IO_PENDING) {
// Overlapped send successfully initiated.
/* Overlapped send successfully initiated. */
errno = EAGAIN;
}
else {
// An unexpected error occurred.
/* An unexpected error occurred. */
errno = Error;
}
}
// No error -- the I/O request was completed immediately...
return(BytesSent);
/* No error -- the I/O request was completed immediately... */
return (BytesSent);
}
@@ -360,38 +360,38 @@ internal_recvmsg(int sock, struct msghdr *msg, int flags)
msg->msg_iovlen,
&NumBytes,
&Flags,
msg->msg_name,
(int *)&(msg->msg_namelen),
msg->msg_name,
(int *)&(msg->msg_namelen),
NULL,
NULL);
// Check for errors.
/* Check for errors. */
if (Result == SOCKET_ERROR) {
Error = WSAGetLastError();
Error = WSAGetLastError();
NumBytes = -1;
switch (Error) {
case WSAEWOULDBLOCK:
case WSAEWOULDBLOCK:
// No data received; return to wait for another read event.
errno = EAGAIN;
break;
/* No data received; return to wait for another read event. */
errno = EAGAIN;
break;
default:
default:
// Some other error...hit the panic button.
errno = Error;
break;
}
/* Some other error...hit the panic button. */
errno = Error;
break;
}
}
msg->msg_flags = Flags; /* Return the flags received in header */
msg->msg_flags = Flags; /* Return the flags received in header */
return(NumBytes);
return (NumBytes);
} // Internal_recvmsg()
} /* Internal_recvmsg() */
static void
manager_log(isc_socketmgr_t *sockmgr,
@@ -490,7 +490,7 @@ select_poke(isc_socketmgr_t *mgr, int fd, int msg) {
buf[0] = fd;
buf[1] = msg;
if(msg == SELECT_POKE_SHUTDOWN) {
if (msg == SELECT_POKE_SHUTDOWN) {
do {
cc = _write(mgr->pipe_fds[1], buf, sizeof(buf));
errval = errno;
@@ -751,7 +751,7 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
if (used.length > 0) {
iov[iovcount].buf = (void *)(used.base
+ skip_count);
+ skip_count);
iov[iovcount].len = used.length - skip_count;
write_count += (used.length - skip_count);
skip_count = 0;
@@ -3299,26 +3299,3 @@ isc_socket_isbound(isc_socket_t *sock) {
return (val);
}
#ifndef ISC_PLATFORM_USETHREADS
void
isc__socketmgr_getfdsets(fd_set *readset, fd_set *writeset, int *maxfd) {
if (socketmgr == NULL)
*maxfd = 0;
else {
*readset = socketmgr->read_fds;
*writeset = socketmgr->write_fds;
*maxfd = socketmgr->maxfd + 1;
}
}
isc_result_t
isc__socketmgr_dispatch(fd_set *readset, fd_set *writeset, int maxfd) {
isc_socketmgr_t *manager = socketmgr;
if (manager == NULL)
return (ISC_R_NOTFOUND);
process_fds(manager, maxfd, readset, writeset);
return (ISC_R_SUCCESS);
}
#endif /* ISC_PLATFORM_USETHREADS */

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: syslog.c,v 1.1 2001/07/06 05:39:57 mayer Exp $ */
/* $Id: syslog.c,v 1.2 2001/07/08 05:09:15 mayer Exp $ */
#include <config.h>
@@ -38,27 +38,27 @@ static struct dsn_c_pvt_sfnt {
int val;
const char *strval;
} facilities[] = {
{ LOG_KERN, "kern" },
{ LOG_USER, "user" },
{ LOG_MAIL, "mail" },
{ LOG_KERN, "kern" },
{ LOG_USER, "user" },
{ LOG_MAIL, "mail" },
{ LOG_DAEMON, "daemon" },
{ LOG_AUTH, "auth" },
{ LOG_AUTH, "auth" },
{ LOG_SYSLOG, "syslog" },
{ LOG_LPR, "lpr" },
{ LOG_LPR, "lpr" },
#ifdef LOG_NEWS
{ LOG_NEWS, "news" },
{ LOG_NEWS, "news" },
#endif
#ifdef LOG_UUCP
{ LOG_UUCP, "uucp" },
{ LOG_UUCP, "uucp" },
#endif
#ifdef LOG_CRON
{ LOG_CRON, "cron" },
{ LOG_CRON, "cron" },
#endif
#ifdef LOG_AUTHPRIV
{ LOG_AUTHPRIV, "authpriv" },
#endif
#ifdef LOG_FTP
{ LOG_FTP, "ftp" },
{ LOG_FTP, "ftp" },
#endif
{ LOG_LOCAL0, "local0"},
{ LOG_LOCAL1, "local1"},
@@ -68,7 +68,7 @@ static struct dsn_c_pvt_sfnt {
{ LOG_LOCAL5, "local5"},
{ LOG_LOCAL6, "local6"},
{ LOG_LOCAL7, "local7"},
{ 0, NULL }
{ 0, NULL }
};
isc_result_t
@@ -92,8 +92,7 @@ isc_syslog_facilityfromstring(const char *str, int *facilityp) {
* Log to the NT Event Log
*/
void
syslog(int level, const char *fmt, ...)
{
syslog(int level, const char *fmt, ...) {
va_list ap;
char buf[1024];
char *str[1];
@@ -105,20 +104,22 @@ syslog(int level, const char *fmt, ...)
va_end(ap);
/* Make sure that the channel is open to write the event */
if(hAppLog != NULL) {
switch (level)
{
case LOG_INFO:
case LOG_NOTICE:
case LOG_DEBUG:
ReportEvent(hAppLog, EVENTLOG_INFORMATION_TYPE, 0, BIND_INFO_MSG, NULL, 1, 0, str, NULL);
break;
case LOG_WARNING:
ReportEvent(hAppLog, EVENTLOG_WARNING_TYPE, 0, BIND_WARN_MSG, NULL, 1, 0, str, NULL);
break;
default:
ReportEvent(hAppLog, EVENTLOG_ERROR_TYPE, 0, BIND_ERR_MSG, NULL, 1, 0, str, NULL);
break;
if (hAppLog != NULL) {
switch (level) {
case LOG_INFO:
case LOG_NOTICE:
case LOG_DEBUG:
ReportEvent(hAppLog, EVENTLOG_INFORMATION_TYPE, 0,
BIND_INFO_MSG, NULL, 1, 0, str, NULL);
break;
case LOG_WARNING:
ReportEvent(hAppLog, EVENTLOG_WARNING_TYPE, 0,
BIND_WARN_MSG, NULL, 1, 0, str, NULL);
break;
default:
ReportEvent(hAppLog, EVENTLOG_ERROR_TYPE, 0,
BIND_ERR_MSG, NULL, 1, 0, str, NULL);
break;
}
}
}
@@ -127,29 +128,26 @@ syslog(int level, const char *fmt, ...)
* Initialize event logging
*/
void
openlog(const char *name, int flags, ...)
{
/* Get a handle to the Application event log */
hAppLog = RegisterEventSource(NULL, name);
openlog(const char *name, int flags, ...) {
/* Get a handle to the Application event log */
hAppLog = RegisterEventSource(NULL, name);
}
/*
* Close the Handle to the application Event Log
* We don't care whether or not we succeeded so ignore return values
* In fact if we failed then we would have nowhere to put the message
*/
void
closelog()
{
/*
* Close the Handle to the application Event Log
* We don't care whether or not we succeeded so ignore return values
* In fact if we failed then we would have nowhere to put the message
*/
DeregisterEventSource(hAppLog);
closelog() {
DeregisterEventSource(hAppLog);
}
/*
* Keep event logging synced with the current debug level
*/
void
ModifyLogLevel(int level)
{
ModifyLogLevel(int level) {
debug_level = level;
}
@@ -158,8 +156,8 @@ ModifyLogLevel(int level)
* Piggyback onto stream given.
*/
void
InitNTLogging(FILE *stream, int debug)
{
InitNTLogging(FILE *stream, int debug) {
log_stream = stream;
ModifyLogLevel(debug);
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: syslog.h,v 1.1 2001/07/06 05:40:41 mayer Exp $ */
/* $Id: syslog.h,v 1.2 2001/07/08 05:09:16 mayer Exp $ */
#ifndef _SYSLOG_H
#define _SYSLOG_H
@@ -63,67 +63,9 @@ ModifyLogLevel(int level);
void
InitNTLogging(FILE *, int);
//
// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
//
// Define the severity codes
//
//
// MessageId: BIND_ERR_MSG
//
// MessageText:
//
// %1
//
#define BIND_ERR_MSG ((DWORD)0xC0000001L)
//
// MessageId: BIND_WARN_MSG
//
// MessageText:
//
// %1
//
#define BIND_WARN_MSG ((DWORD)0x80000002L)
//
// MessageId: BIND_INFO_MSG
//
// MessageText:
//
// %1
//
#define BIND_INFO_MSG ((DWORD)0x40000003L)
/*
* Include the event codes required for logging.
*/
#include <isc/bindevt.h>
#endif

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: thread.c,v 1.15 2001/07/06 05:07:54 mayer Exp $ */
/* $Id: thread.c,v 1.16 2001/07/08 05:09:17 mayer Exp $ */
#include <config.h>
@@ -25,8 +25,7 @@
isc_result_t
isc_thread_create(isc_threadfunc_t start, isc_threadarg_t arg,
isc_thread_t *threadp)
{
isc_thread_t *threadp) {
isc_thread_t thread;
unsigned int id;
@@ -63,6 +62,7 @@ void
isc_thread_setconcurrency(unsigned int level) {
/*
* This is unnecessary on Win32 systems
* This is unnecessary on Win32 systems, but is here so that the
* call exists
*/
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: time.c,v 1.21 2001/07/06 05:07:44 mayer Exp $ */
/* $Id: time.c,v 1.22 2001/07/08 05:09:18 mayer Exp $ */
/*
* Windows has a different epoch than Unix. Therefore this code sets the epoch
@@ -299,8 +299,6 @@ isc_time_seconds(isc_time_t *t) {
i.LowPart = t->absolute.dwLowDateTime - epoch.absolute.dwLowDateTime;
i.HighPart = t->absolute.dwHighDateTime - epoch.absolute.dwHighDateTime;
// INSIST(i.QuadPart / INTERVALS_PER_S <= (isc_uint32_t)-1);
return ((isc_uint32_t)(i.QuadPart / INTERVALS_PER_S));
}