View | Details | Raw Unified | Return to bug 2081 | Differences between
and this patch

Collapse All | Expand All

(-)auth2-pubkey.c (-2 / +39 lines)
Line 512 Link Here
512
	char *username, errmsg[512];
512
	long len;
513
--
513
	char *username, *keytext, errmsg[512];
Line 570 Link Here
571
572
		keytext = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
573
		if (setenv(SSH_KEY_FINGERPRINT_ENV_NAME, keytext, 1) == -1) {
574
			error("%s: setenv: %s", __func__, strerror(errno));
575
			_exit(1);
576
		}
577
578
		if ((f = tmpfile()) == NULL) {
579
			error("%s: tmpfile: %s", __func__, strerror(errno));
580
			_exit(1);
581
		}
582
		if (!key_write(key, f)) {
583
			error("%s: key_write: %s", __func__, strerror(errno));
584
			_exit(1);
585
		}
586
		if ((len = ftell(f)) == -1) {
587
			error("%s: ftell: %s", __func__, strerror(errno));
588
			_exit(1);
589
		}
590
		if ((keytext = xmalloc(len + 1)) == NULL) {
591
			error("%s: xmalloc: %s", __func__, strerror(errno));
592
			_exit(1);
593
		}
594
		if ((fseek(f, 0, SEEK_SET)) != 0) {
595
			error("%s: fseek: %s", __func__, strerror(errno));
596
			_exit(1);
597
		}
598
		if (fread(keytext, 1, len, f) != len) {
599
			error("%s: fread: %s", __func__, strerror(errno));
600
			_exit(1);
601
		}
602
		keytext[len] = '\0';
603
		fclose(f);
604
		if (setenv(SSH_KEY_ENV_NAME, keytext, 1) == -1) {
605
			error("%s: setenv: %s", __func__, strerror(errno));
606
			_exit(1);
607
		}
(-)ssh.h (+12 lines)
Line 100 Link Here
100
101
/*
102
 * Name of the environment variable containing the incoming key passed
103
 * to AuthorizedKeysCommand.
104
 */
105
#define SSH_KEY_ENV_NAME "SSH_KEY"
106
107
/*
108
 * Name of the environment variable containing the incoming key fingerprint
109
 * passed to AuthorizedKeysCommand.
110
 */
111
#define SSH_KEY_FINGERPRINT_ENV_NAME "SSH_KEY_FINGERPRINT"
(-)sshd_config.5 (+5 lines)
Line 206 Link Here
206
The key being used for authentication (the key's type and the key text itself,
207
separated by a space) will be available in the
208
.Ev SSH_KEY
209
environment variable, and the fingerprint of the key will be available in the
210
.Ev SSH_KEY_FINGERPRINT environment variable.

Return to bug 2081