mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-08 21:32:11 -04:00
Merge branch '1043-cppcheck-detected-code-issues' into 'master'
Resolve "cppcheck-detected code issues" Closes #1043 See merge request isc-projects/bind9!2239
This commit is contained in:
commit
44fa4d20dd
52 changed files with 328 additions and 218 deletions
|
|
@ -464,7 +464,7 @@ main(int argc, char **argv) {
|
|||
dns_rdataset_init(&rdataset);
|
||||
|
||||
if (usekeyset || filename != NULL) {
|
||||
if (argc < isc_commandline_index + 1 && filename != NULL) {
|
||||
if (argc < isc_commandline_index + 1) {
|
||||
/* using zone name as the zone file name */
|
||||
namestr = filename;
|
||||
} else {
|
||||
|
|
@ -479,6 +479,7 @@ main(int argc, char **argv) {
|
|||
if (usekeyset) {
|
||||
result = loadkeyset(dir, &rdataset);
|
||||
} else {
|
||||
INSIST(filename != NULL);
|
||||
result = loadset(filename, &rdataset);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -854,6 +854,7 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||
if (stack != NULL)
|
||||
isc_mem_put(mctx, stack, stackcount * sizeof(*stack));
|
||||
|
||||
INSIST(dscpcount == addrcount);
|
||||
INSIST(keycount == addrcount);
|
||||
INSIST(keycount == dscpcount);
|
||||
|
||||
|
|
|
|||
|
|
@ -10610,17 +10610,21 @@ dumpdone(void *arg, isc_result_t result) {
|
|||
char buf[1024+32];
|
||||
const dns_master_style_t *style;
|
||||
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
if (dctx->mdctx != NULL)
|
||||
}
|
||||
if (dctx->mdctx != NULL) {
|
||||
dns_dumpctx_detach(&dctx->mdctx);
|
||||
}
|
||||
if (dctx->view == NULL) {
|
||||
dctx->view = ISC_LIST_HEAD(dctx->viewlist);
|
||||
if (dctx->view == NULL)
|
||||
if (dctx->view == NULL) {
|
||||
goto done;
|
||||
}
|
||||
INSIST(dctx->zone == NULL);
|
||||
} else
|
||||
} else {
|
||||
goto resume;
|
||||
}
|
||||
nextview:
|
||||
fprintf(dctx->fp, ";\n; Start view %s\n;\n", dctx->view->view->name);
|
||||
resume:
|
||||
|
|
@ -10634,8 +10638,9 @@ dumpdone(void *arg, isc_result_t result) {
|
|||
{
|
||||
style = &dns_master_style_cache;
|
||||
/* start cache dump */
|
||||
if (dctx->view->view->cachedb != NULL)
|
||||
if (dctx->view->view->cachedb != NULL) {
|
||||
dns_db_attach(dctx->view->view->cachedb, &dctx->cache);
|
||||
}
|
||||
if (dctx->cache != NULL) {
|
||||
fprintf(dctx->fp,
|
||||
";\n; Cache dump of view '%s' (cache %s)\n;\n",
|
||||
|
|
@ -10647,43 +10652,52 @@ dumpdone(void *arg, isc_result_t result) {
|
|||
dctx->task,
|
||||
dumpdone, dctx,
|
||||
&dctx->mdctx);
|
||||
if (result == DNS_R_CONTINUE)
|
||||
if (result == DNS_R_CONTINUE) {
|
||||
return;
|
||||
if (result == ISC_R_NOTIMPLEMENTED)
|
||||
}
|
||||
if (result == ISC_R_NOTIMPLEMENTED) {
|
||||
fprintf(dctx->fp, "; %s\n",
|
||||
dns_result_totext(result));
|
||||
else if (result != ISC_R_SUCCESS)
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((dctx->dumpadb || dctx->dumpbad || dctx->dumpfail) &&
|
||||
dctx->cache == NULL && dctx->view->view->cachedb != NULL)
|
||||
dctx->cache == NULL && dctx->view->view->cachedb != NULL) {
|
||||
dns_db_attach(dctx->view->view->cachedb, &dctx->cache);
|
||||
}
|
||||
|
||||
if (dctx->cache != NULL) {
|
||||
if (dctx->dumpadb)
|
||||
if (dctx->dumpadb) {
|
||||
dns_adb_dump(dctx->view->view->adb, dctx->fp);
|
||||
if (dctx->dumpbad)
|
||||
}
|
||||
if (dctx->dumpbad) {
|
||||
dns_resolver_printbadcache(dctx->view->view->resolver,
|
||||
dctx->fp);
|
||||
if (dctx->dumpfail)
|
||||
}
|
||||
if (dctx->dumpfail) {
|
||||
dns_badcache_print(dctx->view->view->failcache,
|
||||
"SERVFAIL cache", dctx->fp);
|
||||
}
|
||||
dns_db_detach(&dctx->cache);
|
||||
}
|
||||
if (dctx->dumpzones) {
|
||||
style = &dns_master_style_full;
|
||||
nextzone:
|
||||
if (dctx->version != NULL)
|
||||
if (dctx->version != NULL) {
|
||||
dns_db_closeversion(dctx->db, &dctx->version,
|
||||
false);
|
||||
if (dctx->db != NULL)
|
||||
}
|
||||
if (dctx->db != NULL) {
|
||||
dns_db_detach(&dctx->db);
|
||||
if (dctx->zone == NULL)
|
||||
}
|
||||
if (dctx->zone == NULL) {
|
||||
dctx->zone = ISC_LIST_HEAD(dctx->view->zonelist);
|
||||
else
|
||||
} else {
|
||||
dctx->zone = ISC_LIST_NEXT(dctx->zone, link);
|
||||
}
|
||||
if (dctx->zone != NULL) {
|
||||
/* start zone dump */
|
||||
dns_zone_name(dctx->zone->zone, buf, sizeof(buf));
|
||||
|
|
@ -10702,8 +10716,9 @@ dumpdone(void *arg, isc_result_t result) {
|
|||
dctx->task,
|
||||
dumpdone, dctx,
|
||||
&dctx->mdctx);
|
||||
if (result == DNS_R_CONTINUE)
|
||||
if (result == DNS_R_CONTINUE) {
|
||||
return;
|
||||
}
|
||||
if (result == ISC_R_NOTIMPLEMENTED) {
|
||||
fprintf(dctx->fp, "; %s\n",
|
||||
dns_result_totext(result));
|
||||
|
|
@ -10711,26 +10726,31 @@ dumpdone(void *arg, isc_result_t result) {
|
|||
POST(result);
|
||||
goto nextzone;
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dctx->view != NULL)
|
||||
if (dctx->view != NULL) {
|
||||
dctx->view = ISC_LIST_NEXT(dctx->view, link);
|
||||
if (dctx->view != NULL)
|
||||
goto nextview;
|
||||
if (dctx->view != NULL) {
|
||||
goto nextview;
|
||||
}
|
||||
}
|
||||
done:
|
||||
fprintf(dctx->fp, "; Dump complete\n");
|
||||
result = isc_stdio_flush(dctx->fp);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||
"dumpdb complete");
|
||||
}
|
||||
cleanup:
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
|
||||
"dumpdb failed: %s", dns_result_totext(result));
|
||||
}
|
||||
dumpcontext_destroy(dctx);
|
||||
}
|
||||
|
||||
|
|
@ -15257,14 +15277,15 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex,
|
|||
|
||||
/* Look for the optional class name. */
|
||||
classtxt = next_token(lex, text);
|
||||
if (classtxt != NULL) {
|
||||
/* Look for the optional view name. */
|
||||
viewtxt = next_token(lex, text);
|
||||
}
|
||||
|
||||
if (classtxt != NULL) {
|
||||
isc_textregion_t r;
|
||||
|
||||
/* Look for the optional view name. */
|
||||
viewtxt = next_token(lex, text);
|
||||
|
||||
/*
|
||||
* If 'classtext' is not a valid class then it us a view name.
|
||||
*/
|
||||
r.base = classtxt;
|
||||
r.length = strlen(classtxt);
|
||||
result = dns_rdataclass_fromtext(&rdclass, &r);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static inline void
|
||||
fatal(const char *message) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static inline void
|
||||
fatal(const char *message) {
|
||||
fprintf(stderr, "%s\n", message);
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ clock_gettime(int32_t id, struct timespec *tp)
|
|||
UNUSED(id);
|
||||
|
||||
result = gettimeofday(&tv, NULL);
|
||||
if (result)
|
||||
return (result);
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
if (result == 0) {
|
||||
tp->tv_sec = tv.tv_sec;
|
||||
tp->tv_nsec = (long) tv.tv_usec * 1000;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -280,7 +280,7 @@ main(int argc, char *argv[]) {
|
|||
fprintf(stderr,
|
||||
"C_DestroyObject: Error = 0x%.8lX\n",
|
||||
rv);
|
||||
errflg = 1;
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -967,7 +967,6 @@ save_opt(struct query *query, char *code, char *value) {
|
|||
|
||||
static isc_result_t
|
||||
parse_netprefix(isc_sockaddr_t **sap, const char *value) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
isc_sockaddr_t *sa = NULL;
|
||||
struct in_addr in4;
|
||||
struct in6_addr in6;
|
||||
|
|
@ -981,6 +980,7 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
|
|||
|
||||
slash = strchr(buf, '/');
|
||||
if (slash != NULL) {
|
||||
isc_result_t result;
|
||||
*slash = '\0';
|
||||
result = isc_parse_uint32(&netmask, slash + 1, 10);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -215,15 +215,20 @@ CreateServiceAccount(char *name, char *password) {
|
|||
ui.usri1_flags = UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD |
|
||||
UF_SCRIPT;
|
||||
ui.usri1_script_path = NULL;
|
||||
|
||||
/*
|
||||
* Call the NetUserAdd function, specifying level 1.
|
||||
*/
|
||||
nStatus = NetUserAdd(NULL, dwLevel, (LPBYTE)&ui, &dwError);
|
||||
|
||||
if (nStatus != NERR_Success)
|
||||
if (nStatus != NERR_Success) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
retstat = AddPrivilegeToAcccount(name, SE_SERVICE_LOGON_PRIV);
|
||||
if (retstat != RTN_OK) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
|
@ -239,9 +244,10 @@ AddPrivilegeToAcccount(LPTSTR name, LPWSTR PrivilegeName) {
|
|||
/*
|
||||
* Open the policy on the target machine.
|
||||
*/
|
||||
if ((Status = OpenPolicy(NULL, POLICY_ALL_ACCESS, &PolicyHandle))
|
||||
!= STATUS_SUCCESS)
|
||||
Status = OpenPolicy(NULL, POLICY_ALL_ACCESS, &PolicyHandle);
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
return (RTN_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Let's see if the account exists. Return if not
|
||||
|
|
@ -258,13 +264,14 @@ AddPrivilegeToAcccount(LPTSTR name, LPWSTR PrivilegeName) {
|
|||
}
|
||||
|
||||
err = LsaNtStatusToWinError(SetPrivilegeOnAccount(PolicyHandle,
|
||||
pSid, PrivilegeName, TRUE));
|
||||
pSid, PrivilegeName, TRUE));
|
||||
|
||||
LsaClose(PolicyHandle);
|
||||
if (err == ERROR_SUCCESS)
|
||||
if (err == ERROR_SUCCESS) {
|
||||
return (RTN_OK);
|
||||
else
|
||||
} else {
|
||||
return (err);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -393,7 +400,6 @@ GetPrivilegesOnAccount(LSA_HANDLE PolicyHandle, PSID AccountSid,
|
|||
NTSTATUS Status;
|
||||
LSA_UNICODE_STRING *UserRights;
|
||||
ULONG CountOfRights;
|
||||
unsigned int retlen = 0;
|
||||
DWORD i, j;
|
||||
int found;
|
||||
|
||||
|
|
@ -404,6 +410,7 @@ GetPrivilegesOnAccount(LSA_HANDLE PolicyHandle, PSID AccountSid,
|
|||
return (Status);
|
||||
|
||||
for (i = 0; i < CountOfRights; i++) {
|
||||
unsigned int retlen;
|
||||
found = -1;
|
||||
retlen = UserRights[i].Length/sizeof(wchar_t);
|
||||
for (j = 0; j < *PrivCount; j++) {
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ BEGIN
|
|||
IDS_UNINSTALL_MESSAGE "Unregister Messages..."
|
||||
IDS_ERR_OPEN_SCM "Could not open Service Control Manager\n(%s)"
|
||||
IDS_ERR_OPEN_SERVICE "Could not open BIND Service\n(%s)"
|
||||
IDS_ERR_START_SERVICE "Could not start BIND Service\n(%s)"
|
||||
IDS_ERR_STOP_SERVICE "Could not stop BIND Service\n(%s)"
|
||||
IDS_ERR_NONCRIT_FILE "An error occurred while copying non-critical file %s\n(%s)\nDo you wish to continue?"
|
||||
IDS_ERR_COPY_FILE "An error occurred while copying file %s\n(%s)\nInstallation will be terminated"
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@ CBINDInstallDlg::CBINDInstallDlg(CWnd* pParent /*=NULL*/)
|
|||
char winsys[MAX_PATH];
|
||||
|
||||
//{{AFX_DATA_INIT(CBINDInstallDlg)
|
||||
/* cppcheck-suppress useInitializationList */
|
||||
m_targetDir = _T("");
|
||||
m_version = _T("");
|
||||
m_toolsOnly = FALSE;
|
||||
|
|
@ -1089,7 +1090,6 @@ CBINDInstallDlg::UpdateService(CString StartName) {
|
|||
SERVICE_ERROR_NORMAL, pathBuffer, NULL, NULL, NULL,
|
||||
StartName, m_accountPassword, BIND_DISPLAY_NAME)
|
||||
!= TRUE) {
|
||||
DWORD err = GetLastError();
|
||||
MsgBox(IDS_ERR_UPDATE_SERVICE, GetErrMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -1314,6 +1314,9 @@ void CBINDInstallDlg::StopBINDService() {
|
|||
}
|
||||
|
||||
BOOL rc = ControlService(hBINDSvc, SERVICE_CONTROL_STOP, &svcStatus);
|
||||
if (!rc) {
|
||||
MsgBox(IDS_ERR_STOP_SERVICE, GetErrMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1328,30 +1331,38 @@ void CBINDInstallDlg::StartBINDService() {
|
|||
}
|
||||
|
||||
SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME,
|
||||
SERVICE_ALL_ACCESS);
|
||||
SERVICE_ALL_ACCESS);
|
||||
if (!hBINDSvc) {
|
||||
MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage());
|
||||
}
|
||||
BOOL rc = StartService(hBINDSvc, 0, NULL);
|
||||
if (!rc) {
|
||||
MsgBox(IDS_ERR_START_SERVICE, GetErrMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if the BIND service is running or not
|
||||
*/
|
||||
BOOL CBINDInstallDlg::CheckBINDService() {
|
||||
BOOL
|
||||
CBINDInstallDlg::CheckBINDService() {
|
||||
SERVICE_STATUS svcStatus;
|
||||
|
||||
SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
if (hSCManager) {
|
||||
SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME,
|
||||
SERVICE_ALL_ACCESS);
|
||||
SERVICE_ALL_ACCESS);
|
||||
if (hBINDSvc) {
|
||||
BOOL rc = ControlService(hBINDSvc,
|
||||
SERVICE_CONTROL_INTERROGATE, &svcStatus);
|
||||
if (!rc)
|
||||
SERVICE_CONTROL_INTERROGATE,
|
||||
&svcStatus);
|
||||
if (!rc) {
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
DWORD err = GetLastError();
|
||||
}
|
||||
|
||||
return (svcStatus.dwCurrentState == SERVICE_RUNNING);
|
||||
return (rc &&
|
||||
svcStatus.dwCurrentState == SERVICE_RUNNING);
|
||||
}
|
||||
}
|
||||
return (FALSE);
|
||||
|
|
@ -1560,14 +1571,16 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) {
|
|||
return;
|
||||
}
|
||||
|
||||
hr = SHGetPathFromIDList(itemList, commonPath);
|
||||
pMalloc->Free(itemList);
|
||||
|
||||
if (create) {
|
||||
ProgramGroupCreate(commonPath);
|
||||
if (SHGetPathFromIDList(itemList, commonPath)) {
|
||||
if (create) {
|
||||
ProgramGroupCreate(commonPath);
|
||||
} else {
|
||||
ProgramGroupRemove(commonPath);
|
||||
}
|
||||
} else {
|
||||
ProgramGroupRemove(commonPath);
|
||||
MessageBox("SHGetPathFromIDList failed");
|
||||
}
|
||||
pMalloc->Free(itemList);
|
||||
}
|
||||
|
||||
CString CBINDInstallDlg::DestDir(int destination) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ CDirBrowse::CDirBrowse(CString initialDir, CWnd* pParent /*=NULL*/)
|
|||
//{{AFX_DATA_INIT(CDirBrowse)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
/* cppcheck-suppress useInitializationList */
|
||||
m_selectedDir = initialDir;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ CVersionInfo::CVersionInfo(CString filename)
|
|||
// And finally the version info is ours
|
||||
m_fixedInfo = (VS_FIXEDFILEINFO *)viBlob;
|
||||
|
||||
UINT blobLen = 0;
|
||||
|
||||
// If we got here, all is good
|
||||
}
|
||||
m_isValid = TRUE;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@
|
|||
#define IDC_ACCOUNT_PASSWORD 1031
|
||||
#define IDC_ACCOUNT_PASSWORD_CONFIRM 1032
|
||||
#define IDC_TOOLS_ONLY 1033
|
||||
#define IDS_ERR_START_SERVICE 1034
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
|
|
|||
|
|
@ -38,14 +38,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
|||
|
||||
static void
|
||||
nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
UNUSED(cb);
|
||||
UNUSED(fmt);
|
||||
UNUSED(ap);
|
||||
}
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
int
|
||||
LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
char totext[1024];
|
||||
dns_compress_t cctx;
|
||||
dns_decompress_t dctx;
|
||||
|
|
|
|||
|
|
@ -1769,7 +1769,7 @@ make_dnskey(dst_key_t *key, unsigned char *buf, int bufsize,
|
|||
}
|
||||
|
||||
static isc_result_t
|
||||
publish(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
|
||||
addrdata(dns_rdata_t *rdata, dns_diff_t *diff, const dns_name_t *origin,
|
||||
dns_ttl_t ttl, isc_mem_t *mctx)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
|
@ -1784,7 +1784,7 @@ publish(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
|
|||
}
|
||||
|
||||
static isc_result_t
|
||||
delrdata(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
|
||||
delrdata(dns_rdata_t *rdata, dns_diff_t *diff, const dns_name_t *origin,
|
||||
dns_ttl_t ttl, isc_mem_t *mctx)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
|
@ -1804,7 +1804,6 @@ publish_key(dns_diff_t *diff, dns_dnsseckey_t *key, const dns_name_t *origin,
|
|||
void (*report)(const char *, ...))
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_difftuple_t *tuple = NULL;
|
||||
unsigned char buf[DST_KEY_MAXSIZE];
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
dns_rdata_t dnskey = DNS_RDATA_INIT;
|
||||
|
|
@ -1828,10 +1827,7 @@ publish_key(dns_diff_t *diff, dns_dnsseckey_t *key, const dns_name_t *origin,
|
|||
}
|
||||
|
||||
/* publish key */
|
||||
RETERR(dns_difftuple_create(mctx, DNS_DIFFOP_ADD, origin, ttl,
|
||||
&dnskey, &tuple));
|
||||
dns_diff_appendminimal(diff, &tuple);
|
||||
result = ISC_R_SUCCESS;
|
||||
result = addrdata(&dnskey, diff, origin, ttl, mctx);
|
||||
|
||||
failure:
|
||||
return (result);
|
||||
|
|
@ -1843,7 +1839,6 @@ remove_key(dns_diff_t *diff, dns_dnsseckey_t *key, const dns_name_t *origin,
|
|||
void (*report)(const char *, ...))
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_difftuple_t *tuple = NULL;
|
||||
unsigned char buf[DST_KEY_MAXSIZE];
|
||||
dns_rdata_t dnskey = DNS_RDATA_INIT;
|
||||
char alg[80];
|
||||
|
|
@ -1853,10 +1848,7 @@ remove_key(dns_diff_t *diff, dns_dnsseckey_t *key, const dns_name_t *origin,
|
|||
reason, dst_key_id(key->key), alg);
|
||||
|
||||
RETERR(make_dnskey(key->key, buf, sizeof(buf), &dnskey));
|
||||
RETERR(dns_difftuple_create(mctx, DNS_DIFFOP_DEL, origin, ttl, &dnskey,
|
||||
&tuple));
|
||||
dns_diff_appendminimal(diff, &tuple);
|
||||
result = ISC_R_SUCCESS;
|
||||
result = delrdata(&dnskey, diff, origin, ttl, mctx);
|
||||
|
||||
failure:
|
||||
return (result);
|
||||
|
|
@ -1934,15 +1926,15 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
|
|||
if (!dns_rdataset_isassociated(cdnskey) ||
|
||||
!exists(cdnskey, &cdnskeyrdata))
|
||||
{
|
||||
RETERR(publish(&cdnskeyrdata, diff, origin,
|
||||
ttl, mctx));
|
||||
RETERR(addrdata(&cdnskeyrdata, diff, origin,
|
||||
ttl, mctx));
|
||||
}
|
||||
/* Only publish SHA-256 (SHA-1 is deprecated) */
|
||||
if (!dns_rdataset_isassociated(cds) ||
|
||||
!exists(cds, &cds_sha256))
|
||||
{
|
||||
RETERR(publish(&cds_sha256, diff, origin,
|
||||
ttl, mctx));
|
||||
RETERR(addrdata(&cds_sha256, diff, origin,
|
||||
ttl, mctx));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ dst_key_tofile(const dst_key_t *key, int type, const char *directory) {
|
|||
(key->key_flags & DNS_KEYFLAG_TYPEMASK) != DNS_KEYTYPE_NOKEY)
|
||||
return (key->func->tofile(key, directory));
|
||||
else
|
||||
return (ISC_R_SUCCESS);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -756,7 +756,9 @@ rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) {
|
|||
REQUIRE(iteratorp != NULL);
|
||||
REQUIRE(DNS_RDATASETITER_VALID(*iteratorp));
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
u.rdatasetiterator = *iteratorp;
|
||||
*iteratorp = NULL;
|
||||
|
||||
mctx = u.ecdbiterator->common.db->mctx;
|
||||
u.ecdbiterator->common.magic = 0;
|
||||
|
|
@ -765,8 +767,6 @@ rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) {
|
|||
&u.ecdbiterator->common.node);
|
||||
isc_mem_put(mctx, u.ecdbiterator,
|
||||
sizeof(ecdb_rdatasetiter_t));
|
||||
|
||||
*iteratorp = NULL;
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
|
|
|
|||
|
|
@ -2369,15 +2369,10 @@ dns_name_format(const dns_name_t *name, char *cp, unsigned int size) {
|
|||
isc_buffer_init(&buf, cp, size - 1);
|
||||
result = dns_name_totext(name, true, &buf);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
/*
|
||||
* Null terminate.
|
||||
*/
|
||||
isc_region_t r;
|
||||
isc_buffer_usedregion(&buf, &r);
|
||||
((char *) r.base)[r.length] = '\0';
|
||||
|
||||
} else
|
||||
isc_buffer_putuint8(&buf, (uint8_t)'\0');
|
||||
} else {
|
||||
snprintf(cp, size, "<unknown>");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ dns_nsec_buildrdata(dns_db_t *db, dns_dbversion_t *version,
|
|||
unsigned int max_type;
|
||||
dns_rdatasetiter_t *rdsiter;
|
||||
|
||||
REQUIRE(target != NULL);
|
||||
|
||||
memset(buffer, 0, DNS_NSEC_BUFFERSIZE);
|
||||
dns_name_toregion(target, &r);
|
||||
memmove(buffer, r.base, r.length);
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ progress_cb(int p, int n, BN_GENCB *cb) {
|
|||
|
||||
UNUSED(n);
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
u.dptr = BN_GENCB_get_arg(cb);
|
||||
if (u.fptr != NULL)
|
||||
u.fptr(p);
|
||||
|
|
@ -303,6 +304,7 @@ openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) {
|
|||
if (callback == NULL) {
|
||||
BN_GENCB_set_old(cb, NULL, NULL);
|
||||
} else {
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
u.fptr = callback;
|
||||
BN_GENCB_set(cb, &progress_cb, u.dptr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -426,6 +426,7 @@ progress_cb(int p, int n, BN_GENCB *cb) {
|
|||
|
||||
UNUSED(n);
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
u.dptr = BN_GENCB_get_arg(cb);
|
||||
if (u.fptr != NULL)
|
||||
u.fptr(p);
|
||||
|
|
@ -494,6 +495,7 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
|
|||
if (callback == NULL) {
|
||||
BN_GENCB_set_old(cb, NULL, NULL);
|
||||
} else {
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
u.fptr = callback;
|
||||
BN_GENCB_set(cb, &progress_cb, u.dptr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2948,6 +2948,12 @@ dns_rbt_indent(FILE *f, int depth) {
|
|||
|
||||
void
|
||||
dns_rbt_printnodeinfo(dns_rbtnode_t *n, FILE *f) {
|
||||
|
||||
if (n == NULL) {
|
||||
fprintf(f, "Null node\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "Node info for nodename: ");
|
||||
printnodename(n, true, f);
|
||||
fprintf(f, "\n");
|
||||
|
|
@ -2967,7 +2973,7 @@ dns_rbt_printnodeinfo(dns_rbtnode_t *n, FILE *f) {
|
|||
fprintf(f, "Right: %p\n", n->right);
|
||||
fprintf(f, "Left: %p\n", n->left);
|
||||
fprintf(f, "Down: %p\n", n->down);
|
||||
fprintf(f, "daTa: %p\n", n->data);
|
||||
fprintf(f, "Data: %p\n", n->data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -3000,8 +3006,12 @@ print_text_helper(dns_rbtnode_t *root, dns_rbtnode_t *parent,
|
|||
|
||||
if (root != NULL) {
|
||||
printnodename(root, true, f);
|
||||
/*
|
||||
* Don't use IS_RED(root) as it tests for 'root != NULL'
|
||||
* and cppcheck produces false positives.
|
||||
*/
|
||||
fprintf(f, " (%s, %s", direction,
|
||||
IS_RED(root) ? "RED" : "BLACK");
|
||||
COLOR(root) == RED ? "RED" : "BLACK");
|
||||
|
||||
if ((! IS_ROOT(root) && PARENT(root) != parent) ||
|
||||
( IS_ROOT(root) && depth > 0 &&
|
||||
|
|
@ -3025,13 +3035,22 @@ print_text_helper(dns_rbtnode_t *root, dns_rbtnode_t *parent,
|
|||
|
||||
depth++;
|
||||
|
||||
if (IS_RED(root) && IS_RED(LEFT(root)))
|
||||
/*
|
||||
* Don't use IS_RED(root) as it tests for 'root != NULL'
|
||||
* and cppcheck produces false positives.
|
||||
*/
|
||||
if (COLOR(root) == RED && IS_RED(LEFT(root))) {
|
||||
fprintf(f, "** Red/Red color violation on left\n");
|
||||
}
|
||||
print_text_helper(LEFT(root), root, depth, "left",
|
||||
data_printer, f);
|
||||
|
||||
if (IS_RED(root) && IS_RED(RIGHT(root)))
|
||||
/*
|
||||
* Don't use IS_RED(root) as cppcheck produces false positives.
|
||||
*/
|
||||
if (COLOR(root) == RED && IS_RED(RIGHT(root))) {
|
||||
fprintf(f, "** Red/Red color violation on right\n");
|
||||
}
|
||||
print_text_helper(RIGHT(root), root, depth, "right",
|
||||
data_printer, f);
|
||||
|
||||
|
|
|
|||
|
|
@ -360,8 +360,10 @@ dns_secalg_format(dns_secalg_t alg, char *cp, unsigned int size) {
|
|||
result = dns_secalg_totext(alg, &b);
|
||||
isc_buffer_usedregion(&b, &r);
|
||||
r.base[r.length] = 0;
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
r.base[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
|
@ -390,7 +392,10 @@ dns_keyflags_fromtext(dns_keyflags_t *flagsp, isc_textregion_t *source)
|
|||
{
|
||||
isc_result_t result;
|
||||
char *text, *end;
|
||||
unsigned int value, mask;
|
||||
unsigned int value = 0;
|
||||
#ifdef notyet
|
||||
unsigned int mask = 0;
|
||||
#endif
|
||||
|
||||
result = maybe_numeric(&value, source, 0xffff, true);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
|
|
@ -402,7 +407,6 @@ dns_keyflags_fromtext(dns_keyflags_t *flagsp, isc_textregion_t *source)
|
|||
|
||||
text = source->base;
|
||||
end = source->base + source->length;
|
||||
value = mask = 0;
|
||||
|
||||
while (text < end) {
|
||||
struct keyflag *p;
|
||||
|
|
@ -422,8 +426,8 @@ dns_keyflags_fromtext(dns_keyflags_t *flagsp, isc_textregion_t *source)
|
|||
#ifdef notyet
|
||||
if ((mask & p->mask) != 0)
|
||||
warn("overlapping key flags");
|
||||
#endif
|
||||
mask |= p->mask;
|
||||
#endif
|
||||
text += len;
|
||||
if (delim != NULL)
|
||||
text++; /* Skip "|" */
|
||||
|
|
@ -456,8 +460,10 @@ dns_dsdigest_format(dns_dsdigest_t typ, char *cp, unsigned int size) {
|
|||
result = dns_dsdigest_totext(typ, &b);
|
||||
isc_buffer_usedregion(&b, &r);
|
||||
r.base[r.length] = 0;
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
r.base[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ __wrap_isc__mem_get(isc_mem_t *mctx, size_t size)
|
|||
mock_assert(has_enough_memory, "mock isc_mem_get failed",
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/* cppcheck-suppress leakNoVarFunctionCall */
|
||||
return (malloc(size));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ dns_ttl_totext(uint32_t src, bool verbose,
|
|||
* here because region.base is type unsigned char *.
|
||||
*/
|
||||
isc_buffer_usedregion(target, ®ion);
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
region.base[region.length - 1] =
|
||||
toupper(region.base[region.length - 1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6123,17 +6123,17 @@ dns_zone_maintenance(dns_zone_t *zone) {
|
|||
|
||||
static inline bool
|
||||
was_dumping(dns_zone_t *zone) {
|
||||
bool dumping;
|
||||
|
||||
REQUIRE(LOCKED_ZONE(zone));
|
||||
|
||||
dumping = DNS_ZONE_FLAG(zone, DNS_ZONEFLG_DUMPING);
|
||||
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_DUMPING);
|
||||
if (!dumping) {
|
||||
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDDUMP);
|
||||
isc_time_settoepoch(&zone->dumptime);
|
||||
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_DUMPING)) {
|
||||
return (true);
|
||||
}
|
||||
return (dumping);
|
||||
|
||||
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_DUMPING);
|
||||
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDDUMP);
|
||||
isc_time_settoepoch(&zone->dumptime);
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*%
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ isc_result_t
|
|||
get_win32_searchlist(irs_resconf_t *conf) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
HKEY hKey;
|
||||
BOOL keyFound = TRUE;
|
||||
char searchlist[MAX_PATH];
|
||||
DWORD searchlen = MAX_PATH;
|
||||
LSTATUS status;
|
||||
|
|
|
|||
|
|
@ -839,7 +839,6 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
|
|||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
"Unexpected state %d",
|
||||
state);
|
||||
ISC_UNREACHABLE();
|
||||
}
|
||||
|
||||
} while (!done);
|
||||
|
|
|
|||
|
|
@ -194,7 +194,6 @@ isc_ratelimiter_dequeue(isc_ratelimiter_t *rl, isc_event_t *event) {
|
|||
|
||||
static void
|
||||
ratelimiter_tick(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
isc_ratelimiter_t *rl = (isc_ratelimiter_t *)event->ev_arg;
|
||||
isc_event_t *p;
|
||||
uint32_t pertic;
|
||||
|
|
@ -214,6 +213,7 @@ ratelimiter_tick(isc_task_t *task, isc_event_t *event) {
|
|||
*/
|
||||
ISC_LIST_UNLINK(rl->pending, p, ev_ratelink);
|
||||
} else {
|
||||
isc_result_t result;
|
||||
/*
|
||||
* No work left to do. Stop the timer so that we don't
|
||||
* waste resources by having it fire periodically.
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
|
|||
*/
|
||||
isc_buffer_availableregion(target, &avail);
|
||||
INSIST(avail.length >= 1);
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
avail.base[0] = '\0';
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
|
|
|||
|
|
@ -170,8 +170,10 @@ isc_hmac_update_test(void **state) {
|
|||
static void
|
||||
isc_hmac_reset_test(void **state) {
|
||||
isc_hmac_t *hmac = *state;
|
||||
#if 0
|
||||
unsigned char digest[ISC_MAX_MD_SIZE] __attribute((unused));
|
||||
unsigned int digestlen __attribute((unused));
|
||||
#endif
|
||||
|
||||
assert_non_null(hmac);
|
||||
|
||||
|
|
|
|||
|
|
@ -157,8 +157,10 @@ isc_md_update_test(void **state) {
|
|||
static void
|
||||
isc_md_reset_test(void **state) {
|
||||
isc_md_t *md = *state;
|
||||
#if 0
|
||||
unsigned char digest[ISC_MAX_MD_SIZE] __attribute((unused));
|
||||
unsigned int digestlen __attribute((unused));
|
||||
#endif
|
||||
|
||||
assert_non_null(md);
|
||||
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ queue_valid(void **state) {
|
|||
assert_non_null(p);
|
||||
assert_int_equal(p->value, 5);
|
||||
|
||||
assert_null(queue.head);
|
||||
assert_null(queue.tail);
|
||||
assert_true(ISC_QUEUE_EMPTY(queue));
|
||||
|
||||
ISC_QUEUE_DESTROY(queue);
|
||||
|
|
|
|||
|
|
@ -541,6 +541,7 @@ blockfrequency(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
|||
|
||||
/* Preconditions (section 2.2.7 in NIST SP 800-22) */
|
||||
assert_true(numbits >= 100);
|
||||
/* cppcheck-suppress constArgument */
|
||||
assert_true(mbits >= 20);
|
||||
assert_true((double) mbits > (0.01 * numbits));
|
||||
assert_true(numblocks < 100);
|
||||
|
|
|
|||
|
|
@ -421,6 +421,8 @@ basic_cb(isc_task_t *task, isc_event_t *event) {
|
|||
j += 100;
|
||||
}
|
||||
|
||||
UNUSED(j);
|
||||
|
||||
if (verbose) {
|
||||
print_message("# task %s\n", (char *)event->ev_arg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) {
|
|||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
/* cppcheck-suppress duplicateCondition */
|
||||
if (resource == isc_resource_openfiles && rlim_value == RLIM_INFINITY) {
|
||||
if (getrlimit(unixresource, &rl) == 0) {
|
||||
rl.rlim_cur = rl.rlim_max;
|
||||
|
|
|
|||
|
|
@ -352,7 +352,6 @@ isc_file_template(const char *path, const char *templet, char *buf,
|
|||
isc_result_t
|
||||
isc_file_renameunique(const char *file, char *templet) {
|
||||
int fd;
|
||||
int res = 0;
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
||||
REQUIRE(file != NULL);
|
||||
|
|
@ -365,6 +364,7 @@ isc_file_renameunique(const char *file, char *templet) {
|
|||
close(fd);
|
||||
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
int res;
|
||||
res = isc_file_safemovefile(file, templet);
|
||||
if (res != 0) {
|
||||
result = isc__errno2result(errno);
|
||||
|
|
|
|||
|
|
@ -278,8 +278,6 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
|
|||
ioctl_failure:
|
||||
if (iter->buf4 != NULL)
|
||||
isc_mem_put(mctx, iter->buf4, iter->buf4size);
|
||||
|
||||
alloc_failure:
|
||||
if (iter->socket != INVALID_SOCKET)
|
||||
(void) closesocket(iter->socket);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,10 +39,14 @@
|
|||
|
||||
#define MAX_NAME_LENGTH 256
|
||||
|
||||
#define CHECK(op) \
|
||||
do { result = (op); if (result != ISC_R_SUCCESS) { goto cleanup; } } while (0)
|
||||
|
||||
isc_result_t
|
||||
isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
|
||||
unsigned int maxgroups,
|
||||
unsigned int *totalGroups) {
|
||||
unsigned int *totalGroups)
|
||||
{
|
||||
LPGROUP_USERS_INFO_0 pTmpBuf;
|
||||
LPLOCALGROUP_USERS_INFO_0 pTmpLBuf;
|
||||
DWORD i;
|
||||
|
|
@ -56,10 +60,15 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
|
|||
NET_API_STATUS nStatus;
|
||||
size_t retlen;
|
||||
wchar_t user[MAX_NAME_LENGTH];
|
||||
|
||||
retlen = mbstowcs(user, username, MAX_NAME_LENGTH);
|
||||
isc_result_t result;
|
||||
|
||||
*totalGroups = 0;
|
||||
|
||||
retlen = mbstowcs(user, username, MAX_NAME_LENGTH);
|
||||
if (retlen == (size_t) (-1)) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Call the NetUserGetLocalGroups function
|
||||
* specifying information level 0.
|
||||
|
|
@ -68,24 +77,22 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
|
|||
* function should also return the names of the local
|
||||
* groups in which the user is indirectly a member.
|
||||
*/
|
||||
nStatus = NetUserGetLocalGroups(NULL,
|
||||
user,
|
||||
dwLevel,
|
||||
dwFlags,
|
||||
(LPBYTE *) &pBuf,
|
||||
dwPrefMaxLen,
|
||||
&dwEntriesRead,
|
||||
&dwTotalEntries);
|
||||
nStatus = NetUserGetLocalGroups(NULL, user, dwLevel, dwFlags,
|
||||
(LPBYTE *) &pBuf, dwPrefMaxLen,
|
||||
&dwEntriesRead, &dwTotalEntries);
|
||||
/*
|
||||
* See if the call succeeds,
|
||||
*/
|
||||
if (nStatus != NERR_Success) {
|
||||
if (nStatus == ERROR_ACCESS_DENIED)
|
||||
if (nStatus == ERROR_ACCESS_DENIED) {
|
||||
return (ISC_R_NOPERM);
|
||||
if (nStatus == ERROR_MORE_DATA)
|
||||
}
|
||||
if (nStatus == ERROR_MORE_DATA) {
|
||||
return (ISC_R_NOSPACE);
|
||||
if (nStatus == NERR_UserNotFound)
|
||||
}
|
||||
if (nStatus == NERR_UserNotFound) {
|
||||
dwEntriesRead = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (pBuf != NULL) {
|
||||
|
|
@ -96,24 +103,32 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
|
|||
for (i = 0;
|
||||
(i < dwEntriesRead && *totalGroups < maxgroups); i++) {
|
||||
assert(pTmpLBuf != NULL);
|
||||
if (pTmpLBuf == NULL)
|
||||
if (pTmpLBuf == NULL) {
|
||||
break;
|
||||
}
|
||||
retlen = wcslen(pTmpLBuf->lgrui0_name);
|
||||
GroupList[*totalGroups] = (char *) malloc(retlen +1);
|
||||
if (GroupList[*totalGroups] == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
if (GroupList[*totalGroups] == NULL) {
|
||||
CHECK(ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
retlen = wcstombs(GroupList[*totalGroups],
|
||||
pTmpLBuf->lgrui0_name, retlen);
|
||||
GroupList[*totalGroups][retlen] = '\0';
|
||||
if (strcmp(GroupList[*totalGroups], "None") == 0)
|
||||
pTmpLBuf->lgrui0_name, retlen);
|
||||
if (retlen == (size_t) (-1)) {
|
||||
free(GroupList[*totalGroups]);
|
||||
else
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
GroupList[*totalGroups][retlen] = '\0';
|
||||
if (strcmp(GroupList[*totalGroups], "None") == 0) {
|
||||
free(GroupList[*totalGroups]);
|
||||
} else {
|
||||
(*totalGroups)++;
|
||||
}
|
||||
pTmpLBuf++;
|
||||
}
|
||||
}
|
||||
/* Free the allocated memory. */
|
||||
/* cppcheck-suppress duplicateCondition */
|
||||
if (pBuf != NULL)
|
||||
NetApiBufferFree(pBuf);
|
||||
|
||||
|
|
@ -121,23 +136,22 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
|
|||
/*
|
||||
* Call the NetUserGetGroups function, specifying level 0.
|
||||
*/
|
||||
nStatus = NetUserGetGroups(NULL,
|
||||
user,
|
||||
dwLevel,
|
||||
(LPBYTE*)&pgrpBuf,
|
||||
dwPrefMaxLen,
|
||||
&dwEntriesRead,
|
||||
&dwTotalEntries);
|
||||
nStatus = NetUserGetGroups(NULL, user, dwLevel,
|
||||
(LPBYTE*)&pgrpBuf, dwPrefMaxLen,
|
||||
&dwEntriesRead, &dwTotalEntries);
|
||||
/*
|
||||
* See if the call succeeds,
|
||||
*/
|
||||
if (nStatus != NERR_Success) {
|
||||
if (nStatus == ERROR_ACCESS_DENIED)
|
||||
if (nStatus == ERROR_ACCESS_DENIED) {
|
||||
return (ISC_R_NOPERM);
|
||||
if (nStatus == ERROR_MORE_DATA)
|
||||
}
|
||||
if (nStatus == ERROR_MORE_DATA) {
|
||||
return (ISC_R_NOSPACE);
|
||||
if (nStatus == NERR_UserNotFound)
|
||||
}
|
||||
if (nStatus == NERR_UserNotFound) {
|
||||
dwEntriesRead = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (pgrpBuf != NULL) {
|
||||
|
|
@ -149,28 +163,43 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
|
|||
(i < dwEntriesRead && *totalGroups < maxgroups); i++) {
|
||||
assert(pTmpBuf != NULL);
|
||||
|
||||
if (pTmpBuf == NULL)
|
||||
if (pTmpBuf == NULL) {
|
||||
break;
|
||||
}
|
||||
retlen = wcslen(pTmpBuf->grui0_name);
|
||||
GroupList[*totalGroups] = (char *) malloc(retlen +1);
|
||||
if (GroupList[*totalGroups] == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
if (GroupList[*totalGroups] == NULL) {
|
||||
CHECK(ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
retlen = wcstombs(GroupList[*totalGroups],
|
||||
pTmpBuf->grui0_name, retlen);
|
||||
GroupList[*totalGroups][retlen] = '\0';
|
||||
if (strcmp(GroupList[*totalGroups], "None") == 0)
|
||||
if (retlen == (size_t) (-1)) {
|
||||
free(GroupList[*totalGroups]);
|
||||
else
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
GroupList[*totalGroups][retlen] = '\0';
|
||||
if (strcmp(GroupList[*totalGroups], "None") == 0) {
|
||||
free(GroupList[*totalGroups]);
|
||||
} else {
|
||||
(*totalGroups)++;
|
||||
}
|
||||
pTmpBuf++;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Free the allocated memory.
|
||||
*/
|
||||
if (pgrpBuf != NULL)
|
||||
/* cppcheck-suppress duplicateCondition */
|
||||
if (pgrpBuf != NULL) {
|
||||
NetApiBufferFree(pgrpBuf);
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
while (--(*totalGroups) > 0) {
|
||||
free(GroupList[*totalGroups]);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1334,9 +1334,9 @@ use_min_mtu(isc_socket_t *sock) {
|
|||
|
||||
static isc_result_t
|
||||
allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
||||
isc_socket_t **socketp) {
|
||||
isc_socket_t **socketp)
|
||||
{
|
||||
isc_socket_t *sock;
|
||||
isc_result_t result;
|
||||
|
||||
sock = isc_mem_get(manager->mctx, sizeof(*sock));
|
||||
|
||||
|
|
@ -1385,13 +1385,6 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
|||
*socketp = sock;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
error:
|
||||
if (sock->recvbuf.base != NULL)
|
||||
isc_mem_put(manager->mctx, sock->recvbuf.base, sock->recvbuf.len);
|
||||
isc_mem_put(manager->mctx, sock, sizeof(*sock));
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2321,7 +2314,6 @@ restart_accept(isc_socket_t *parent, IoCompletionInfo *lpo)
|
|||
static isc_threadresult_t WINAPI
|
||||
SocketIoThread(LPVOID ThreadContext) {
|
||||
isc_socketmgr_t *manager = ThreadContext;
|
||||
BOOL bSuccess = FALSE;
|
||||
DWORD nbytes;
|
||||
IoCompletionInfo *lpo = NULL;
|
||||
isc_socket_t *sock = NULL;
|
||||
|
|
@ -2351,6 +2343,8 @@ SocketIoThread(LPVOID ThreadContext) {
|
|||
* Loop forever waiting on I/O Completions and then processing them
|
||||
*/
|
||||
while (TRUE) {
|
||||
BOOL bSuccess;
|
||||
|
||||
wait_again:
|
||||
bSuccess = GetQueuedCompletionStatus(manager->hIoCompletionPort,
|
||||
&nbytes,
|
||||
|
|
@ -3491,6 +3485,7 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
|||
_set_state(sock, SOCK_CLOSED);
|
||||
}
|
||||
how &= ~ISC_SOCKCANCEL_CONNECT;
|
||||
UNUSED(how);
|
||||
|
||||
maybe_free_socket(&sock, __LINE__);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,9 @@ isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) {
|
|||
i1.LowPart = temp.dwLowDateTime;
|
||||
i1.HighPart = temp.dwHighDateTime;
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.QuadPart += (unsigned __int64)nanoseconds/100;
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.QuadPart += (unsigned __int64)seconds*10000000;
|
||||
|
||||
t->absolute.dwLowDateTime = i1.LowPart;
|
||||
|
|
@ -137,6 +139,7 @@ isc_time_nowplusinterval(isc_time_t *t, const isc_interval_t *i) {
|
|||
if (UINT64_MAX - i1.QuadPart < (unsigned __int64)i->interval)
|
||||
return (ISC_R_RANGE);
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.QuadPart += i->interval;
|
||||
|
||||
t->absolute.dwLowDateTime = i1.LowPart;
|
||||
|
|
@ -165,6 +168,7 @@ isc_time_add(const isc_time_t *t, const isc_interval_t *i, isc_time_t *result)
|
|||
if (UINT64_MAX - i1.QuadPart < (unsigned __int64)i->interval)
|
||||
return (ISC_R_RANGE);
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.QuadPart += i->interval;
|
||||
|
||||
result->absolute.dwLowDateTime = i1.LowPart;
|
||||
|
|
@ -186,6 +190,7 @@ isc_time_subtract(const isc_time_t *t, const isc_interval_t *i,
|
|||
if (i1.QuadPart < (unsigned __int64) i->interval)
|
||||
return (ISC_R_RANGE);
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.QuadPart -= i->interval;
|
||||
|
||||
result->absolute.dwLowDateTime = i1.LowPart;
|
||||
|
|
@ -201,9 +206,13 @@ isc_time_microdiff(const isc_time_t *t1, const isc_time_t *t2) {
|
|||
|
||||
REQUIRE(t1 != NULL && t2 != NULL);
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.LowPart = t1->absolute.dwLowDateTime;
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.HighPart = t1->absolute.dwHighDateTime;
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i2.LowPart = t2->absolute.dwLowDateTime;
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i2.HighPart = t2->absolute.dwHighDateTime;
|
||||
|
||||
if (i1.QuadPart <= i2.QuadPart)
|
||||
|
|
@ -226,9 +235,13 @@ isc_time_seconds(const isc_time_t *t) {
|
|||
|
||||
SystemTimeToFileTime(&epoch1970, &temp);
|
||||
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.LowPart = t->absolute.dwLowDateTime;
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i1.HighPart = t->absolute.dwHighDateTime;
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i2.LowPart = temp.dwLowDateTime;
|
||||
/* cppcheck-suppress unreadVariable */
|
||||
i2.HighPart = temp.dwHighDateTime;
|
||||
|
||||
i3 = (i1.QuadPart - i2.QuadPart) / 10000000;
|
||||
|
|
|
|||
|
|
@ -2602,8 +2602,9 @@ parse_unitstring(char *str, isc_resourcevalue_t *valuep) {
|
|||
default:
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
if (value > UINT64_MAX / unit)
|
||||
if (value > ((uint64_t)UINT64_MAX / unit)) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
*valuep = value * unit;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2222,7 +2222,6 @@ print_symval(cfg_printer_t *pctx, const char *name, cfg_obj_t *obj) {
|
|||
|
||||
void
|
||||
cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
const cfg_clausedef_t * const *clauseset;
|
||||
|
||||
REQUIRE(pctx != NULL);
|
||||
|
|
@ -2238,6 +2237,7 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) {
|
|||
for (clause = *clauseset;
|
||||
clause->name != NULL;
|
||||
clause++) {
|
||||
isc_result_t result;
|
||||
result = isc_symtab_lookup(obj->value.map.symtab,
|
||||
clause->name, 0, &symval);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -543,11 +543,10 @@ exit_check(ns_client_t *client) {
|
|||
|
||||
if (client->nreads > 0) {
|
||||
dns_tcpmsg_cancelread(&client->tcpmsg);
|
||||
}
|
||||
|
||||
/* Still waiting for read cancel completion. */
|
||||
if (client->nreads > 0) {
|
||||
return (true);
|
||||
/* Still waiting for read cancel completion? */
|
||||
if (client->nreads > 0) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
if (client->tcpmsg_valid) {
|
||||
|
|
@ -638,22 +637,20 @@ exit_check(ns_client_t *client) {
|
|||
if (client->naccepts > 0) {
|
||||
isc_socket_cancel(client->tcplistener, client->task,
|
||||
ISC_SOCKCANCEL_ACCEPT);
|
||||
}
|
||||
|
||||
/* Still waiting for accept cancel completion. */
|
||||
if (client->naccepts > 0) {
|
||||
return (true);
|
||||
/* Still waiting for accept cancel completion? */
|
||||
if (client->naccepts > 0) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Accept cancel is complete. */
|
||||
if (client->nrecvs > 0) {
|
||||
isc_socket_cancel(client->udpsocket, client->task,
|
||||
ISC_SOCKCANCEL_RECV);
|
||||
}
|
||||
|
||||
/* Still waiting for recv cancel completion. */
|
||||
if (client->nrecvs > 0) {
|
||||
return (true);
|
||||
/* Still waiting for recv cancel completion? */
|
||||
if (client->nrecvs > 0) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Still waiting for control event to be delivered */
|
||||
|
|
@ -1071,7 +1068,6 @@ client_sendpkg(ns_client_t *client, isc_buffer_t *buffer) {
|
|||
isc_netaddr_t netaddr;
|
||||
int match;
|
||||
unsigned int sockflags = ISC_SOCKFLAG_IMMEDIATE;
|
||||
isc_dscp_t dispdscp = -1;
|
||||
|
||||
if (TCP_CLIENT(client)) {
|
||||
sock = client->tcpsocket;
|
||||
|
|
@ -1101,9 +1097,10 @@ client_sendpkg(ns_client_t *client, isc_buffer_t *buffer) {
|
|||
pktinfo = NULL;
|
||||
|
||||
if (client->dispatch != NULL) {
|
||||
dispdscp = dns_dispatch_getdscp(client->dispatch);
|
||||
if (dispdscp != -1)
|
||||
client->dscp = dispdscp;
|
||||
isc_dscp_t dscp = dns_dispatch_getdscp(client->dispatch);
|
||||
if (dscp != -1) {
|
||||
client->dscp = dscp;
|
||||
}
|
||||
}
|
||||
|
||||
if (client->dscp == -1) {
|
||||
|
|
@ -3792,7 +3789,7 @@ get_client(ns_clientmgr_t *manager, ns_interface_t *ifp,
|
|||
ev = &client->ctlevent;
|
||||
isc_task_send(client->task, &ev);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
|
|
@ -3865,7 +3862,7 @@ get_worker(ns_clientmgr_t *manager, ns_interface_t *ifp, isc_socket_t *sock,
|
|||
ev = &client->ctlevent;
|
||||
isc_task_send(client->task, &ev);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
|
@ -3914,7 +3911,7 @@ ns__clientmgr_getclient(ns_clientmgr_t *manager, ns_interface_t *ifp,
|
|||
|
||||
*clientp = client;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
|
@ -4031,6 +4028,8 @@ ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
|
|||
const char *signer = "", *qname = "";
|
||||
dns_name_t *q = NULL;
|
||||
|
||||
REQUIRE(client != NULL);
|
||||
|
||||
vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
|
||||
|
||||
if (client->signer != NULL) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue