mirror of https://git.48k.eu/ogserver
parent
e81685bba0
commit
89ba3f1b4f
12
src/dbi.c
12
src/dbi.c
|
@ -275,7 +275,7 @@ int og_dbi_get_server_ip(const struct og_dbi *dbi, const char *client_ip,
|
|||
bool found = false;
|
||||
dbi_result result;
|
||||
|
||||
if (inet_aton(client_ip, &client) < 0) {
|
||||
if (!inet_aton(client_ip, &client)) {
|
||||
syslog(LOG_ERR, "failed to parse client IP (%s:%d)\n",
|
||||
__func__, __LINE__);
|
||||
return -1;
|
||||
|
@ -300,7 +300,7 @@ int og_dbi_get_server_ip(const struct og_dbi *dbi, const char *client_ip,
|
|||
}
|
||||
|
||||
netmask_ip = dbi_result_get_string(result, "netmask");
|
||||
if (inet_aton(netmask_ip, &netmask) < 0) {
|
||||
if (!inet_aton(netmask_ip, &netmask)) {
|
||||
syslog(LOG_ERR, "failed to parse netmask (%s:%d)\n",
|
||||
__func__, __LINE__);
|
||||
dbi_result_free(result);
|
||||
|
@ -324,7 +324,7 @@ int og_dbi_get_server_ip(const struct og_dbi *dbi, const char *client_ip,
|
|||
if (server_ip[0] && !first_server_ip)
|
||||
first_server_ip = server_ip;
|
||||
|
||||
if (inet_aton(server_ip, &server) < 0) {
|
||||
if (!inet_aton(server_ip, &server)) {
|
||||
syslog(LOG_ERR, "failed to get repository IP (%s:%d)\n",
|
||||
__func__, __LINE__);
|
||||
dbi_result_free(result);
|
||||
|
@ -369,7 +369,7 @@ int og_dbi_get_repository_ip(const struct og_dbi *dbi, const uint32_t repo_id,
|
|||
bool found = false;
|
||||
dbi_result result;
|
||||
|
||||
if (inet_aton(client_ip, &client) < 0) {
|
||||
if (!inet_aton(client_ip, &client)) {
|
||||
syslog(LOG_ERR, "failed to parse client IP (%s:%d)\n",
|
||||
__func__, __LINE__);
|
||||
return -1;
|
||||
|
@ -394,7 +394,7 @@ int og_dbi_get_repository_ip(const struct og_dbi *dbi, const uint32_t repo_id,
|
|||
}
|
||||
|
||||
netmask_ip = dbi_result_get_string(result, "netmask");
|
||||
if (inet_aton(netmask_ip, &netmask) < 0) {
|
||||
if (!inet_aton(netmask_ip, &netmask)) {
|
||||
syslog(LOG_ERR, "failed to parse netmask (%s:%d)\n",
|
||||
__func__, __LINE__);
|
||||
dbi_result_free(result);
|
||||
|
@ -419,7 +419,7 @@ int og_dbi_get_repository_ip(const struct og_dbi *dbi, const uint32_t repo_id,
|
|||
if (repo_ip[0] && !first_repo_ip)
|
||||
first_repo_ip = repo_ip;
|
||||
|
||||
if (inet_aton(repo_ip, &repo) < 0) {
|
||||
if (!inet_aton(repo_ip, &repo)) {
|
||||
syslog(LOG_ERR, "failed to get repository IP (%s:%d)\n",
|
||||
__func__, __LINE__);
|
||||
dbi_result_free(result);
|
||||
|
|
|
@ -91,7 +91,7 @@ int og_repo_list(struct list_head *repo_list)
|
|||
name = dbi_result_get_string(result, "nombrerepositorio");
|
||||
alias = dbi_result_get_ulonglong(result, "alias");
|
||||
|
||||
if (inet_aton(ip, &addr) < 0) {
|
||||
if (!inet_aton(ip, &addr)) {
|
||||
syslog(LOG_ERR, "malformed IP in repo %s\n", name);
|
||||
goto err_repo_list;
|
||||
}
|
||||
|
|
|
@ -603,7 +603,7 @@ static int og_cmd_wol(json_t *element, struct og_msg_params *params)
|
|||
if (og_client_find(new_params.ips_array[i]))
|
||||
continue;
|
||||
|
||||
if (inet_aton(new_params.ips_array[i], &addr) < 0)
|
||||
if (!inet_aton(new_params.ips_array[i], &addr))
|
||||
continue;
|
||||
|
||||
cli_wol = og_client_wol_find(&addr);
|
||||
|
@ -618,7 +618,7 @@ static int og_cmd_wol(json_t *element, struct og_msg_params *params)
|
|||
|
||||
list_add_tail(&cli_wol->list, &client_wol_list);
|
||||
|
||||
if (inet_aton(new_params.netmask_array[i], &netmask) < 0)
|
||||
if (!inet_aton(new_params.netmask_array[i], &netmask))
|
||||
continue;
|
||||
|
||||
if (wake_up(sd, &addr, &netmask, new_params.mac_array[i],
|
||||
|
@ -2011,7 +2011,7 @@ static int og_cmd_get_client_info(json_t *element,
|
|||
if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR))
|
||||
return -1;
|
||||
|
||||
if (inet_aton(params->ips_array[0], &addr) == 0)
|
||||
if (!inet_aton(params->ips_array[0], &addr))
|
||||
return -1;
|
||||
|
||||
dbi = og_dbi_open(&ogconfig.db);
|
||||
|
|
Loading…
Reference in New Issue