VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/test/confdump.c@ 97673

最後變更 在這個檔案從97673是 94320,由 vboxsync 提交於 3 年 前

libs/openssl-3.0.1: Export to OSE and fix copyright headers in Makefiles, bugref:10128

檔案大小: 1.4 KB
 
1/*
2 * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include <stdio.h>
11#include <string.h>
12#include <openssl/bio.h>
13#include <openssl/conf.h>
14#include <openssl/safestack.h>
15#include <openssl/err.h>
16
17static void dump_section(const char *name, const CONF *cnf)
18{
19 STACK_OF(CONF_VALUE) *sect = NCONF_get_section(cnf, name);
20 int i;
21
22 printf("[ %s ]\n", name);
23 for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
24 CONF_VALUE *cv = sk_CONF_VALUE_value(sect, i);
25
26 printf("%s = %s\n", cv->name, cv->value);
27 }
28}
29
30int main(int argc, char **argv)
31{
32 long eline;
33 CONF *conf = NCONF_new(NCONF_default());
34 int ret = 1;
35 STACK_OF(OPENSSL_CSTRING) *section_names = NULL;
36
37 if (conf != NULL && NCONF_load(conf, argv[1], &eline)) {
38 int i;
39
40 section_names = NCONF_get_section_names(conf);
41 for (i = 0; i < sk_OPENSSL_CSTRING_num(section_names); i++) {
42 dump_section(sk_OPENSSL_CSTRING_value(section_names, i), conf);
43 }
44 sk_OPENSSL_CSTRING_free(section_names);
45 ret = 0;
46 } else {
47 ERR_print_errors_fp(stderr);
48 }
49 NCONF_free(conf);
50 return ret;
51}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette