ssl_ct_util.c revision 75f5c2db254c0167a0e396254460de09b775d203
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "apr_fnmatch.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include "httpd.h"
#include "http_log.h"
#include "ssl_ct_util.h"
apr_pool_t *p, server_rec *s)
{
if (rv != APR_SUCCESS) {
"can't build filename from %s and %s",
}
return rv;
}
{
}
{
}
void ctutil_buffer_to_array(apr_pool_t *p, const char *b,
{
ch = b;
const char *line;
if (!end) {
}
ch++;
}
--tmpend;
}
}
}
}
{
const char * const *elts;
int i;
return 1;
}
}
return 0;
}
{
if (*f == NULL) {
}
else {
rv = APR_SUCCESS;
}
return rv;
}
/* read_dir() is remarkably like apr_match_glob(), which could
* probably use some processing flags to indicate variations on
* the basic behavior (and implement better error checking).
*/
server_rec *s,
const char *dirname,
const char *pattern,
{
apr_dir_t *d;
int reported = 0;
/* add to existing array if it already exists */
}
if (rv != APR_SUCCESS) {
dirname);
return rv;
}
const char *fn;
if (rv != APR_SUCCESS) {
reported = 1;
break;
}
}
}
if (APR_STATUS_IS_ENOENT(rv)) {
rv = APR_SUCCESS;
}
"couldn't read entry from dir %s", dirname);
}
apr_dir_close(d);
if (rv == APR_SUCCESS) {
}
return rv;
}
server_rec *s,
const char *fn,
char **contents,
{
apr_file_t *f;
*contents_size = 0;
if (rv != APR_SUCCESS) {
"couldn't read %s", fn);
return rv;
}
if (rv != APR_SUCCESS) {
"couldn't retrieve size of %s", fn);
apr_file_close(f);
return rv;
}
rv = APR_ENOSPC;
apr_file_close(f);
return rv;
}
* how big the file is
*/
"apr_file_read_full");
}
apr_file_close(f);
return rv;
}
const char *desc_for_log)
{
apr_pollfd_t pfd = {0};
int fds_waiting;
fds_waiting = 0;
pfd.p = p;
++fds_waiting;
++fds_waiting;
while (fds_waiting) {
int i, num_events;
const apr_pollfd_t *pdesc;
char buf[4096];
&num_events, &pdesc);
"apr_pollset_poll");
break;
}
for (i = 0; i < num_events; i++) {
if (APR_STATUS_IS_EOF(rv)) {
--fds_waiting;
}
else if (rv != APR_SUCCESS) {
"apr_file_read");
}
else {
}
}
}
}
#else /* APR_FILES_AS_SOCKETS */
const char *desc_for_log)
{
char buf[4096];
int fds_waiting = 2;
while (fds_waiting) {
int i;
int read = 0;
if (!fds[i]) {
continue;
}
if (APR_STATUS_IS_EOF(rv)) {
apr_file_close(fds[i]);
--fds_waiting;
}
else if (APR_STATUS_IS_EAGAIN(rv)) {
/* we don't actually know if data is ready before reading, so
* this isn't an error
*/
}
else if (rv != APR_SUCCESS) {
"apr_file_read");
}
else {
++read;
}
}
if (fds_waiting && !read) {
/* no tight loop */
}
}
}
#endif /* APR_FILES_AS_SOCKETS */
server_rec *s,
const char *args[8],
const char *desc_for_log)
{
apr_proc_t proc = {0};
int exitcode;
if (rv != APR_SUCCESS) {
return rv;
}
if (rv != APR_SUCCESS) {
return rv;
}
if (rv != APR_SUCCESS) {
return rv;
}
rv, s,
"exit code from %s: %d (%s)",
rv = APR_EGENERAL;
}
return rv;
}
{
}
{
}
apr_file_t *f,
{
char vals[2];
if (rv != APR_SUCCESS) {
"can't write 2-byte length to file");
}
return rv;
}
apr_file_t *f,
{
char vals[3];
if (rv != APR_SUCCESS) {
"can't write 3-byte length to file");
}
return rv;
}
{
int i;
0, s, "%s", desc);
0, s, ">>%s", elts[i]);
}
}
{
apr_uint64_t val = 0;
int i;
return APR_EINVAL;
}
for (i = 0; i < num_bytes; i++) {
*mem += 1;
*avail -= 1;
}
return APR_SUCCESS;
}
{
}
{
return rv;
}
{
int i;
return APR_EINVAL;
}
for (i = 0; i < num_bytes; i++) {
*mem += 1;
*avail -= 1;
shift -= 8;
}
return APR_SUCCESS;
}
{
}
{
}
{
}
unsigned char val)
{
}
const unsigned char *val,
{
return APR_EINVAL;
}
return rv;
}
return APR_SUCCESS;
}
const unsigned char *val,
{
return APR_EINVAL;
}
return rv;
}
return APR_SUCCESS;
}
/* all this deserialization crap is of course from
*/
{
if (rv == APR_SUCCESS) {
}
return rv;
}
const unsigned char **start)
{
return APR_EINVAL;
}
return APR_SUCCESS;
}
{
if (rv != APR_SUCCESS) {
return rv;
}
return rv;
}
#define TESTURL1 "http://127.0.0.1:8888"
#define TESTURL2 "http://127.0.0.1:9999"
#define TESTURL3 "http://127.0.0.1:10000"
void ctutil_run_internal_tests(apr_pool_t *p)
{
const char *filecontents =
TESTURL3 /* no "\n" */ ;
const unsigned char *const_ch;
avail = 8;
avail = 8;
avail = 7;
== APR_EINVAL);
avail = 3;
avail = 1;
== APR_EINVAL);
avail = 2;
avail = 2;
avail = 1;
== APR_EINVAL);
avail = 1;
avail = 0;
== APR_EINVAL);
avail = 8;
(unsigned char *)"\x01""\x02""\x03""\x04", 4);
avail = 3;
(unsigned char *)"\x01""\x02""\x03""\x04", 4);
avail = 8;
(unsigned char *)"\x01""\x02""\x03""\x04", 4);
avail = 4;
(unsigned char *)"\x01""\x02""\x03""\x04", 4);
}