version 1.194, 2011/09/23 07:45:05 |
version 1.195, 2013/02/17 23:16:57 |
|
|
options->tun_open = SSH_TUNMODE_NO; |
options->tun_open = SSH_TUNMODE_NO; |
} |
} |
|
|
|
void |
|
add_identity_file(Options *options, const char *dir, const char *filename, |
|
int userprovided) |
|
{ |
|
char *path; |
|
|
|
if (options->num_identity_files >= SSH_MAX_IDENTITY_FILES) |
|
fatal("Too many identity files specified (max %d)", |
|
SSH_MAX_IDENTITY_FILES); |
|
|
|
if (dir == NULL) /* no dir, filename is absolute */ |
|
path = xstrdup(filename); |
|
else |
|
(void)xasprintf(&path, "%.100s%.100s", dir, filename); |
|
|
|
options->identity_file_userprovided[options->num_identity_files] = |
|
userprovided; |
|
options->identity_files[options->num_identity_files++] = path; |
|
} |
|
|
/* |
/* |
* Returns the number of the token pointed to by cp or oBadOption. |
* Returns the number of the token pointed to by cp or oBadOption. |
*/ |
*/ |
|
|
if (*intptr >= SSH_MAX_IDENTITY_FILES) |
if (*intptr >= SSH_MAX_IDENTITY_FILES) |
fatal("%.200s line %d: Too many identity files specified (max %d).", |
fatal("%.200s line %d: Too many identity files specified (max %d).", |
filename, linenum, SSH_MAX_IDENTITY_FILES); |
filename, linenum, SSH_MAX_IDENTITY_FILES); |
charptr = &options->identity_files[*intptr]; |
add_identity_file(options, NULL, arg, 1); |
*charptr = xstrdup(arg); |
|
*intptr = *intptr + 1; |
|
} |
} |
break; |
break; |
|
|
|
|
options->protocol = SSH_PROTO_2; |
options->protocol = SSH_PROTO_2; |
if (options->num_identity_files == 0) { |
if (options->num_identity_files == 0) { |
if (options->protocol & SSH_PROTO_1) { |
if (options->protocol & SSH_PROTO_1) { |
len = 2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1; |
add_identity_file(options, "~/", |
options->identity_files[options->num_identity_files] = |
_PATH_SSH_CLIENT_IDENTITY, 0); |
xmalloc(len); |
|
snprintf(options->identity_files[options->num_identity_files++], |
|
len, "~/%.100s", _PATH_SSH_CLIENT_IDENTITY); |
|
} |
} |
if (options->protocol & SSH_PROTO_2) { |
if (options->protocol & SSH_PROTO_2) { |
len = 2 + strlen(_PATH_SSH_CLIENT_ID_RSA) + 1; |
add_identity_file(options, "~/", |
options->identity_files[options->num_identity_files] = |
_PATH_SSH_CLIENT_ID_RSA, 0); |
xmalloc(len); |
add_identity_file(options, "~/", |
snprintf(options->identity_files[options->num_identity_files++], |
_PATH_SSH_CLIENT_ID_DSA, 0); |
len, "~/%.100s", _PATH_SSH_CLIENT_ID_RSA); |
add_identity_file(options, "~/", |
|
_PATH_SSH_CLIENT_ID_ECDSA, 0); |
len = 2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1; |
|
options->identity_files[options->num_identity_files] = |
|
xmalloc(len); |
|
snprintf(options->identity_files[options->num_identity_files++], |
|
len, "~/%.100s", _PATH_SSH_CLIENT_ID_DSA); |
|
|
|
len = 2 + strlen(_PATH_SSH_CLIENT_ID_ECDSA) + 1; |
|
options->identity_files[options->num_identity_files] = |
|
xmalloc(len); |
|
snprintf(options->identity_files[options->num_identity_files++], |
|
len, "~/%.100s", _PATH_SSH_CLIENT_ID_ECDSA); |
|
} |
} |
} |
} |
if (options->escape_char == -1) |
if (options->escape_char == -1) |