summaryrefslogtreecommitdiff
path: root/daemon/dummy.c
blob: ca83e54097ac62927a5a8bef2e4f46f961f026a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * HttpAuth
 *
 * Copyright (C) 2004 Stefan Walter
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the
 * Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include "usuals.h"
#include "httpauthd.h"
#include "defaults.h"
#include "hash.h"
#include "bd.h"

#include <stdio.h>
#include <fcntl.h>

/* -------------------------------------------------------------------------------
 * Structures
 */

/* Forward declarations for callbacks */
static int validate_digest(ha_request_t* rq, const char* user, digest_context_t* dg);
static int validate_basic(ha_request_t* rq, const char* user, const char* password);

/* The defaults for the context */
static const bd_context_t dummy_defaults = BD_CALLBACKS(validate_digest, validate_basic, NULL);

/* -------------------------------------------------------------------------------
 * Internal Functions
 */

static int validate_digest(ha_request_t* rq, const char* user, digest_context_t* dg)
{
    return HA_OK;
}

static int validate_basic(ha_request_t* rq, const char* user, const char* password)
{
    return HA_OK;
}

/* -------------------------------------------------------------------------------
 * Handler Functions
 */

int dummy_config(ha_context_t* context, const char* name, const char* value)
{
    return HA_FALSE;
}

int dummy_init(ha_context_t* context)
{
    int r;

    if((r = bd_init(context)) != HA_OK)
        return r;

    ha_messagex(NULL, LOG_INFO, "initialized dummy handler");
    return HA_OK;
}


/* -------------------------------------------------------------------------------
 * Handler Definition
 */

ha_handler_t dummy_handler =
{
    "DUMMY",               /* The type */
    dummy_init,             /* Initialization function */
    bd_destroy,             /* Uninitialization routine */
    dummy_config,           /* Config routine */
    bd_process,             /* Processing routine */
    &dummy_defaults,        /* A default context */
    sizeof(bd_context_t)	/* Size of the context */
};