version 1.10, 2015/01/12 20:13:27 |
version 1.11, 2015/01/13 07:39:19 |
|
|
#include "digest.h" |
#include "digest.h" |
#define SSHKEY_INTERNAL |
#define SSHKEY_INTERNAL |
#include "sshkey.h" |
#include "sshkey.h" |
|
#include "match.h" |
|
|
/* openssh private key file format */ |
/* openssh private key file format */ |
#define MARK_BEGIN "-----BEGIN OPENSSH PRIVATE KEY-----\n" |
#define MARK_BEGIN "-----BEGIN OPENSSH PRIVATE KEY-----\n" |
|
|
} |
} |
|
|
int |
int |
sshkey_names_valid2(const char *names) |
sshkey_names_valid2(const char *names, int allow_wildcard) |
{ |
{ |
char *s, *cp, *p; |
char *s, *cp, *p; |
|
const struct keytype *kt; |
|
int type; |
|
|
if (names == NULL || strcmp(names, "") == 0) |
if (names == NULL || strcmp(names, "") == 0) |
return 0; |
return 0; |
|
|
return 0; |
return 0; |
for ((p = strsep(&cp, ",")); p && *p != '\0'; |
for ((p = strsep(&cp, ",")); p && *p != '\0'; |
(p = strsep(&cp, ","))) { |
(p = strsep(&cp, ","))) { |
switch (sshkey_type_from_name(p)) { |
type = sshkey_type_from_name(p); |
case KEY_RSA1: |
if (type == KEY_RSA1) { |
case KEY_UNSPEC: |
free(s); |
|
return 0; |
|
} |
|
if (type == KEY_UNSPEC) { |
|
if (allow_wildcard) { |
|
/* |
|
* Try matching key types against the string. |
|
* If any has a positive or negative match then |
|
* the component is accepted. |
|
*/ |
|
for (kt = keytypes; kt->type != -1; kt++) { |
|
if (kt->type == KEY_RSA1) |
|
continue; |
|
if (match_pattern_list(kt->name, |
|
p, strlen(p), 0) != 0) |
|
break; |
|
} |
|
if (kt->type != -1) |
|
continue; |
|
} |
free(s); |
free(s); |
return 0; |
return 0; |
} |
} |