util  Diff

Differences From Artifact [e965fe4be4]:

To Artifact [de39328fae]:


323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
...
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
...
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
		case term_clear_line:   write(tty,"\r\x1b[2K",5); break;
		case term_clear_screen: write(tty,"\r\x1b[3J",5); break;
	}
}
void term_bell(int tty) {
	write(tty,"\a",1);
}
#include<stdio.h>
typedef char password[kpw_db_pw_max + 1];
bad pwread(bool obscure, char* dest, size_t* out_len, const char* prompt, const size_t plen) {
	if (isatty(0)) {
		int tty = 1;
		if (!isatty(tty)) tty = open("/dev/tty", O_WRONLY);
		if (tty == -1) return bad_insane;

................................................................................
		alert(a_debug, "attempting to decrypt private key");
		for (size_t i = 0; i < sz(key); ++i) {
			priv[i] = priv_enc[i] ^ key[i];
		}
		hexdump(priv, sz(key));
	} else {
		/* found a key in memory; loading it into *priv */
		alert(a_notice, "using saved key");
		key_priv* saved = shmat(shm, 0, 0);
		if (saved == (void*)-1)
			return bad_shm;
		hexdump((byte*)saved, sizeof(key_priv));
		memcpy(priv, saved, sizeof(key_priv));
		shmdt(saved);
	}
................................................................................
		}

		case chpw:
		case regen:
		case delpw:{ /* kpw -d <acct> */
			if (param == 0) return emit_usage
				  (op==delpw ? " -d <account>\n"          :
				   op==regen ? " -r[lmusp] <account> [<pw len>]" :
				/* op==chpw */ " -c <account> [<new pw>]");

			if (param < 1 || param > (op == delpw ? 1 : 2))
				return bad_syntax;
			const char* target = params[0];
			const char* delta;
			if (param == 2) delta=params[1];
				else delta=NULL;







|







 







|







 







|
|







323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
...
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
...
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
		case term_clear_line:   write(tty,"\r\x1b[2K",5); break;
		case term_clear_screen: write(tty,"\r\x1b[3J",5); break;
	}
}
void term_bell(int tty) {
	write(tty,"\a",1);
}

typedef char password[kpw_db_pw_max + 1];
bad pwread(bool obscure, char* dest, size_t* out_len, const char* prompt, const size_t plen) {
	if (isatty(0)) {
		int tty = 1;
		if (!isatty(tty)) tty = open("/dev/tty", O_WRONLY);
		if (tty == -1) return bad_insane;

................................................................................
		alert(a_debug, "attempting to decrypt private key");
		for (size_t i = 0; i < sz(key); ++i) {
			priv[i] = priv_enc[i] ^ key[i];
		}
		hexdump(priv, sz(key));
	} else {
		/* found a key in memory; loading it into *priv */
		alert(a_debug, "using saved key");
		key_priv* saved = shmat(shm, 0, 0);
		if (saved == (void*)-1)
			return bad_shm;
		hexdump((byte*)saved, sizeof(key_priv));
		memcpy(priv, saved, sizeof(key_priv));
		shmdt(saved);
	}
................................................................................
		}

		case chpw:
		case regen:
		case delpw:{ /* kpw -d <acct> */
			if (param == 0) return emit_usage
				  (op==delpw ? " -d <account>\n"          :
				   op==regen ? " -r[lmusp] <account> [<pw len>]\n" :
				/* op==chpw */ " -c <account> [<new pw>]\n");

			if (param < 1 || param > (op == delpw ? 1 : 2))
				return bad_syntax;
			const char* target = params[0];
			const char* delta;
			if (param == 2) delta=params[1];
				else delta=NULL;