Overview
Comment: | fix addpw/genpw bugs |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
37cc6dd0341e77763f6eff2be104d834 |
User & Date: | lexi on 2019-08-16 02:00:36 |
Other Links: | manifest | tags |
Context
2019-08-16
| ||
02:03 | minor tweaks check-in: a2d840e698 user: lexi tags: trunk | |
02:00 | fix addpw/genpw bugs check-in: 37cc6dd034 user: lexi tags: trunk | |
01:56 | fix so it compiles in non-clipboard mode check-in: 6f480eda3f user: lexi tags: trunk | |
Changes
Modified kpw.d/kpw.c from [baa5c21b20] to [e965fe4be4].
690 690 e = pwread(true, pw_conf, NULL, _str("- confirm: ")); 691 691 if (e != ok) return e; 692 692 if (strcmp(pw,pw_conf) != 0) 693 693 return bad_pw_match; 694 694 } 695 695 acct_pw = pw; 696 696 } else acct_pw = prm, pwlen = strlen(prm); 697 - 698 697 } else if (op == genpw) { 699 698 unsigned long long len; 700 699 if (prm != NULL) { 701 700 alert(a_debug, "converting length parameter to integer"); 702 701 bad e = katoi(10, prm, &len); 703 702 if (e != ok) return bad_num; 704 703 } else alert(a_debug, "using default password length"), ................................................................................ 707 706 alert(a_debug, "generating new password"); 708 707 if (mkpw(mode, pw, len) == bad_entropy) return bad_entropy; 709 708 if (print || !tty_out) { 710 709 write(1, pw, len); 711 710 if(tty_out) write(1, "\n", 1); 712 711 } 713 712 pwlen = len; 713 + acct_pw = pw; 714 714 } 715 715 # ifdef _CLIPBOARD 716 716 if (copy_pw) copy(pw, pwlen); 717 717 # endif 718 718 alert(a_debug, "encoding database entry"); 719 719 db_sz acctlen = strlen(acct); 720 720 byte plaintext[1 + acctlen + 721 721 1 + pwlen]; 722 722 plaintext[0] = acctlen; 723 723 strncpy(plaintext + 1, acct, acctlen); 724 724 plaintext[1 + acctlen] = pwlen; 725 - strncpy(plaintext + acctlen + 2, pw, pwlen); 725 + strncpy(plaintext + acctlen + 2, acct_pw, pwlen); 726 726 hexdump(plaintext, sz(plaintext)); 727 727 728 728 alert(a_debug, "enciphering database entry"); 729 729 730 730 byte ciphertext[sz(plaintext) + crypto_box_SEALBYTES]; 731 731 crypto_box_seal(ciphertext, plaintext, sz(plaintext), key); 732 732 hexdump(ciphertext, sz(ciphertext));