be provided when joining to the channel.
c <cipher> Set/unset channel's cipher
h <hmac> Set/unset channel's hmac
- f Set/unset channel founder authentication.
+ f [<pubkeyfile> <privkeyfile> [<privkey passphrase>]]
+ Set/unset channel founder authentication.
Channel founder may set this mode so that
if the client leaves the channel it can
claim the founder rights when it returns
be permanent channel. You can claim the
founder rights using CUMODE or JOIN commands.
+ If the <pubkeyfile> and <privkeyfile> is
+ provided then the <pubkeyfile> will the used
+ as founder public key, and the private key
+ is used to compute a signature for the SILC
+ server. If these are omitted then the default
+ SILC keypair is used. Normally you do not need
+ to provide these arguments.
+
Multiple modes can be set/unset at once if the modes does not
require any arguments. If mode requires an argument then only
one mode can be set at once.
SilcClientEntry client_entry = NULL;
SilcChannelEntry channel;
SilcBuffer buffer, clidp, chidp, args = NULL;
+ SilcPublicKey pubkey = NULL;
char *nickname = NULL, *name;
char *invite = NULL;
unsigned char action[1];
goto out;
}
} else {
- invite = cmd->argv[2];
- invite++;
if (cmd->argv[2][0] == '+')
action[0] = 0x00;
else
action[0] = 0x01;
+
+ /* Check if it is public key file to be added to invite list */
+ if (!silc_pkcs_load_public_key(cmd->argv[2] + 1, &pubkey,
+ SILC_PKCS_FILE_PEM))
+ silc_pkcs_load_public_key(cmd->argv[2] + 1, &pubkey,
+ SILC_PKCS_FILE_BIN);
+ invite = cmd->argv[2];
+ if (!pubkey)
+ invite++;
}
}
silc_buffer_format(args,
SILC_STR_UI_SHORT(1),
SILC_STR_END);
- args = silc_argument_payload_encode_one(args, invite, strlen(invite), 1);
+ if (pubkey) {
+ chidp = silc_pkcs_public_key_payload_encode(pubkey);
+ args = silc_argument_payload_encode_one(args, chidp->data,
+ chidp->len, 2);
+ silc_buffer_free(chidp);
+ silc_pkcs_public_key_free(pubkey);
+ } else {
+ args = silc_argument_payload_encode_one(args, invite, strlen(invite), 1);
+ }
}
/* Send the command */
break;
case 'f':
if (add) {
+ SilcPublicKey pubkey = cmd->client->public_key;
+ SilcPrivateKey privkey = cmd->client->private_key;
+
mode |= SILC_CHANNEL_MODE_FOUNDER_AUTH;
type = 7;
- auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
- cmd->client->private_key,
+
+ if (cmd->argc >= 5) {
+ char *pass = "";
+ if (cmd->argc >= 6)
+ pass = cmd->argv[5];
+ if (!silc_load_key_pair(cmd->argv[3], cmd->argv[4], pass,
+ NULL, &pubkey, &privkey)) {
+ SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Could not load key pair, check your arguments");
+ COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
+ goto out;
+ }
+ }
+
+ auth = silc_auth_public_key_auth_generate(pubkey, privkey,
cmd->client->rng,
cmd->client->sha1hash,
conn->local_id,
break;
case 'f':
if (add) {
- auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
- cmd->client->private_key,
+ SilcPublicKey pubkey = cmd->client->public_key;
+ SilcPrivateKey privkey = cmd->client->private_key;
+
+ if (cmd->argc >= 6) {
+ char *pass = "";
+ if (cmd->argc >= 7)
+ pass = cmd->argv[6];
+ if (!silc_load_key_pair(cmd->argv[4], cmd->argv[5], pass,
+ NULL, &pubkey, &privkey)) {
+ SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Could not load key pair, check your arguments");
+ COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
+ goto out;
+ }
+ }
+
+ auth = silc_auth_public_key_auth_generate(pubkey, privkey,
cmd->client->rng,
cmd->client->sha1hash,
conn->local_id,
SilcBuffer buffer, chidp, args = NULL;
char *name, *ban = NULL;
unsigned char action[1];
-
+ SilcPublicKey pubkey = NULL;
+
if (!cmd->conn) {
SILC_NOT_CONNECTED(cmd->client, cmd->conn);
COMMAND_ERROR(SILC_STATUS_ERR_NOT_REGISTERED);
else
action[0] = 0x01;
+ /* Check if it is public key file to be added to invite list */
+ if (!silc_pkcs_load_public_key(cmd->argv[2] + 1, &pubkey,
+ SILC_PKCS_FILE_PEM))
+ silc_pkcs_load_public_key(cmd->argv[2] + 1, &pubkey,
+ SILC_PKCS_FILE_BIN);
ban = cmd->argv[2];
- ban++;
+ if (!pubkey)
+ ban++;
}
if (ban) {
silc_buffer_format(args,
SILC_STR_UI_SHORT(1),
SILC_STR_END);
- args = silc_argument_payload_encode_one(args, ban, strlen(ban), 1);
+ if (pubkey) {
+ chidp = silc_pkcs_public_key_payload_encode(pubkey);
+ args = silc_argument_payload_encode_one(args, chidp->data,
+ chidp->len, 2);
+ silc_buffer_free(chidp);
+ silc_pkcs_public_key_free(pubkey);
+ } else {
+ args = silc_argument_payload_encode_one(args, ban, strlen(ban), 1);
+ }
}
chidp = silc_id_payload_encode(channel->id, SILC_ID_CHANNEL);
SILC_CLIENT_CMD(join, JOIN, "JOIN", 9);
SILC_CLIENT_CMD(motd, MOTD, "MOTD", 2);
SILC_CLIENT_CMD(umode, UMODE, "UMODE", 2);
- SILC_CLIENT_CMD(cmode, CMODE, "CMODE", 4);
- SILC_CLIENT_CMD(cumode, CUMODE, "CUMODE", 5);
+ SILC_CLIENT_CMD(cmode, CMODE, "CMODE", 6);
+ SILC_CLIENT_CMD(cumode, CUMODE, "CUMODE", 9);
SILC_CLIENT_CMD(kick, KICK, "KICK", 4);
SILC_CLIENT_CMD(ban, BAN, "BAN", 3);
SILC_CLIENT_CMD(detach, DETACH, "DETACH", 0);