version 1.92, 2019/09/03 08:29:58 |
version 1.93, 2019/09/03 08:30:47 |
|
|
} |
} |
|
|
/* |
/* |
* Advanced *cpp past the end of key options, defined as the first unquoted |
|
* whitespace character. Returns 0 on success or -1 on failure (e.g. |
|
* unterminated quotes). |
|
*/ |
|
static int |
|
advance_past_options(char **cpp) |
|
{ |
|
char *cp = *cpp; |
|
int quoted = 0; |
|
|
|
for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { |
|
if (*cp == '\\' && cp[1] == '"') |
|
cp++; /* Skip both */ |
|
else if (*cp == '"') |
|
quoted = !quoted; |
|
} |
|
*cpp = cp; |
|
/* return failure for unterminated quotes */ |
|
return (*cp == '\0' && quoted) ? -1 : 0; |
|
} |
|
|
|
/* |
|
* Check a single line of an authorized_keys-format file. Returns 0 if key |
* Check a single line of an authorized_keys-format file. Returns 0 if key |
* matches, -1 otherwise. Will return key/cert options via *authoptsp |
* matches, -1 otherwise. Will return key/cert options via *authoptsp |
* on success. "loc" is used as file/line location in log messages. |
* on success. "loc" is used as file/line location in log messages. |
|
|
/* no key? check for options */ |
/* no key? check for options */ |
debug2("%s: check options: '%s'", loc, cp); |
debug2("%s: check options: '%s'", loc, cp); |
key_options = cp; |
key_options = cp; |
if (advance_past_options(&cp) != 0) { |
if (sshkey_advance_past_options(&cp) != 0) { |
reason = "invalid key option string"; |
reason = "invalid key option string"; |
goto fail_reason; |
goto fail_reason; |
} |
} |