util  Check-in [a49d93061d]

Overview
Comment:fix bug caused by unintuitive behavior of strncmp
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a49d93061d54212f2e4e3f1e9845e07f5b2810a6e61105cede8cde7cd7224f78
User & Date: lexi on 2019-09-06 01:02:13
Other Links: manifest | tags
Context
2019-10-17
20:03
reorganize dumbass directory structure check-in: c29fe4718a user: lexi tags: trunk
2019-09-06
01:02
fix bug caused by unintuitive behavior of strncmp check-in: a49d93061d user: lexi tags: trunk
2019-08-18
05:12
add ability to disable key-save mechanism check-in: eb56f79816 user: lexi tags: trunk
Changes

Modified kpw.d/kpw.c from [6b73e83d39] to [bd775cdba4].

     4      4    *  © AGPLv3
     5      5    *  $ cc -O4 kpw.c -okpw [-D_CLIPBOARD]
     6      6    *    - D_CLIPBOARD enables kpw to automatically
     7      7    *      copy passwords to the clipboard. it does
     8      8    *      this by attempting to execute a sequence
     9      9    *      of binaries, and then writing the password
    10     10    *      to STDIN of the binary that succeeds.
           11  + *    - D_SAVEKEY enables kpw to store the database
           12  + *      key in persistent memory between invocations,
           13  + *      leading to quicker decryption and access
           14  + *      times. only available on systems with SYSV
           15  + *      shared memory.
    11     16    *  ? generates passwords
    12     17    *  → kpw is unlikely to be portable to non-POSIX
    13     18    *    systems, but should run fine on Linux as well
    14     19    *    as BSDs with getrandom() support.
    15     20    *  → kpw has the following dependencies:
    16     21    *    - libsodium
    17     22    *  ! for getrandom() to work with the version of
................................................................................
   807    812   				     ptbuf [ptlen];
   808    813   				struct dbrecord rec;
   809    814   
   810    815   				bad d;
   811    816   				if((d = dbnext(db, &rec, ctlen,
   812    817   					pub, priv, ctbuf, ptbuf)) != ok) return d;
   813    818   
   814         -				if(strncmp(target, rec.acct.ptr, rec.acct.len) == 0) {
          819  +				if(strlen(target) == rec.acct.len && strncmp(target, rec.acct.ptr, rec.acct.len) == 0) {
   815    820   					/* found a matching record; determine
   816    821   					 * what to do to the fucker */
   817    822   					alert(a_debug, "found target record");
   818    823   					found = true;
   819    824   					if (op == delpw) continue;
   820    825   
   821    826   					password pwbuf;

Modified makerules from [053afc7a8f] to [a224223f8c].

    17     17   post = $(if $(debug),, && strip $@)
    18     18   cc-post = $(post)
    19     19   sc-post = $(post)
    20     20   mc-post = $(post)
    21     21   
    22     22   os = $(shell uname -o)
    23     23   
    24         -ifeq ($(os),Android)
    25         -    l-shmem = -landroid-shmem
    26         -endif
    27         -
    28     24   %: %.c
    29     25   	$(cc) $< -o$@ $(cc-post)
    30     26   
    31     27   %: %.ml
    32     28   	$(mc) $< -o $@ $(mc-post)
    33     29   
    34     30   %: %.scm