X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcd%2Fpacket_receive.c;h=0956be2dad1444fa88339f903582ffdc6e3bf2ee;hb=8a5f64b6ead2707ba7f623e4e8c6f6a58f4d712f;hp=2f3aa2f7206a5153be05e38422658f1fcd04fba5;hpb=17a0e947020c434ff674c43a7073c983dd4b984c;p=silc.git diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 2f3aa2f7..0956be2d 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -2502,7 +2502,7 @@ void silc_server_connection_auth_request(SilcServer server, SilcServerConfigSectionClient *client = NULL; uint16 conn_type; int ret, port; - SilcAuthMethod auth_meth; + SilcAuthMethod auth_meth = SILC_AUTH_NONE; SILC_LOG_DEBUG(("Start")); @@ -2523,20 +2523,21 @@ void silc_server_connection_auth_request(SilcServer server, /* 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(server->config, - sock->ip, - port); + client = silc_server_config_find_client(server, sock->ip, port); if (!client) - client = silc_server_config_find_client(server->config, - sock->hostname, - port); - if (client) - auth_meth = client->auth_meth; - + client = silc_server_config_find_client(server, sock->hostname, port); + if (client) { + if (client->passphrase) { + if (client->publickey && !server->config->prefer_passphrase_auth) + auth_meth = SILC_AUTH_PUBLIC_KEY; + else + auth_meth = SILC_AUTH_PASSWORD; + } else if (client->publickey) + 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