]> mj.ucw.cz Git - subauth.git/blobdiff - client/subauth.c
It is now possible to change the comment of an existing token
[subauth.git] / client / subauth.c
index 44c9fefece6bc4956030d4e8b958321d2878d632..7b2d755cc3523ab5ebad81b4e36fe650a672f25c 100644 (file)
@@ -187,6 +187,19 @@ static void cmd_delete_token(void)
   op_run();
 }
 
+static void cmd_change_token(void)
+{
+  if (!arg_zone || !arg_ident)
+    opt_failure("--zone and --ident must be given");
+
+  op_new("change-token");
+  set_string(rq, "zone", arg_zone);
+  set_string(rq, "ident", arg_ident);
+  set_string(rq, "comment", arg_comment);
+
+  op_run();
+}
+
 static void cmd_create_acct(void)
 {
   if (!arg_zone || !arg_user)
@@ -371,6 +384,7 @@ enum command {
   CMD_DELETE_PASSWD,
   CMD_CREATE_TOKEN,
   CMD_DELETE_TOKEN,
+  CMD_CHANGE_TOKEN,
   CMD_CREATE_ACCT,
   CMD_DELETE_ACCT,
   CMD_DELETE_USER,
@@ -387,6 +401,7 @@ void (* const command_handlers[CMD_MAX])(void) = {
   [CMD_DELETE_PASSWD] = cmd_delete_passwd,
   [CMD_CREATE_TOKEN] = cmd_create_token,
   [CMD_DELETE_TOKEN] = cmd_delete_token,
+  [CMD_CHANGE_TOKEN] = cmd_change_token,
   [CMD_CREATE_ACCT] = cmd_create_acct,
   [CMD_DELETE_ACCT] = cmd_delete_acct,
   [CMD_DELETE_USER] = cmd_delete_user,
@@ -418,6 +433,7 @@ static const struct opt_section options = {
     OPT_SWITCH(0,   "delete-passwd",   command, CMD_DELETE_PASSWD,     OPT_SINGLE, "\tRemove password"),
     OPT_SWITCH(0,   "create-token",    command, CMD_CREATE_TOKEN,      OPT_SINGLE, "\tCreate a new token"),
     OPT_SWITCH(0,   "delete-token",    command, CMD_DELETE_TOKEN,      OPT_SINGLE, "\tRemove an existing token"),
+    OPT_SWITCH(0,   "change-token",    command, CMD_CHANGE_TOKEN,      OPT_SINGLE, "\tChange the comment of an existing token"),
     OPT_SWITCH(0,   "login",           command, CMD_LOGIN,             OPT_SINGLE, "\tTry to log in"),
     OPT_SWITCH(0,   "temp-token",      command, CMD_TEMP_TOKEN,        OPT_SINGLE, "\tCreate a temporary token"),
     OPT_HELP(""),