Commit 0b6c727f authored by Stefan Eissing's avatar Stefan Eissing
Browse files

On the trunk:

mod_md: some internal refactoring of config/sectio handling



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1804787 13f79535-47bb-0310-9956-ffa450edef68
parent d9bb69c0
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ struct md_json_t;
struct md_cert_t;
struct md_pkey_t;
struct md_store_t;
struct md_srv_conf_t;

#define MD_TLSSNI01_DNS_SUFFIX     ".acme.invalid"

@@ -64,24 +65,25 @@ typedef enum {
typedef struct md_t md_t;
struct md_t {
    const char *name;               /* unique name of this MD */
    md_state_t state;               /* state of this MD */
    apr_time_t expires;             /* When the credentials for this domain expire. 0 if unknown */
    apr_interval_time_t renew_window;/* time before expiration that starts renewal */
    
    struct apr_array_header_t *domains; /* all DNS names this MD includes */
    struct apr_array_header_t *contacts;   /* list of contact uris, e.g. mailto:xxx */

    int transitive;                 /* != 0 iff VirtualHost names/aliases are auto-added */
    md_drive_mode_t drive_mode;     /* mode of obtaining credentials */
    int drive_mode;                 /* mode of obtaining credentials */
    int must_staple;                /* certificates should set the OCSP Must Staple extension */
    apr_interval_time_t renew_window;/* time before expiration that starts renewal */
    
    const char *ca_url;             /* url of CA certificate service */
    const char *ca_proto;           /* protocol used vs CA (e.g. ACME) */
    const char *ca_account;         /* account used at CA */
    const char *ca_agreement;       /* accepted agreement uri between CA and user */ 
    struct apr_array_header_t *ca_challenges; /* challenge types configured for this MD */
    struct apr_array_header_t *contacts;   /* list of contact uris, e.g. mailto:xxx */

    md_state_t state;               /* state of this MD */
    apr_time_t expires;             /* When the credentials for this domain expire. 0 if unknown */
    const char *cert_url;           /* url where cert has been created, remember during drive */ 
    
    const struct md_srv_conf_t *sc; /* server config where it was defined or NULL */
    const char *defn_name;          /* config file this MD was defined */
    unsigned defn_line_number;      /* line number of definition */
};
@@ -199,7 +201,7 @@ md_t *md_create_empty(apr_pool_t *p);
/**
 * Create a managed domain, given a list of domain names.
 */
const char *md_create(md_t **pmd, apr_pool_t *p, struct apr_array_header_t *domains);
md_t *md_create(apr_pool_t *p, struct apr_array_header_t *domains);

/**
 * Deep copy an md record into another pool.
+2 −3
Original line number Diff line number Diff line
@@ -39,11 +39,10 @@
static apr_status_t cmd_reg_add(md_cmd_ctx *ctx, const md_cmd_t *cmd)
{
    md_t *md;
    const char *err;
    apr_status_t rv;

    err = md_create(&md, ctx->p, md_cmd_gather_args(ctx, 0));
    if (err) {
    md = md_create(ctx->p, md_cmd_gather_args(ctx, 0));
    if (md->domains->nelts == 0) {
        return APR_EINVAL;
    }

+2 −3
Original line number Diff line number Diff line
@@ -39,11 +39,10 @@
static apr_status_t cmd_add(md_cmd_ctx *ctx, const md_cmd_t *cmd) 
{
    md_t *md, *nmd;
    const char *err;
    apr_status_t rv;

    err = md_create(&md, ctx->p, md_cmd_gather_args(ctx, 0));
    if (err) {
    md = md_create(ctx->p, md_cmd_gather_args(ctx, 0));
    if (md->domains->nelts == 0) {
        return APR_EINVAL;
    }

+2 −11
Original line number Diff line number Diff line
@@ -189,24 +189,15 @@ md_t *md_get_by_dns_overlap(struct apr_array_header_t *mds, const md_t *md)
    return NULL;
}

const char *md_create(md_t **pmd, apr_pool_t *p, apr_array_header_t *domains)
md_t *md_create(apr_pool_t *p, apr_array_header_t *domains)
{
    md_t *md;
    
    if (domains->nelts <= 0) {
        return "needs at least one domain name";
    }
    
    md = md_create_empty(p);
    if (!md) {
        return "not enough memory";
    }

    md->domains = md_array_str_compact(p, domains, 0);
    md->name = APR_ARRAY_IDX(md->domains, 0, const char *);
    
    *pmd = md;
    return NULL;   
    return md;
}

/**************************************************************************************************/
+220 −231

File changed.

Preview size limit exceeded, changes collapsed.

Loading