diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2012-12-19 15:14:10 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2012-12-19 15:14:10 +0000 |
commit | 70cd3c6b959b1cd116cb0f6e90e3c00b252e198a (patch) | |
tree | 14441cb17b14121ae8b53325f33338f8ffade504 /apps | |
parent | db05bc512de86182888b0b2ad94556cf6c21f839 (diff) |
Integrate host, email and IP address checks into X509_verify.
Add new verify options to set checks.
(backport from HEAD)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/apps.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/apps.c b/apps/apps.c index fea5b25c1c..24a493e0eb 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -2262,6 +2262,8 @@ int args_verify(char ***pargs, int *pargc, char **oldargs = *pargs; char *arg = **pargs, *argn = (*pargs)[1]; time_t at_time = 0; + const unsigned char *hostname = NULL, *email = NULL; + char *ipasc = NULL; if (!strcmp(arg, "-policy")) { if (!argn) @@ -2335,6 +2337,27 @@ int args_verify(char ***pargs, int *pargc, } (*pargs)++; } + else if (strcmp(arg,"-verify_hostname") == 0) + { + if (!argn) + *badarg = 1; + hostname = (unsigned char *)argn; + (*pargs)++; + } + else if (strcmp(arg,"-verify_email") == 0) + { + if (!argn) + *badarg = 1; + email = (unsigned char *)argn; + (*pargs)++; + } + else if (strcmp(arg,"-verify_ip") == 0) + { + if (!argn) + *badarg = 1; + ipasc = argn; + (*pargs)++; + } else if (!strcmp(arg, "-ignore_critical")) flags |= X509_V_FLAG_IGNORE_CRITICAL; else if (!strcmp(arg, "-issuer_checks")) @@ -2396,6 +2419,15 @@ int args_verify(char ***pargs, int *pargc, if (at_time) X509_VERIFY_PARAM_set_time(*pm, at_time); + if (hostname && !X509_VERIFY_PARAM_set1_host(*pm, hostname, 0)) + *badarg = 1; + + if (email && !X509_VERIFY_PARAM_set1_email(*pm, email, 0)) + *badarg = 1; + + if (ipasc && !X509_VERIFY_PARAM_set1_ip_asc(*pm, ipasc)) + *badarg = 1; + end: (*pargs)++; |