~ubuntu-branches/debian/wheezy/apache2/wheezy

« back to all changes in this revision

Viewing changes to srclib/apr-util/memcache/apr_memcache.c

  • Committer: Package Import Robot
  • Author(s): Stefan Fritsch, Stefan Fritsch, Arno Töll
  • Date: 2012-02-01 21:49:04 UTC
  • mfrom: (0.13.15)
  • Revision ID: package-import@ubuntu.com-20120201214904-nlchebp6wu7z55jw
Tags: 2.2.22-1
[ Stefan Fritsch ]
* New upstream release, urgency medium due to security fixes:
  - Fix CVE-2012-0021: mod_log_config: DoS with '%{cookiename}C' log format
  - Fix CVE-2012-0031: Unprivileged child process could cause the parent to
    crash at shutdown
  - Fix CVE-2012-0053: Exposure of "httpOnly" cookies in code 400 error
    message.
* Move httxt2dbm to apache2-utils
* Adjust debian/control to point to new git repository.

[ Arno Töll ]
* Fix "typo in /etc/apache2/apache2.conf" (Closes: #653801)

Show diffs side-by-side

added added

removed removed

Lines of Context:
313
313
    return rv;
314
314
}
315
315
 
316
 
static apr_status_t conn_clean(void *data)
317
 
{
318
 
    apr_memcache_conn_t *conn = data;
319
 
    struct iovec vec[2];
320
 
    apr_size_t written;
321
 
 
322
 
    /* send a quit message to the memcached server to be nice about it. */
323
 
    vec[0].iov_base = MC_QUIT;
324
 
    vec[0].iov_len = MC_QUIT_LEN;
325
 
 
326
 
    vec[1].iov_base = MC_EOL;
327
 
    vec[1].iov_len = MC_EOL_LEN;
328
 
    
329
 
    /* Return values not checked, since we just want to make it go away. */
330
 
    apr_socket_sendv(conn->sock, vec, 2, &written);
331
 
    apr_socket_close(conn->sock);
332
 
 
333
 
    conn->p = NULL; /* so that destructor does not destroy the pool again */
334
 
 
335
 
    return APR_SUCCESS;
336
 
}
337
316
 
338
317
static apr_status_t
339
318
mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
355
334
        return rv;
356
335
    }
357
336
 
358
 
#if APR_HAS_THREADS
359
 
    conn = malloc(sizeof( apr_memcache_conn_t )); /* non-pool space! */
360
 
#else
361
337
    conn = apr_palloc(np, sizeof( apr_memcache_conn_t ));
362
 
#endif
363
338
 
364
339
    conn->p = np;
365
340
    conn->tp = tp;
368
343
 
369
344
    if (rv != APR_SUCCESS) {
370
345
        apr_pool_destroy(np);
371
 
#if APR_HAS_THREADS
372
 
        free(conn);
373
 
#endif
374
346
        return rv;
375
347
    }
376
348
 
381
353
    rv = conn_connect(conn);
382
354
    if (rv != APR_SUCCESS) {
383
355
        apr_pool_destroy(np);
384
 
#if APR_HAS_THREADS
385
 
        free(conn);
386
 
#endif
387
356
    }
388
357
    else {
389
 
        apr_pool_cleanup_register(np, conn, conn_clean, apr_pool_cleanup_null);
390
358
        *conn_ = conn;
391
359
    }
392
360
    
398
366
mc_conn_destruct(void *conn_, void *params, apr_pool_t *pool)
399
367
{
400
368
    apr_memcache_conn_t *conn = (apr_memcache_conn_t*)conn_;
401
 
    
402
 
    if (conn->p) {
403
 
        apr_pool_destroy(conn->p);
404
 
    }
405
 
 
406
 
    free(conn); /* free non-pool space */
 
369
    struct iovec vec[2];
 
370
    apr_size_t written;
 
371
    
 
372
    /* send a quit message to the memcached server to be nice about it. */
 
373
    vec[0].iov_base = MC_QUIT;
 
374
    vec[0].iov_len = MC_QUIT_LEN;
 
375
 
 
376
    vec[1].iov_base = MC_EOL;
 
377
    vec[1].iov_len = MC_EOL_LEN;
 
378
    
 
379
    /* Return values not checked, since we just want to make it go away. */
 
380
    apr_socket_sendv(conn->sock, vec, 2, &written);
 
381
    apr_socket_close(conn->sock);
 
382
 
 
383
    apr_pool_destroy(conn->p);
407
384
    
408
385
    return APR_SUCCESS;
409
386
}
441
418
                               mc_conn_construct,       /* Make a New Connection */
442
419
                               mc_conn_destruct,        /* Kill Old Connection */
443
420
                               server, np);
 
421
    if (rv != APR_SUCCESS) {
 
422
        return rv;
 
423
    }
 
424
 
 
425
    apr_reslist_cleanup_order_set(server->conns, APR_RESLIST_CLEANUP_FIRST);
444
426
#else
445
427
    rv = mc_conn_construct((void**)&(server->conn), server, np);
446
 
#endif
447
 
 
448
428
    if (rv != APR_SUCCESS) {
449
429
        return rv;
450
430
    }
 
431
#endif
451
432
 
452
433
    *ms = server;
453
434
 
793
774
    if (strncmp(MS_VALUE, conn->buffer, MS_VALUE_LEN) == 0) {
794
775
        char *flags;
795
776
        char *length;
796
 
        char *start;
797
777
        char *last;
798
778
        apr_size_t len = 0;
799
779
 
800
 
        start = conn->buffer;
801
780
        flags = apr_strtok(conn->buffer, " ", &last);
802
781
        flags = apr_strtok(NULL, " ", &last);
803
782
        flags = apr_strtok(NULL, " ", &last);
1366
1345
               char *key;
1367
1346
               char *flags;
1368
1347
               char *length;
1369
 
               char *start;
1370
1348
               char *last;
1371
1349
               char *data;
1372
1350
               apr_size_t len = 0;
1373
1351
 
1374
 
               start = conn->buffer;
1375
1352
               key = apr_strtok(conn->buffer, " ", &last); /* just the VALUE, ignore */
1376
1353
               key = apr_strtok(NULL, " ", &last);
1377
1354
               flags = apr_strtok(NULL, " ", &last);