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);