Fixed line endings in medsrv/filter/auth_filter.[ch].
This commit is contained in:
@@ -1,50 +1,50 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Martin Willi
|
* Copyright (C) 2008 Martin Willi
|
||||||
* Copyright (C) 2008 Philip Boetschi, Adrian Doerig
|
* Copyright (C) 2008 Philip Boetschi, Adrian Doerig
|
||||||
* Hochschule fuer Technik Rapperswil
|
* Hochschule fuer Technik Rapperswil
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
* for more details.
|
* for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "auth_filter.h"
|
#include "auth_filter.h"
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
typedef struct private_auth_filter_t private_auth_filter_t;
|
typedef struct private_auth_filter_t private_auth_filter_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* private data of auth_filter
|
* private data of auth_filter
|
||||||
*/
|
*/
|
||||||
struct private_auth_filter_t {
|
struct private_auth_filter_t {
|
||||||
/**
|
/**
|
||||||
* public functions
|
* public functions
|
||||||
*/
|
*/
|
||||||
auth_filter_t public;
|
auth_filter_t public;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* user session
|
* user session
|
||||||
*/
|
*/
|
||||||
user_t *user;
|
user_t *user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* database connection
|
* database connection
|
||||||
*/
|
*/
|
||||||
database_t *db;
|
database_t *db;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of filter_t.run
|
* Implementation of filter_t.run
|
||||||
*/
|
*/
|
||||||
static bool run(private_auth_filter_t *this, request_t *request,
|
static bool run(private_auth_filter_t *this, request_t *request,
|
||||||
char *controller, char *action)
|
char *controller, char *action)
|
||||||
{
|
{
|
||||||
if (this->user->get_user(this->user))
|
if (this->user->get_user(this->user))
|
||||||
{
|
{
|
||||||
@@ -67,32 +67,32 @@ static bool run(private_auth_filter_t *this, request_t *request,
|
|||||||
(streq(action, "add") || streq(action, "login") || streq(action, "help")))
|
(streq(action, "add") || streq(action, "login") || streq(action, "help")))
|
||||||
{ /* add/login allowed */
|
{ /* add/login allowed */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
request->redirect(request, "user/login");
|
request->redirect(request, "user/login");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of filter_t.destroy
|
* Implementation of filter_t.destroy
|
||||||
*/
|
*/
|
||||||
static void destroy(private_auth_filter_t *this)
|
static void destroy(private_auth_filter_t *this)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* see header file
|
* see header file
|
||||||
*/
|
*/
|
||||||
filter_t *auth_filter_create(user_t *user, database_t *db)
|
filter_t *auth_filter_create(user_t *user, database_t *db)
|
||||||
{
|
{
|
||||||
private_auth_filter_t *this= malloc_thing(private_auth_filter_t);
|
private_auth_filter_t *this= malloc_thing(private_auth_filter_t);
|
||||||
|
|
||||||
this->public.filter.destroy = (void(*)(filter_t*))destroy;
|
this->public.filter.destroy = (void(*)(filter_t*))destroy;
|
||||||
this->public.filter.run = (bool(*)(filter_t*, request_t*,char*,char*,char*,char*,char*,char*))run;
|
this->public.filter.run = (bool(*)(filter_t*, request_t*,char*,char*,char*,char*,char*,char*))run;
|
||||||
|
|
||||||
this->user = user;
|
this->user = user;
|
||||||
this->db = db;
|
this->db = db;
|
||||||
|
|
||||||
return &this->public.filter;
|
return &this->public.filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +1,48 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Martin Willi
|
* Copyright (C) 2008 Martin Willi
|
||||||
* Copyright (C) 2008 Philip Boetschi, Adrian Doerig
|
* Copyright (C) 2008 Philip Boetschi, Adrian Doerig
|
||||||
* Hochschule fuer Technik Rapperswil
|
* Hochschule fuer Technik Rapperswil
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
* for more details.
|
* for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup auth_filter_server auth_filter
|
* @defgroup auth_filter_server auth_filter
|
||||||
* @{ @ingroup filter_server
|
* @{ @ingroup filter_server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef AUTH_FILTER_H_
|
#ifndef AUTH_FILTER_H_
|
||||||
#define AUTH_FILTER_H_
|
#define AUTH_FILTER_H_
|
||||||
|
|
||||||
#include <library.h>
|
#include <library.h>
|
||||||
#include <filter.h>
|
#include <filter.h>
|
||||||
|
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
|
||||||
typedef struct auth_filter_t auth_filter_t;
|
typedef struct auth_filter_t auth_filter_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authentication/Authorization filter.
|
* Authentication/Authorization filter.
|
||||||
*/
|
*/
|
||||||
struct auth_filter_t {
|
struct auth_filter_t {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements filter_t interface.
|
* Implements filter_t interface.
|
||||||
*/
|
*/
|
||||||
filter_t filter;
|
filter_t filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a auth_filter instance.
|
* Create a auth_filter instance.
|
||||||
*/
|
*/
|
||||||
filter_t *auth_filter_create(user_t *user, database_t *db);
|
filter_t *auth_filter_create(user_t *user, database_t *db);
|
||||||
|
|
||||||
#endif /* AUTH_FILTER_H_ @}*/
|
#endif /* AUTH_FILTER_H_ @}*/
|
||||||
|
|||||||
Reference in New Issue
Block a user