diff options
| author | 2008-02-20 19:59:41 +0000 | |
|---|---|---|
| committer | 2008-02-20 19:59:41 +0000 | |
| commit | 75f74f92f068309b2c77d83340008ef7e9c6d2df (patch) | |
| tree | ddb46be1b66a4d2a9a9b9f6e816a7fedc9031a82 /src/gnutls_config.c | |
| parent | aa6fd149d2e558a60b8c022516619c33aee3f75d (diff) | |
| parent | 9120fdbd1f33e4ed465ee181ec237a68fa27bf2c (diff) | |
added new branch
Diffstat (limited to 'src/gnutls_config.c')
| -rw-r--r-- | src/gnutls_config.c | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/src/gnutls_config.c b/src/gnutls_config.c index f08512e..8d6308a 100644 --- a/src/gnutls_config.c +++ b/src/gnutls_config.c | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * Copyright 2004-2005 Paul Querna | 2 | * Copyright 2004-2005 Paul Querna |
| 3 | * Copyright 2007 Nikos Mavrogiannopoulos | ||
| 4 | * | 3 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -203,84 +202,6 @@ const char *mgs_set_key_file(cmd_parms * parms, void *dummy, | |||
| 203 | return NULL; | 202 | return NULL; |
| 204 | } | 203 | } |
| 205 | 204 | ||
| 206 | const char *mgs_set_pgpcert_file(cmd_parms * parms, void *dummy, | ||
| 207 | const char *arg) | ||
| 208 | { | ||
| 209 | int ret; | ||
| 210 | gnutls_datum_t data; | ||
| 211 | const char *file; | ||
| 212 | apr_pool_t *spool; | ||
| 213 | mgs_srvconf_rec *sc = | ||
| 214 | (mgs_srvconf_rec *) ap_get_module_config(parms->server-> | ||
| 215 | module_config, | ||
| 216 | &gnutls_module); | ||
| 217 | apr_pool_create(&spool, parms->pool); | ||
| 218 | |||
| 219 | file = ap_server_root_relative(spool, arg); | ||
| 220 | |||
| 221 | if (load_datum_from_file(spool, file, &data) != 0) { | ||
| 222 | return apr_psprintf(parms->pool, "GnuTLS: Error Reading " | ||
| 223 | "Certificate '%s'", file); | ||
| 224 | } | ||
| 225 | |||
| 226 | ret = gnutls_openpgp_crt_init( &sc->cert_pgp); | ||
| 227 | if (ret < 0) { | ||
| 228 | return apr_psprintf(parms->pool, "GnuTLS: Failed to Init " | ||
| 229 | "PGP Certificate: (%d) %s", ret, | ||
| 230 | gnutls_strerror(ret)); | ||
| 231 | } | ||
| 232 | |||
| 233 | ret = | ||
| 234 | gnutls_openpgp_crt_import(sc->cert_pgp, &data, GNUTLS_OPENPGP_FMT_BASE64); | ||
| 235 | if (ret < 0) { | ||
| 236 | return apr_psprintf(parms->pool, "GnuTLS: Failed to Import " | ||
| 237 | "PGP Certificate '%s': (%d) %s", file, ret, | ||
| 238 | gnutls_strerror(ret)); | ||
| 239 | } | ||
| 240 | |||
| 241 | apr_pool_destroy(spool); | ||
| 242 | return NULL; | ||
| 243 | } | ||
| 244 | |||
| 245 | const char *mgs_set_pgpkey_file(cmd_parms * parms, void *dummy, | ||
| 246 | const char *arg) | ||
| 247 | { | ||
| 248 | int ret; | ||
| 249 | gnutls_datum_t data; | ||
| 250 | const char *file; | ||
| 251 | apr_pool_t *spool; | ||
| 252 | mgs_srvconf_rec *sc = | ||
| 253 | (mgs_srvconf_rec *) ap_get_module_config(parms->server-> | ||
| 254 | module_config, | ||
| 255 | &gnutls_module); | ||
| 256 | apr_pool_create(&spool, parms->pool); | ||
| 257 | |||
| 258 | file = ap_server_root_relative(spool, arg); | ||
| 259 | |||
| 260 | if (load_datum_from_file(spool, file, &data) != 0) { | ||
| 261 | return apr_psprintf(parms->pool, "GnuTLS: Error Reading " | ||
| 262 | "Private Key '%s'", file); | ||
| 263 | } | ||
| 264 | |||
| 265 | ret = gnutls_openpgp_privkey_init(&sc->privkey_pgp); | ||
| 266 | if (ret < 0) { | ||
| 267 | return apr_psprintf(parms->pool, "GnuTLS: Failed to initialize" | ||
| 268 | ": (%d) %s", ret, gnutls_strerror(ret)); | ||
| 269 | } | ||
| 270 | |||
| 271 | ret = | ||
| 272 | gnutls_openpgp_privkey_import(sc->privkey_pgp, &data, | ||
| 273 | GNUTLS_OPENPGP_FMT_BASE64, NULL, 0); | ||
| 274 | if (ret != 0) { | ||
| 275 | return apr_psprintf(parms->pool, "GnuTLS: Failed to Import " | ||
| 276 | "PGP Private Key '%s': (%d) %s", file, ret, | ||
| 277 | gnutls_strerror(ret)); | ||
| 278 | } | ||
| 279 | apr_pool_destroy(spool); | ||
| 280 | return NULL; | ||
| 281 | } | ||
| 282 | |||
| 283 | |||
| 284 | const char *mgs_set_srp_tpasswd_file(cmd_parms * parms, void *dummy, | 205 | const char *mgs_set_srp_tpasswd_file(cmd_parms * parms, void *dummy, |
| 285 | const char *arg) | 206 | const char *arg) |
| 286 | { | 207 | { |
| @@ -429,44 +350,6 @@ const char *mgs_set_client_ca_file(cmd_parms * parms, void *dummy, | |||
| 429 | return NULL; | 350 | return NULL; |
| 430 | } | 351 | } |
| 431 | 352 | ||
| 432 | const char *mgs_set_keyring_file(cmd_parms * parms, void *dummy, | ||
| 433 | const char *arg) | ||
| 434 | { | ||
| 435 | int rv; | ||
| 436 | const char *file; | ||
| 437 | apr_pool_t *spool; | ||
| 438 | gnutls_datum_t data; | ||
| 439 | |||
| 440 | mgs_srvconf_rec *sc = | ||
| 441 | (mgs_srvconf_rec *) ap_get_module_config(parms->server-> | ||
| 442 | module_config, | ||
| 443 | &gnutls_module); | ||
| 444 | apr_pool_create(&spool, parms->pool); | ||
| 445 | |||
| 446 | file = ap_server_root_relative(spool, arg); | ||
| 447 | |||
| 448 | if (load_datum_from_file(spool, file, &data) != 0) { | ||
| 449 | return apr_psprintf(parms->pool, "GnuTLS: Error Reading " | ||
| 450 | "Keyring File '%s'", file); | ||
| 451 | } | ||
| 452 | |||
| 453 | rv = gnutls_openpgp_keyring_init(&sc->pgp_list); | ||
| 454 | if (rv < 0) { | ||
| 455 | return apr_psprintf(parms->pool, "GnuTLS: Failed to initialize" | ||
| 456 | "keyring: (%d) %s", rv, gnutls_strerror(rv)); | ||
| 457 | } | ||
| 458 | |||
| 459 | rv = gnutls_openpgp_keyring_import(sc->pgp_list, &data, GNUTLS_OPENPGP_FMT_BASE64); | ||
| 460 | if (rv < 0) { | ||
| 461 | return apr_psprintf(parms->pool, "GnuTLS: Failed to load " | ||
| 462 | "Keyring File '%s': (%d) %s", file, rv, | ||
| 463 | gnutls_strerror(rv)); | ||
| 464 | } | ||
| 465 | |||
| 466 | apr_pool_destroy(spool); | ||
| 467 | return NULL; | ||
| 468 | } | ||
| 469 | |||
| 470 | const char *mgs_set_enabled(cmd_parms * parms, void *dummy, | 353 | const char *mgs_set_enabled(cmd_parms * parms, void *dummy, |
| 471 | const char *arg) | 354 | const char *arg) |
| 472 | { | 355 | { |
