projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Display brief help if no options for list.
[openssl.git]
/
apps
/
apps.c
diff --git
a/apps/apps.c
b/apps/apps.c
index d4af862a18580ea0cac9a173da91684ae2c11963..39ca963b5f09c4c34d80df651da102dd1f37a00f 100644
(file)
--- a/
apps/apps.c
+++ b/
apps/apps.c
@@
-227,11
+227,17
@@
int app_init(long mesgwin)
}
#endif
}
#endif
-int ctx_set_verify_locations(SSL_CTX *ctx,
- const char *CA
file, const char *
CApath)
+int ctx_set_verify_locations(SSL_CTX *ctx,
const char *CAfile,
+ const char *CA
path, int noCAfile, int no
CApath)
{
{
- if (CAfile == NULL && CApath == NULL)
- return SSL_CTX_set_default_verify_paths(ctx);
+ if (CAfile == NULL && CApath == NULL) {
+ if (!noCAfile && SSL_CTX_set_default_verify_file(ctx) <= 0)
+ return 0;
+ if (!noCApath && SSL_CTX_set_default_verify_dir(ctx) <= 0)
+ return 0;
+
+ return 1;
+ }
return SSL_CTX_load_verify_locations(ctx, CAfile, CApath);
}
return SSL_CTX_load_verify_locations(ctx, CAfile, CApath);
}
@@
-1074,7
+1080,11
@@
int set_name_ex(unsigned long *flags, const char *arg)
{"ca_default", XN_FLAG_MULTILINE, 0xffffffffL},
{NULL, 0, 0}
};
{"ca_default", XN_FLAG_MULTILINE, 0xffffffffL},
{NULL, 0, 0}
};
- return set_multi_opts(flags, arg, ex_tbl);
+ if (set_multi_opts(flags, arg, ex_tbl) == 0)
+ return 0;
+ if ((*flags & XN_FLAG_SEP_MASK) == 0)
+ *flags |= XN_FLAG_SEP_CPLUS_SPC;
+ return 1;
}
int set_ext_copy(int *copy_type, const char *arg)
}
int set_ext_copy(int *copy_type, const char *arg)
@@
-1240,34
+1250,39
@@
void print_array(BIO *out, const char* title, int len, const unsigned char* d)
BIO_printf(out, "\n};\n");
}
BIO_printf(out, "\n};\n");
}
-X509_STORE *setup_verify(char *CAfile, char *CApath)
+X509_STORE *setup_verify(char *CAfile, char *CApath
, int noCAfile, int noCApath
)
{
X509_STORE *store = X509_STORE_new();
X509_LOOKUP *lookup;
if (!store)
goto end;
{
X509_STORE *store = X509_STORE_new();
X509_LOOKUP *lookup;
if (!store)
goto end;
- lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
- if (lookup == NULL)
- goto end;
- if (CAfile) {
- if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM)) {
- BIO_printf(bio_err, "Error loading file %s\n", CAfile);
+
+ if(CAfile != NULL || !noCAfile) {
+ lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
+ if (lookup == NULL)
goto end;
goto end;
- }
- } else
- X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT);
+ if (CAfile) {
+ if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM)) {
+ BIO_printf(bio_err, "Error loading file %s\n", CAfile);
+ goto end;
+ }
+ } else
+ X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT);
+ }
- lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
- if (lookup == NULL)
- goto end;
- if (CApath) {
- if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM)) {
- BIO_printf(bio_err, "Error loading directory %s\n", CApath);
+ if(CApath != NULL || !noCApath) {
+ lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
+ if (lookup == NULL)
goto end;
goto end;
- }
- } else
- X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
+ if (CApath) {
+ if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM)) {
+ BIO_printf(bio_err, "Error loading directory %s\n", CApath);
+ goto end;
+ }
+ } else
+ X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
+ }
ERR_clear_error();
return store;
ERR_clear_error();
return store;
@@
-2721,7
+2736,7
@@
int raw_write_stdout(const void *buf, int siz)
* does impact behavior on some platform, such as differentiating between
* text and binary input/output on non-Unix platforms
*/
* does impact behavior on some platform, such as differentiating between
* text and binary input/output on non-Unix platforms
*/
-
inline
int istext(int format)
+
static
int istext(int format)
{
return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
}
{
return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
}