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

Collapse All | Expand All

(-)ssh/ssh-keygen/Makefile (-1 / +1 lines)
Lines 10-16 Link Here
10
BINDIR=	/usr/bin
10
BINDIR=	/usr/bin
11
MAN=	ssh-keygen.1
11
MAN=	ssh-keygen.1
12
12
13
SRCS=	ssh-keygen.c moduli.c
13
SRCS=	ssh-keygen.c readconf.c moduli.c
14
14
15
.include <bsd.prog.mk>
15
.include <bsd.prog.mk>
16
16
(-)ssh/ssh-keygen.c (-1 / +40 lines)
Lines 26-31 Link Here
26
#include "bufaux.h"
26
#include "bufaux.h"
27
#include "pathnames.h"
27
#include "pathnames.h"
28
#include "log.h"
28
#include "log.h"
29
#include "ssh.h"
30
#include "readconf.h"
29
#include "misc.h"
31
#include "misc.h"
30
#include "match.h"
32
#include "match.h"
31
#include "hostfile.h"
33
#include "hostfile.h"
Lines 95-100 Link Here
95
int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *);
97
int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *);
96
int prime_test(FILE *, FILE *, u_int32_t, u_int32_t);
98
int prime_test(FILE *, FILE *, u_int32_t, u_int32_t);
97
99
100
/*
101
 * General data structure for command line options and options configurable
102
 * in configuration files.  See readconf.h.
103
 */
104
Options options;
105
uid_t original_real_uid;
106
98
static void
107
static void
99
ask_filename(struct passwd *pw, const char *prompt)
108
ask_filename(struct passwd *pw, const char *prompt)
100
{
109
{
Lines 120-126 Link Here
120
			break;
129
			break;
121
		}
130
		}
122
131
123
	snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, name);
132
	
133
	if(options.num_identity_files > 0) {
134
	  char *file=NULL;
135
	  char *p=strrchr(name,'/');
136
	  if(p) file = p+1;
137
138
	  name = tilde_expand_filename(options.identity_files[0],
139
				       original_real_uid);
140
	  name = percent_expand(name, "h", pw->pw_dir,	
141
				      "u", pw->pw_name, (char *)NULL);
142
	  p=strrchr(name,'/');
143
	  if(p) *p=0;
144
	    
145
	  if(file && *file) {
146
	    snprintf(identity_file, sizeof(identity_file), "%s/%s", name,file);
147
	  }
148
	  else {
149
	    snprintf(identity_file, sizeof(identity_file), "%s", name);
150
	  }
151
	} else {
152
	  snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir,
153
		   name);
154
	}
124
	fprintf(stderr, "%s (%s): ", prompt, identity_file);
155
	fprintf(stderr, "%s (%s): ", prompt, identity_file);
125
	if (fgets(buf, sizeof(buf), stdin) == NULL)
156
	if (fgets(buf, sizeof(buf), stdin) == NULL)
126
		exit(1);
157
		exit(1);
Lines 1015-1020 Link Here
1015
	int log_level = SYSLOG_LEVEL_INFO;
1046
	int log_level = SYSLOG_LEVEL_INFO;
1016
	BIGNUM *start = NULL;
1047
	BIGNUM *start = NULL;
1017
	FILE *f;
1048
	FILE *f;
1049
 	char buf[256];
1018
	const char *errstr;
1050
	const char *errstr;
1019
1051
1020
	extern int optind;
1052
	extern int optind;
Lines 1037-1042 Link Here
1037
		exit(1);
1069
		exit(1);
1038
	}
1070
	}
1039
1071
1072
 	snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir,
1073
 		 _PATH_SSH_USER_CONFFILE);
1074
 	(void)read_config_file(buf, hostname, &options, 1);
1075
 
1076
 	/* Read systemwide configuration file after user config. */
1077
 	(void)read_config_file(_PATH_HOST_CONFIG_FILE, hostname, &options, 0);
1078
 		
1040
	while ((opt = getopt(ac, av,
1079
	while ((opt = getopt(ac, av,
1041
	    "degiqpclBHvxXyF:b:f:t:U:D:P:N:C:r:g:R:T:G:M:S:a:W:")) != -1) {
1080
	    "degiqpclBHvxXyF:b:f:t:U:D:P:N:C:r:g:R:T:G:M:S:a:W:")) != -1) {
1042
		switch (opt) {
1081
		switch (opt) {
(-)ssh/ssh.c (+5 lines)
Lines 1185-1193 Link Here
1185
		xfree(keys);
1185
		xfree(keys);
1186
	}
1186
	}
1187
#endif /* SMARTCARD */
1187
#endif /* SMARTCARD */
1188
	struct passwd *pw;
1189
	pw=getpwuid(original_real_uid);
1190
	if (!pw) fatal("Unknown user id: %d", original_real_uid);
1188
	for (; i < options.num_identity_files; i++) {
1191
	for (; i < options.num_identity_files; i++) {
1189
		filename = tilde_expand_filename(options.identity_files[i],
1192
		filename = tilde_expand_filename(options.identity_files[i],
1190
		    original_real_uid);
1193
		    original_real_uid);
1194
		filename = percent_expand(filename, "h", pw->pw_dir,	
1195
					  "u", pw->pw_name, (char *)NULL);
1191
		public = key_load_public(filename, NULL);
1196
		public = key_load_public(filename, NULL);
1192
		debug("identity file %s type %d", filename,
1197
		debug("identity file %s type %d", filename,
1193
		    public ? public->type : -1);
1198
		    public ? public->type : -1);

Return to bug 1159