summaryrefslogtreecommitdiff
path: root/apps/plugins/otp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/otp.c')
-rw-r--r--apps/plugins/otp.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/plugins/otp.c b/apps/plugins/otp.c
index 6dece4ad38..2da1ef83f5 100644
--- a/apps/plugins/otp.c
+++ b/apps/plugins/otp.c
@@ -411,10 +411,11 @@ static void add_acct_manual(void)
411 memset(accounts + next_slot, 0, sizeof(struct account_t)); 411 memset(accounts + next_slot, 0, sizeof(struct account_t));
412 412
413 rb->splash(HZ * 1, "Enter account name."); 413 rb->splash(HZ * 1, "Enter account name.");
414 if(rb->kbd_input(accounts[next_slot].name, sizeof(accounts[next_slot].name)) < 0) 414 char* buf = accounts[next_slot].name;
415 if(rb->kbd_input(buf, sizeof(accounts[next_slot].name), NULL) < 0)
415 return; 416 return;
416 417
417 if(acct_exists(accounts[next_slot].name)) 418 if(acct_exists(buf))
418 { 419 {
419 rb->splash(HZ * 2, "Duplicate account name!"); 420 rb->splash(HZ * 2, "Duplicate account name!");
420 return; 421 return;
@@ -425,7 +426,7 @@ static void add_acct_manual(void)
425 char temp_buf[SECRET_MAX * 2]; 426 char temp_buf[SECRET_MAX * 2];
426 memset(temp_buf, 0, sizeof(temp_buf)); 427 memset(temp_buf, 0, sizeof(temp_buf));
427 428
428 if(rb->kbd_input(temp_buf, sizeof(temp_buf)) < 0) 429 if(rb->kbd_input(temp_buf, sizeof(temp_buf), NULL) < 0)
429 return; 430 return;
430 431
431 if((accounts[next_slot].sec_len = base32_decode(accounts[next_slot].secret, SECRET_MAX, temp_buf)) <= 0) 432 if((accounts[next_slot].sec_len = base32_decode(accounts[next_slot].secret, SECRET_MAX, temp_buf)) <= 0)
@@ -457,7 +458,7 @@ static void add_acct_manual(void)
457 temp_buf[1] = '0'; 458 temp_buf[1] = '0';
458 } 459 }
459 460
460 if(rb->kbd_input(temp_buf, sizeof(temp_buf)) < 0) 461 if(rb->kbd_input(temp_buf, sizeof(temp_buf), NULL) < 0)
461 return; 462 return;
462 463
463 if(!accounts[next_slot].is_totp) 464 if(!accounts[next_slot].is_totp)
@@ -470,7 +471,7 @@ static void add_acct_manual(void)
470 memset(temp_buf, 0, sizeof(temp_buf)); 471 memset(temp_buf, 0, sizeof(temp_buf));
471 temp_buf[0] = '6'; 472 temp_buf[0] = '6';
472 473
473 if(rb->kbd_input(temp_buf, sizeof(temp_buf)) < 0) 474 if(rb->kbd_input(temp_buf, sizeof(temp_buf), NULL) < 0)
474 return; 475 return;
475 476
476 accounts[next_slot].digits = rb->atoi(temp_buf); 477 accounts[next_slot].digits = rb->atoi(temp_buf);
@@ -667,7 +668,7 @@ static void edit_menu(int acct)
667 case 0: // rename 668 case 0: // rename
668 rb->splash(HZ, "Enter new name."); 669 rb->splash(HZ, "Enter new name.");
669 rb->strlcpy(data_buf, accounts[acct].name, sizeof(data_buf)); 670 rb->strlcpy(data_buf, accounts[acct].name, sizeof(data_buf));
670 if(rb->kbd_input(data_buf, sizeof(data_buf)) < 0) 671 if(rb->kbd_input(data_buf, sizeof(data_buf), NULL) < 0)
671 break; 672 break;
672 if(acct_exists(data_buf)) 673 if(acct_exists(data_buf))
673 { 674 {
@@ -695,7 +696,7 @@ static void edit_menu(int acct)
695 else 696 else
696 rb->snprintf(data_buf, sizeof(data_buf), "%d", accounts[acct].totp_period); 697 rb->snprintf(data_buf, sizeof(data_buf), "%d", accounts[acct].totp_period);
697 698
698 if(rb->kbd_input(data_buf, sizeof(data_buf)) < 0) 699 if(rb->kbd_input(data_buf, sizeof(data_buf), NULL) < 0)
699 break; 700 break;
700 701
701 if(accounts[acct].is_totp) 702 if(accounts[acct].is_totp)
@@ -709,7 +710,7 @@ static void edit_menu(int acct)
709 break; 710 break;
710 case 3: // digits 711 case 3: // digits
711 rb->snprintf(data_buf, sizeof(data_buf), "%d", accounts[acct].digits); 712 rb->snprintf(data_buf, sizeof(data_buf), "%d", accounts[acct].digits);
712 if(rb->kbd_input(data_buf, sizeof(data_buf)) < 0) 713 if(rb->kbd_input(data_buf, sizeof(data_buf), NULL) < 0)
713 break; 714 break;
714 715
715 accounts[acct].digits = rb->atoi(data_buf); 716 accounts[acct].digits = rb->atoi(data_buf);
@@ -722,7 +723,7 @@ static void edit_menu(int acct)
722 memcpy(temp_sec, accounts[acct].secret, accounts[acct].sec_len); 723 memcpy(temp_sec, accounts[acct].secret, accounts[acct].sec_len);
723 base32_encode(accounts[acct].secret, accounts[acct].sec_len, data_buf, sizeof(data_buf)); 724 base32_encode(accounts[acct].secret, accounts[acct].sec_len, data_buf, sizeof(data_buf));
724 725
725 if(rb->kbd_input(data_buf, sizeof(data_buf)) < 0) 726 if(rb->kbd_input(data_buf, sizeof(data_buf), NULL) < 0)
726 break; 727 break;
727 728
728 int ret = base32_decode(accounts[acct].secret, sizeof(accounts[acct].secret), data_buf); 729 int ret = base32_decode(accounts[acct].secret, sizeof(accounts[acct].secret), data_buf);