|
Lines 244-249
default_client_percent_expand(const char
Link Here
|
| 244 |
} |
244 |
} |
| 245 |
|
245 |
|
| 246 |
/* |
246 |
/* |
|
|
247 |
* Expand percent then environment variables, percent first as they're less |
| 248 |
* likely to influence environment expansion. |
| 249 |
*/ |
| 250 |
static char * |
| 251 |
default_client_percent_dollar_expand(const char *str, const char *homedir, |
| 252 |
const char *remhost, const char *remuser, const char *locuser) |
| 253 |
{ |
| 254 |
char *str1, *str2; |
| 255 |
|
| 256 |
str1 = default_client_percent_expand(str, homedir, remhost, remuser, |
| 257 |
locuser); |
| 258 |
if ((str2 = dollar_env_expand(str1)) == NULL) |
| 259 |
fatal("invalid environment variable expansion"); |
| 260 |
free(str1); |
| 261 |
return(str2); |
| 262 |
} |
| 263 |
|
| 264 |
/* |
| 247 |
* Attempt to resolve a host name / port to a set of addresses and |
265 |
* Attempt to resolve a host name / port to a set of addresses and |
| 248 |
* optionally return any CNAMEs encountered along the way. |
266 |
* optionally return any CNAMEs encountered along the way. |
| 249 |
* Returns NULL on failure. |
267 |
* Returns NULL on failure. |
|
Lines 1357-1370
main(int ac, char **av)
Link Here
|
| 1357 |
if (options.control_path != NULL) { |
1375 |
if (options.control_path != NULL) { |
| 1358 |
cp = tilde_expand_filename(options.control_path, getuid()); |
1376 |
cp = tilde_expand_filename(options.control_path, getuid()); |
| 1359 |
free(options.control_path); |
1377 |
free(options.control_path); |
| 1360 |
options.control_path = default_client_percent_expand(cp, |
1378 |
options.control_path = default_client_percent_dollar_expand(cp, |
| 1361 |
pw->pw_dir, host, options.user, pw->pw_name); |
1379 |
pw->pw_dir, host, options.user, pw->pw_name); |
| 1362 |
free(cp); |
1380 |
free(cp); |
| 1363 |
} |
1381 |
} |
| 1364 |
|
1382 |
|
| 1365 |
if (options.identity_agent != NULL) { |
1383 |
if (options.identity_agent != NULL) { |
| 1366 |
p = tilde_expand_filename(options.identity_agent, getuid()); |
1384 |
p = tilde_expand_filename(options.identity_agent, getuid()); |
| 1367 |
cp = default_client_percent_expand(p, |
1385 |
cp = default_client_percent_dollar_expand(p, |
| 1368 |
pw->pw_dir, host, options.user, pw->pw_name); |
1386 |
pw->pw_dir, host, options.user, pw->pw_name); |
| 1369 |
free(p); |
1387 |
free(p); |
| 1370 |
free(options.identity_agent); |
1388 |
free(options.identity_agent); |
|
Lines 1374-1380
main(int ac, char **av)
Link Here
|
| 1374 |
if (options.forward_agent_sock_path != NULL) { |
1392 |
if (options.forward_agent_sock_path != NULL) { |
| 1375 |
p = tilde_expand_filename(options.forward_agent_sock_path, |
1393 |
p = tilde_expand_filename(options.forward_agent_sock_path, |
| 1376 |
getuid()); |
1394 |
getuid()); |
| 1377 |
cp = default_client_percent_expand(p, |
1395 |
cp = default_client_percent_dollar_expand(p, |
| 1378 |
pw->pw_dir, host, options.user, pw->pw_name); |
1396 |
pw->pw_dir, host, options.user, pw->pw_name); |
| 1379 |
free(p); |
1397 |
free(p); |
| 1380 |
free(options.forward_agent_sock_path); |
1398 |
free(options.forward_agent_sock_path); |
|
Lines 1546-1552
main(int ac, char **av)
Link Here
|
| 1546 |
unsetenv(SSH_AUTHSOCKET_ENV_NAME); |
1564 |
unsetenv(SSH_AUTHSOCKET_ENV_NAME); |
| 1547 |
} else { |
1565 |
} else { |
| 1548 |
cp = options.identity_agent; |
1566 |
cp = options.identity_agent; |
| 1549 |
if (cp[0] == '$') { |
1567 |
/* legacy (limited) format */ |
|
|
1568 |
if (cp[0] == '$' && cp[1] != '{') { |
| 1550 |
if (!valid_env_name(cp + 1)) { |
1569 |
if (!valid_env_name(cp + 1)) { |
| 1551 |
fatal("Invalid IdentityAgent " |
1570 |
fatal("Invalid IdentityAgent " |
| 1552 |
"environment variable name %s", cp); |
1571 |
"environment variable name %s", cp); |
|
Lines 2174-2180
load_public_identity_files(struct passwd
Link Here
|
| 2174 |
continue; |
2193 |
continue; |
| 2175 |
} |
2194 |
} |
| 2176 |
cp = tilde_expand_filename(options.identity_files[i], getuid()); |
2195 |
cp = tilde_expand_filename(options.identity_files[i], getuid()); |
| 2177 |
filename = default_client_percent_expand(cp, |
2196 |
filename = default_client_percent_dollar_expand(cp, |
| 2178 |
pw->pw_dir, host, options.user, pw->pw_name); |
2197 |
pw->pw_dir, host, options.user, pw->pw_name); |
| 2179 |
free(cp); |
2198 |
free(cp); |
| 2180 |
check_load(sshkey_load_public(filename, &public, NULL), |
2199 |
check_load(sshkey_load_public(filename, &public, NULL), |
|
Lines 2224-2230
load_public_identity_files(struct passwd
Link Here
|
| 2224 |
for (i = 0; i < options.num_certificate_files; i++) { |
2243 |
for (i = 0; i < options.num_certificate_files; i++) { |
| 2225 |
cp = tilde_expand_filename(options.certificate_files[i], |
2244 |
cp = tilde_expand_filename(options.certificate_files[i], |
| 2226 |
getuid()); |
2245 |
getuid()); |
| 2227 |
filename = default_client_percent_expand(cp, |
2246 |
filename = default_client_percent_dollar_expand(cp, |
| 2228 |
pw->pw_dir, host, options.user, pw->pw_name); |
2247 |
pw->pw_dir, host, options.user, pw->pw_name); |
| 2229 |
free(cp); |
2248 |
free(cp); |
| 2230 |
|
2249 |
|