silc_free(serv);
}
+/* Lists locally saved client and server public keys. */
+
+static void command_listkeys(const char *data, SILC_SERVER_REC *server,
+ WI_ITEM_REC *item)
+{
+
+}
+
void silc_channels_init(void)
{
signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
command_bind("notice", MODULE_NAME, (SIGNAL_FUNC) command_notice);
command_bind("away", MODULE_NAME, (SIGNAL_FUNC) command_away);
command_bind("key", MODULE_NAME, (SIGNAL_FUNC) command_key);
+ command_bind("listkeys", MODULE_NAME, (SIGNAL_FUNC) command_listkeys);
silc_nicklist_init();
}
command_unbind("notice", (SIGNAL_FUNC) command_notice);
command_unbind("away", (SIGNAL_FUNC) command_away);
command_unbind("key", (SIGNAL_FUNC) command_key);
+ command_unbind("listkeys", (SIGNAL_FUNC) command_listkeys);
silc_nicklist_deinit();
}
/* SYNTAX: KEY CHANNEL <channel> set|unset|list|agreement|negotiate [<arguments>] */
/* SYNTAX: KICK <channel> <nickname>[@<server>] [<comment>] */
/* SYNTAX: KILL <channel> <nickname>[@<server>] [<comment>] */
-/* SYNTAX: OPER <username> [<public key>] */
-/* SYNTAX: SILCOPER <username> [<public key>] */
-/* SYNTAX: TOPIC <channel> [<topic> */
+/* SYNTAX: OPER <username> [-pubkey] */
+/* SYNTAX: SILCOPER <username> [-pubkey] */
+/* SYNTAX: TOPIC <channel> [<topic>] */
/* SYNTAX: UMODE +|-<modes> */
/* SYNTAX: WHOIS <nickname>[@<server>] [<count>] */
/* SYNTAX: WHOWAS <nickname>[@<server>] [<count>] */
SilcClientConnection conn = cmd->conn;
SilcBuffer buffer, auth;
- if (cmd->argc == 3) {
- /* Pulic key auth XXX TODO */
- auth = NULL;
+ if (cmd->argc >= 3) {
+ /* Encode the public key authentication payload */
+ auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
+ cmd->client->private_key,
+ conn->hash,
+ conn->local_id,
+ SILC_ID_CLIENT);
} else {
- /* Encode the authentication payload */
+ /* Encode the password authentication payload */
auth = silc_auth_payload_encode(SILC_AUTH_PASSWORD, NULL, 0,
data, data_len);
}
{
SilcClientCommandContext cmd = (SilcClientCommandContext)context;
SilcClientConnection conn = cmd->conn;
- unsigned char *auth_data;
- uint32 auth_data_len = 0;
if (!cmd->conn) {
SILC_NOT_CONNECTED(cmd->client, cmd->conn);
if (cmd->argc < 2) {
cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
- "Usage: /OPER <username> [<public key>]");
+ "Usage: /OPER <username> [-pubkey]");
COMMAND_ERROR;
goto out;
}
- if (cmd->argc == 3) {
- /* XXX Get public key */
- auth_data = NULL;
- COMMAND_ERROR;
- goto out;
- } else {
+ if (cmd->argc < 3) {
/* Get passphrase */
cmd->client->ops->ask_passphrase(cmd->client, conn,
silc_client_command_oper_send,
return;
}
- silc_client_command_oper_send(auth_data, auth_data_len, context);
-
- memset(auth_data, 0, auth_data_len);
- silc_free(auth_data);
-
- /* Notify application */
- COMMAND;
+ silc_client_command_oper_send(NULL, 0, context);
out:
silc_client_command_free(cmd);
SilcClientConnection conn = cmd->conn;
SilcBuffer buffer, auth;
- if (cmd->argc == 3) {
- /* Pulic key auth XXX TODO */
- auth = NULL;
+ if (cmd->argc >= 3) {
+ /* Encode the public key authentication payload */
+ auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
+ cmd->client->private_key,
+ conn->hash,
+ conn->local_id,
+ SILC_ID_CLIENT);
} else {
- /* Encode the authentication payload */
+ /* Encode the password authentication payload */
auth = silc_auth_payload_encode(SILC_AUTH_PASSWORD, NULL, 0,
data, data_len);
}
{
SilcClientCommandContext cmd = (SilcClientCommandContext)context;
SilcClientConnection conn = cmd->conn;
- unsigned char *auth_data;
- uint32 auth_data_len = 0;
if (!cmd->conn) {
SILC_NOT_CONNECTED(cmd->client, cmd->conn);
if (cmd->argc < 2) {
cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
- "Usage: /SILCOPER <username> [<public key>]");
+ "Usage: /SILCOPER <username> [-pubkey]");
COMMAND_ERROR;
goto out;
}
- if (cmd->argc == 3) {
- /* XXX Get public key */
- auth_data = NULL;
- COMMAND_ERROR;
- goto out;
- } else {
+ if (cmd->argc < 3) {
/* Get passphrase */
cmd->client->ops->ask_passphrase(cmd->client, conn,
silc_client_command_silcoper_send,
return;
}
- silc_client_command_silcoper_send(auth_data, auth_data_len, context);
-
- memset(auth_data, 0, auth_data_len);
- silc_free(auth_data);
-
- /* Notify application */
- COMMAND;
+ silc_client_command_silcoper_send(NULL, 0, context);
out:
silc_client_command_free(cmd);