SilcChannelClientEntry chl;
SilcIDCacheEntry cache;
SilcHashTableList htl;
- uint32 mode;
+ SilcUInt32 mode;
unsigned char *tmp;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
bool local;
SILC_LOG_DEBUG(("Start"));
silc_hash_table_add(channel->user_list, client, chl);
silc_hash_table_add(client->channels, channel, chl);
silc_free(client_id);
+ channel->user_count++;
break;
* Distribute the notify to local clients on channels
*/
unsigned char *id;
- uint32 id_len;
+ SilcUInt32 id_len;
SILC_LOG_DEBUG(("KILLED notify"));
{
SilcPacketContext *new;
SilcBuffer buffer;
- uint16 len;
+ SilcUInt16 len;
SILC_LOG_DEBUG(("Processing Notify List"));
SilcBuffer reply;
SilcIDListData idata;
char *username = NULL, *realname = NULL, *id_string;
- uint16 username_len;
- uint32 id_len;
+ SilcUInt16 username_len;
+ SilcUInt32 id_len;
int ret;
char *hostname, *nickname;
int nickfail = 0;
/* Remove the old cache entry. */
if (!silc_idcache_del_by_context(server->local_list->clients, client)) {
- SILC_LOG_ERROR(("Lost client's cache entry - bad thing"));
+ SILC_LOG_ERROR(("Lost client's cache entry - report a bug"));
silc_server_disconnect_remote(server, sock, "Server closed connection: "
"Unknown client");
return NULL;
if (ret == -1) {
silc_free(username);
silc_free(realname);
+ SILC_LOG_ERROR(("Client %s (%s) sent incomplete information, closing "
+ "connection", sock->hostname, sock->ip));
silc_server_disconnect_remote(server, sock, "Server closed connection: "
"Incomplete client information");
return NULL;
if (!username) {
silc_free(username);
silc_free(realname);
+ SILC_LOG_ERROR(("Client %s (%s) did not send its username, closing "
+ "connection", sock->hostname, sock->ip));
silc_server_disconnect_remote(server, sock, "Server closed connection: "
"Incomplete client information");
return NULL;
int tlen = strcspn(username, "@");
char *phostname = NULL;
- hostname = silc_calloc((strlen(username) - tlen) + 1, sizeof(char));
- memcpy(hostname, username + tlen + 1, strlen(username) - tlen - 1);
+ hostname = silc_memdup(username + tlen + 1, strlen(username) - tlen - 1);
if (strcmp(sock->hostname, sock->ip) &&
strcmp(sock->hostname, hostname)) {
silc_free(username);
silc_free(hostname);
silc_free(realname);
+ SILC_LOG_ERROR(("Client %s (%s) sent incomplete information, closing "
+ "connection", sock->hostname, sock->ip));
silc_server_disconnect_remote(server, sock,
"Server closed connection: "
"Incomplete client information");
silc_free(hostname);
silc_free(phostname);
silc_free(realname);
+ SILC_LOG_ERROR(("Client %s (%s) sent incomplete information, closing "
+ "connection", sock->hostname, sock->ip));
silc_server_disconnect_remote(server, sock,
"Server closed connection: "
"Incomplete client information");
SilcServerID *server_id;
SilcIDListData idata;
unsigned char *server_name, *id_string;
- uint16 id_len, name_len;
+ SilcUInt16 id_len, name_len;
int ret;
bool local = TRUE;
{
SilcPacketContext *new_id;
SilcBuffer idp;
- uint16 id_len;
+ SilcUInt16 id_len;
SILC_LOG_DEBUG(("Processing New ID List"));
SilcChannelPayload payload;
SilcChannelID *channel_id;
char *channel_name;
- uint32 name_len;
+ SilcUInt32 name_len;
unsigned char *id;
- uint32 id_len;
- uint32 mode;
+ SilcUInt32 id_len;
+ SilcUInt32 mode;
SilcServerEntry server_entry;
SilcChannelEntry channel;
{
SilcPacketContext *new;
SilcBuffer buffer;
- uint16 len1, len2;
+ SilcUInt16 len1, len2;
SILC_LOG_DEBUG(("Processing New Channel List"));
SilcSocketConnection sock,
SilcPacketContext *packet)
{
- SilcServerConfigSectionClientConnection *client = NULL;
- uint16 conn_type;
- int ret, port;
- SilcAuthMethod auth_meth;
+ SilcServerConfigClient *client = NULL;
+ SilcUInt16 conn_type;
+ int ret;
+ SilcAuthMethod auth_meth = SILC_AUTH_NONE;
SILC_LOG_DEBUG(("Start"));
/* Get the authentication method for the client */
auth_meth = SILC_AUTH_NONE;
- port = server->sockets[server->sock]->port; /* Listenning port */
- client = silc_server_config_find_client_conn(server->config,
- sock->ip,
- port);
+ client = silc_server_config_find_client(server, sock->ip);
if (!client)
- client = silc_server_config_find_client_conn(server->config,
- sock->hostname,
- port);
- if (client)
- auth_meth = client->auth_meth;
-
+ client = silc_server_config_find_client(server, sock->hostname);
+ if (client) {
+ if (client->passphrase) {
+ if (client->publickeys && !server->config->prefer_passphrase_auth)
+ auth_meth = SILC_AUTH_PUBLIC_KEY;
+ else
+ auth_meth = SILC_AUTH_PASSWORD;
+ } else if (client->publickeys)
+ auth_meth = SILC_AUTH_PUBLIC_KEY;
+ }
+
/* Send it back to the client */
- silc_server_send_connection_auth_request(server, sock,
- conn_type,
- auth_meth);
+ silc_server_send_connection_auth_request(server, sock, conn_type, auth_meth);
}
/* Received REKEY packet. The sender of the packet wants to regenerate