Fix whitespace and some coverity errors
This commit is contained in:
parent
74a29c8d4b
commit
cb1c8426ae
1 changed files with 28 additions and 19 deletions
19
chirond.c
19
chirond.c
|
@ -111,7 +111,9 @@ STATUS tlv_to_linked_list(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct ll_tlv **f
|
|||
|
||||
element->length = *tlvptr++;
|
||||
if (tlvptr + element->length > data.data + data.length) {
|
||||
prev_elem->next = NULL;
|
||||
if (prev_elem != NULL) {
|
||||
prev_elem->next = NULL;
|
||||
}
|
||||
talloc_free(element);
|
||||
return ST_PARSE_ERROR;
|
||||
}
|
||||
|
@ -341,9 +343,11 @@ STATUS handle_message(struct chiron_context *ctx, DATA_BLOB data) {
|
|||
break;
|
||||
case CHIRON_ACK:
|
||||
status = handle_chiron_msg_ack(ctx, msg);
|
||||
break;
|
||||
default:
|
||||
DEBUG(0, "Got unexpected message type: %s.",
|
||||
ndr_print_chiron_msg_type_enum(msg, msg->msg_type));
|
||||
status = ST_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -429,6 +433,7 @@ static STATUS listen_server(TALLOC_CTX *mem_ctx, const char *bindaddr, const cha
|
|||
|
||||
if (sock < 0) {
|
||||
DEBUG(0, "Could not create socket in server");
|
||||
freeaddrinfo(first_server);
|
||||
return ST_SOCKET_FAILURE;
|
||||
}
|
||||
listen(sock, 128);
|
||||
|
@ -460,7 +465,12 @@ static STATUS listen_server(TALLOC_CTX *mem_ctx, const char *bindaddr, const cha
|
|||
//} else {
|
||||
{
|
||||
struct chiron_context *client_ctx = talloc_zero(mem_ctx, struct chiron_context);
|
||||
NO_MEM_RETURN(client_ctx);
|
||||
if (client_ctx == NULL) {
|
||||
close(sock);
|
||||
close(clientfd);
|
||||
DEBUG(0, "Out of memory");
|
||||
return ST_OUT_OF_MEMORY;
|
||||
}
|
||||
client_ctx->clientaddr = (struct sockaddr *)&clientaddr;
|
||||
client_ctx->clientfd = clientfd;
|
||||
|
||||
|
@ -563,12 +573,11 @@ int main (int argc, char **argv) {
|
|||
hexdump("Decrypted outgoing payload", buf, sizeof(out_message2) - 4);
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Open up a TCP socket the Chiron port
|
||||
*/
|
||||
listen_server(mem_ctx, "::", CHIRON_PORT, "tcp", handle_connection);
|
||||
//listen_server(mem_ctx, "::", CHIRON_PORT, "tcp", handle_connection);
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue