| 390 | } |
| 391 | |
| 392 | static apr_status_t socache_dbm_remove(ap_socache_instance_t *ctx, |
| 393 | server_rec *s, const unsigned char *id, |
| 394 | unsigned int idlen, apr_pool_t *p) |
| 395 | { |
| 396 | #if APU_MAJOR_VERSION > 1 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 7) |
| 397 | const apr_dbm_driver_t *driver; |
| 398 | const apu_err_t *err; |
| 399 | #endif |
| 400 | apr_dbm_t *dbm; |
| 401 | apr_datum_t dbmkey; |
| 402 | apr_status_t rv; |
| 403 | |
| 404 | /* create DBM key and values */ |
| 405 | dbmkey.dptr = (char *)id; |
| 406 | dbmkey.dsize = idlen; |
| 407 | |
| 408 | /* and delete it from the DBM file */ |
| 409 | apr_pool_clear(ctx->pool); |
| 410 | |
| 411 | #if APU_MAJOR_VERSION > 1 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 7) |
| 412 | if ((rv = apr_dbm_get_driver(&driver, NULL, &err, |
| 413 | ctx->pool) != APR_SUCCESS) { |
| 414 | ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10280) |
| 415 | "Cannot load socache DBM library '%s' (delete): %s", |
| 416 | err->reason, err->msg); |
| 417 | return rv; |
| 418 | } |
| 419 | if ((rv = apr_dbm_open2(&dbm, driver, ctx->data_file, |
| 420 | APR_DBM_RWCREATE, DBM_FILE_MODE, ctx->pool)) != APR_SUCCESS) { |
| 421 | ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(00810) |
| 422 | "Cannot open socache DBM file `%s' for writing " |
| 423 | "(delete)", |
| 424 | ctx->data_file); |
| 425 | return rv; |
| 426 | } |
| 427 | #else |
| 428 | if ((rv = apr_dbm_open(&dbm, ctx->data_file, APR_DBM_RWCREATE, |
| 429 | DBM_FILE_MODE, ctx->pool)) != APR_SUCCESS) { |
| 430 | ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(00810) |
| 431 | "Cannot open socache DBM file `%s' for writing " |
| 432 | "(delete)", |
| 433 | ctx->data_file); |
| 434 | return rv; |
| 435 | } |
| 436 | #endif |
| 437 | apr_dbm_delete(dbm, dbmkey); |
| 438 | apr_dbm_close(dbm); |
| 439 | |
| 440 | return APR_SUCCESS; |
| 441 | } |
| 442 | |
| 443 | static void socache_dbm_expire(ap_socache_instance_t *ctx, server_rec *s) |
| 444 | { |
no test coverage detected