X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fclient.c;h=1c5972b688e6e741c07be4161c85dcf8289a9656;hb=3c918a16e5959c8ea47600ced42fba0e15b39e11;hp=526e1f4bf5f2fc35cee0b33e10dd5ecfba2e3d90;hpb=676d49d2b2975c49bf80d62bf4a76301d0e22e57;p=umurmur.git diff --git a/src/client.c b/src/client.c index 526e1f4..1c5972b 100644 --- a/src/client.c +++ b/src/client.c @@ -168,7 +168,7 @@ void Client_token_add(client_t *client, char *token_string) client->tokencount++; } -bool_t Client_token_match(client_t *client, char *str) +bool_t Client_token_match(client_t *client, char const *str) { token_t *token; struct dlist *itr; @@ -323,9 +323,12 @@ int Client_add(int fd, struct sockaddr_storage *remote) { client_t* newclient; message_t *sendmsg; + char* addressString = NULL; if (Ban_isBannedAddr(remote)) { - Log_info("Address %s banned. Disconnecting", Util_addressToString(remote)); + addressString = Util_addressToString(remote); + Log_info("Address %s banned. Disconnecting", addressString); + free(addressString); return -1; } @@ -336,7 +339,9 @@ int Client_add(int fd, struct sockaddr_storage *remote) memcpy(&newclient->remote_tcp, remote, sizeof(struct sockaddr_storage)); newclient->ssl = SSLi_newconnection(&newclient->tcpfd, &newclient->SSLready); if (newclient->ssl == NULL) { - Log_warn("SSL negotiation failed with %s on port %d", Util_addressToString(remote), Util_addressToPort(remote)); + addressString = Util_addressToString(remote); + Log_warn("SSL negotiation failed with %s on port %d", addressString, Util_addressToPort(remote)); + free(addressString); free(newclient); return -1; } @@ -834,7 +839,9 @@ int Client_read_udp(int udpsock) if (memcmp(itraddress, fromaddress, addresslength) == 0) { if (checkDecrypt(itr, encrypted, buffer, len)) { memcpy(itr->key, key, KEY_LENGTH); - Log_info_client(itr, "New UDP connection from %s on port %d", Util_clientAddressToString(itr), fromport); + char* clientAddressString = Util_clientAddressToString(itr); + Log_info_client(itr, "New UDP connection from %s on port %d", clientAddressString, fromport); + free(clientAddressString); memcpy(&itr->remote_udp, &from, sizeof(struct sockaddr_storage)); break; } @@ -848,6 +855,9 @@ int Client_read_udp(int udpsock) itr->bUDP = true; len -= 4; /* Adjust for crypt header */ msgType = (UDPMessageType_t)((buffer[0] >> 5) & 0x7); + + char *clientAddressString = NULL; + switch (msgType) { case UDPVoiceSpeex: case UDPVoiceCELTAlpha: @@ -862,7 +872,9 @@ int Client_read_udp(int udpsock) Client_send_udp(itr, buffer, len); break; default: - Log_debug("Unknown UDP message type from %s port %d", Util_clientAddressToString(itr), fromport); + clientAddressString = Util_clientAddressToString(itr); + Log_debug("Unknown UDP message type from %s port %d", clientAddressString, fromport); + free(clientAddressString); break; } @@ -958,8 +970,10 @@ int Client_voiceMsg(client_t *client, uint8_t *data, int len) if (vt->channels[i].linked && !list_empty(&ch->channel_links)) { struct dlist *ch_itr; list_iterate(ch_itr, &ch->channel_links) { + channellist_t *chl; channel_t *ch_link; - ch_link = list_get_entry(ch_itr, channel_t, link_node); + chl = list_get_entry(ch_itr, channellist_t, node); + ch_link = chl->chan; list_iterate(itr, &ch_link->clients) { client_t *c; c = list_get_entry(itr, client_t, chan_node);