Commit bbb3705e authored by Mark Andrews's avatar Mark Andrews
Browse files

3535. [bug] Minor win32 cleanups. [RT #32962]

parent 80f1365a
3535. [bug] Minor win32 cleanups. [RT #32962]
3534. [bug] Extra text after an embedded NULL was ignored when 3534. [bug] Extra text after an embedded NULL was ignored when
parsing zone files. [RT #32699] parsing zone files. [RT #32699]
......
...@@ -267,7 +267,8 @@ isc_dir_createunique(char *templet) { ...@@ -267,7 +267,8 @@ isc_dir_createunique(char *templet) {
do { do {
i = mkdir(templet); i = mkdir(templet);
i = chmod(templet, 0700); if (i == 0)
i = chmod(templet, 0700);
if (i == 0 || errno != EEXIST) if (i == 0 || errno != EEXIST)
break; break;
......
...@@ -242,7 +242,6 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) { ...@@ -242,7 +242,6 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
isc_result_t ret; isc_result_t ret;
isc_entropysource_t *source; isc_entropysource_t *source;
HCRYPTPROV hcryptprov; HCRYPTPROV hcryptprov;
DWORD errval;
BOOL err; BOOL err;
REQUIRE(VALID_ENTROPY(ent)); REQUIRE(VALID_ENTROPY(ent));
...@@ -258,7 +257,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) { ...@@ -258,7 +257,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
err = CryptAcquireContext(&hcryptprov, NULL, NULL, PROV_RSA_FULL, err = CryptAcquireContext(&hcryptprov, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT); CRYPT_VERIFYCONTEXT);
if (!err){ if (!err){
errval = GetLastError(); (void)GetLastError();
ret = ISC_R_IOERROR; ret = ISC_R_IOERROR;
goto errout; goto errout;
} }
......
...@@ -210,7 +210,7 @@ isc_file_safemovefile(const char *oldname, const char *newname) { ...@@ -210,7 +210,7 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
tmpfd = mkstemp(buf, ISC_TRUE); tmpfd = mkstemp(buf, ISC_TRUE);
if (tmpfd > 0) if (tmpfd > 0)
_close(tmpfd); _close(tmpfd);
DeleteFile(buf); (void)DeleteFile(buf);
_chmod(newname, _S_IREAD | _S_IWRITE); _chmod(newname, _S_IREAD | _S_IWRITE);
filestatus = MoveFile(newname, buf); filestatus = MoveFile(newname, buf);
...@@ -237,7 +237,7 @@ isc_file_safemovefile(const char *oldname, const char *newname) { ...@@ -237,7 +237,7 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
* Delete the backup file if it got created * Delete the backup file if it got created
*/ */
if (exists == TRUE) if (exists == TRUE)
filestatus = DeleteFile(buf); (void)DeleteFile(buf);
return (0); return (0);
} }
...@@ -335,7 +335,7 @@ isc_file_template(const char *path, const char *templet, char *buf, ...@@ -335,7 +335,7 @@ isc_file_template(const char *path, const char *templet, char *buf,
isc_result_t isc_result_t
isc_file_renameunique(const char *file, char *templet) { isc_file_renameunique(const char *file, char *templet) {
int fd = -1; int fd;
int res = 0; int res = 0;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
......
...@@ -168,7 +168,6 @@ NTFS_Access_Control(const char *filename, const char *user, int access, ...@@ -168,7 +168,6 @@ NTFS_Access_Control(const char *filename, const char *user, int access,
char domainBuffer[100]; char domainBuffer[100];
DWORD domainBufferSize = sizeof(domainBuffer); DWORD domainBufferSize = sizeof(domainBuffer);
SID_NAME_USE snu; SID_NAME_USE snu;
int errval;
DWORD NTFSbits; DWORD NTFSbits;
int caccess; int caccess;
...@@ -184,13 +183,13 @@ NTFS_Access_Control(const char *filename, const char *user, int access, ...@@ -184,13 +183,13 @@ NTFS_Access_Control(const char *filename, const char *user, int access,
domainBufferSize = sizeof(domainBuffer); domainBufferSize = sizeof(domainBuffer);
if (!LookupAccountName(0, "Administrators", padminsid, if (!LookupAccountName(0, "Administrators", padminsid,
&adminSidBufferSize, domainBuffer, &domainBufferSize, &snu)) { &adminSidBufferSize, domainBuffer, &domainBufferSize, &snu)) {
errval = GetLastError(); (void)GetLastError();
return (ISC_R_NOPERM); return (ISC_R_NOPERM);
} }
domainBufferSize = sizeof(domainBuffer); domainBufferSize = sizeof(domainBuffer);
if (!LookupAccountName(0, "Everyone", pothersid, if (!LookupAccountName(0, "Everyone", pothersid,
&otherSidBufferSize, domainBuffer, &domainBufferSize, &snu)) { &otherSidBufferSize, domainBuffer, &domainBufferSize, &snu)) {
errval = GetLastError(); (void)GetLastError();
return (ISC_R_NOPERM); return (ISC_R_NOPERM);
} }
...@@ -287,7 +286,7 @@ NTFS_fsaccess_set(const char *path, isc_fsaccess_t access, ...@@ -287,7 +286,7 @@ NTFS_fsaccess_set(const char *path, isc_fsaccess_t access,
* For NTFS we first need to get the name of the account under * For NTFS we first need to get the name of the account under
* which BIND is running * which BIND is running
*/ */
if (namelen <= 0) { if (namelen == 0) {
namelen = sizeof(username); namelen = sizeof(username);
if (GetUserName(username, &namelen) == 0) if (GetUserName(username, &namelen) == 0)
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
......
...@@ -64,7 +64,6 @@ void InitSockets(void); ...@@ -64,7 +64,6 @@ void InitSockets(void);
static isc_result_t static isc_result_t
try_proto(int domain) { try_proto(int domain) {
SOCKET s; SOCKET s;
isc_result_t result = ISC_R_SUCCESS;
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
int errval; int errval;
......
...@@ -62,7 +62,6 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList, ...@@ -62,7 +62,6 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
DWORD dwEntriesRead = 0; DWORD dwEntriesRead = 0;
DWORD dwTotalEntries = 0; DWORD dwTotalEntries = 0;
NET_API_STATUS nStatus; NET_API_STATUS nStatus;
DWORD dwTotalCount = 0;
size_t retlen; size_t retlen;
wchar_t user[MAX_NAME_LENGTH]; wchar_t user[MAX_NAME_LENGTH];
...@@ -97,7 +96,6 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList, ...@@ -97,7 +96,6 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
dwEntriesRead = 0; dwEntriesRead = 0;
} }
dwTotalCount = 0;
if (pBuf != NULL) { if (pBuf != NULL) {
pTmpLBuf = pBuf; pTmpLBuf = pBuf;
/* /*
......
...@@ -35,7 +35,7 @@ initialize_action(void) { ...@@ -35,7 +35,7 @@ initialize_action(void) {
unsigned int unsigned int
isc_os_ncpus(void) { isc_os_ncpus(void) {
long ncpus = 1; long ncpus;
initialize_action(); initialize_action();
ncpus = SystemInfo.dwNumberOfProcessors; ncpus = SystemInfo.dwNumberOfProcessors;
if (ncpus <= 0) if (ncpus <= 0)
......
...@@ -718,7 +718,6 @@ static void ...@@ -718,7 +718,6 @@ static void
queue_receive_request(isc_socket_t *sock) { queue_receive_request(isc_socket_t *sock) {
DWORD Flags = 0; DWORD Flags = 0;
DWORD NumBytes = 0; DWORD NumBytes = 0;
int total_bytes = 0;
int Result; int Result;
int Error; int Error;
int need_retry; int need_retry;
...@@ -1096,9 +1095,8 @@ dump_msg(struct msghdr *msg, isc_socket_t *sock) { ...@@ -1096,9 +1095,8 @@ dump_msg(struct msghdr *msg, isc_socket_t *sock) {
printf("\tname %p, namelen %d\n", msg->msg_name, msg->msg_namelen); printf("\tname %p, namelen %d\n", msg->msg_name, msg->msg_namelen);
printf("\tiov %p, iovlen %d\n", msg->msg_iov, msg->msg_iovlen); printf("\tiov %p, iovlen %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0; i < (unsigned int)msg->msg_iovlen; i++) for (i = 0; i < (unsigned int)msg->msg_iovlen; i++)
printf("\t\t%d\tbase %p, len %d\n", i, printf("\t\t%u\tbase %p, len %u\n", i,
msg->msg_iov[i].buf, msg->msg_iov[i].buf, msg->msg_iov[i].len);
msg->msg_iov[i].len);
} }
#endif #endif
...@@ -1609,21 +1607,21 @@ free_socket(isc_socket_t **sockp, int lineno) { ...@@ -1609,21 +1607,21 @@ free_socket(isc_socket_t **sockp, int lineno) {
isc_socket_t *sock = *sockp; isc_socket_t *sock = *sockp;
*sockp = NULL; *sockp = NULL;
manager = sock->manager;
/* /*
* Seems we can free the socket after all. * Seems we can free the socket after all.
*/ */
manager = sock->manager; manager = sock->manager;
socket_log(__LINE__, sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, socket_log(__LINE__, sock, NULL, CREATION, isc_msgcat,
ISC_MSG_DESTROYING, "freeing socket line %d fd %d lock %p semaphore %p", ISC_MSGSET_SOCKET, ISC_MSG_DESTROYING,
"freeing socket line %d fd %d lock %p semaphore %p",
lineno, sock->fd, &sock->lock, sock->lock.LockSemaphore); lineno, sock->fd, &sock->lock, sock->lock.LockSemaphore);
sock->magic = 0; sock->magic = 0;
DESTROYLOCK(&sock->lock); DESTROYLOCK(&sock->lock);
if (sock->recvbuf.base != NULL) if (sock->recvbuf.base != NULL)
isc_mem_put(manager->mctx, sock->recvbuf.base, sock->recvbuf.len); isc_mem_put(manager->mctx, sock->recvbuf.base,
sock->recvbuf.len);
LOCK(&manager->lock); LOCK(&manager->lock);
if (ISC_LINK_LINKED(sock, link)) if (ISC_LINK_LINKED(sock, link))
...@@ -1880,7 +1878,6 @@ isc__socket_attach(isc_socket_t *sock, isc_socket_t **socketp) { ...@@ -1880,7 +1878,6 @@ isc__socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
void void
isc__socket_detach(isc_socket_t **socketp) { isc__socket_detach(isc_socket_t **socketp) {
isc_socket_t *sock; isc_socket_t *sock;
isc_boolean_t kill_socket = ISC_FALSE;
REQUIRE(socketp != NULL); REQUIRE(socketp != NULL);
sock = *socketp; sock = *socketp;
...@@ -2779,10 +2776,7 @@ static isc_result_t ...@@ -2779,10 +2776,7 @@ static isc_result_t
socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
unsigned int flags) unsigned int flags)
{ {
int cc = 0;
isc_task_t *ntask = NULL;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
int recv_errno = 0;
dev->ev_sender = task; dev->ev_sender = task;
......
...@@ -44,7 +44,7 @@ initialize_action(void) { ...@@ -44,7 +44,7 @@ initialize_action(void) {
*/ */
if(!bSuccess) { if(!bSuccess) {
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
bSuccess = GetVersionEx((OSVERSIONINFO *) &osVer); (void)GetVersionEx((OSVERSIONINFO *) &osVer);
} }
bInit = TRUE; bInit = TRUE;
} }
...@@ -98,4 +98,4 @@ isc_win32os_versioncheck(unsigned int major, unsigned int minor, ...@@ -98,4 +98,4 @@ isc_win32os_versioncheck(unsigned int major, unsigned int minor,
/* Exact */ /* Exact */
return (0); return (0);
} }
\ No newline at end of file
...@@ -70,6 +70,10 @@ get_win32_searchlist(lwres_context_t *ctx) { ...@@ -70,6 +70,10 @@ get_win32_searchlist(lwres_context_t *ctx) {
} }
confdata->searchnxt = 0; confdata->searchnxt = 0;
if (!keyFound)
return;
cp = strtok((char *)searchlist, ", \0"); cp = strtok((char *)searchlist, ", \0");
while (cp != NULL) { while (cp != NULL) {
if (confdata->searchnxt == LWRES_CONFMAXSEARCH) if (confdata->searchnxt == LWRES_CONFMAXSEARCH)
...@@ -85,8 +89,7 @@ get_win32_searchlist(lwres_context_t *ctx) { ...@@ -85,8 +89,7 @@ get_win32_searchlist(lwres_context_t *ctx) {
lwres_result_t lwres_result_t
lwres_conf_parse(lwres_context_t *ctx, const char *filename) { lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
lwres_result_t ret = LWRES_R_SUCCESS; lwres_result_t ret;
lwres_result_t res;
lwres_conf_t *confdata; lwres_conf_t *confdata;
FIXED_INFO * FixedInfo; FIXED_INFO * FixedInfo;
ULONG BufLen = sizeof(FIXED_INFO); ULONG BufLen = sizeof(FIXED_INFO);
...@@ -137,11 +140,11 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) { ...@@ -137,11 +140,11 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
if (confdata->nsnext >= LWRES_CONFMAXNAMESERVERS) if (confdata->nsnext >= LWRES_CONFMAXNAMESERVERS)
break; break;
res = lwres_create_addr(pIPAddr->IpAddress.String, ret = lwres_create_addr(pIPAddr->IpAddress.String,
&confdata->nameservers[confdata->nsnext++], 1); &confdata->nameservers[confdata->nsnext++], 1);
if (res != LWRES_R_SUCCESS) { if (ret != LWRES_R_SUCCESS) {
GlobalFree(FixedInfo); GlobalFree(FixedInfo);
return (res); return (ret);
} }
pIPAddr = pIPAddr ->Next; pIPAddr = pIPAddr ->Next;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment