libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
auth_pam.c File Reference
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <security/pam_appl.h>
#include <onion/handler.h>
#include <onion/response.h>
#include <onion/codecs.h>
#include <onion/log.h>
#include <onion/dict.h>
#include <onion/low.h>

Data Structures

struct  onion_handler_auth_pam_data_t

Macros

#define RESPONSE_UNAUTHORIZED   "<h1>Unauthorized access</h1>"

Typedefs

typedef struct
onion_handler_auth_pam_data_t 
onion_handler_auth_pam_data

Functions

int authorize (const char *pamname, const char *username, const char *password)
 Do the real authorization. Checks if access allowed.
int onion_handler_auth_pam_handler (onion_handler_auth_pam_data *d, onion_request *request, onion_response *res)
void onion_handler_auth_pam_delete (onion_handler_auth_pam_data *d)
onion_handleronion_handler_auth_pam (const char *realm, const char *pamname, onion_handler *inside_level)
 Creates an path handler. If the path matches the regex, it reomves that from the regexp and goes to the inside_level.

Macro Definition Documentation

#define RESPONSE_UNAUTHORIZED   "<h1>Unauthorized access</h1>"

Typedef Documentation

Function Documentation

int authorize ( const char *  pamname,
const char *  username,
const char *  password 
)

Do the real authorization. Checks if access allowed.

References ONION_DEBUG, ONION_ERROR, and ONION_WARNING.

Referenced by onion_handler_auth_pam_handler().

onion_handler* onion_handler_auth_pam ( const char *  realm,
const char *  pamname,
onion_handler inside_level 
)

Creates an path handler. If the path matches the regex, it reomves that from the regexp and goes to the inside_level.

Creates an auth handler that do not allow to pass unless user is authenticated using a pam name.

If on the inside level nobody answers, it just returns NULL, so ->next can answer.

References onion_handler_auth_pam_data_t::inside, onion_handler_auth_pam_delete(), onion_handler_auth_pam_handler(), onion_handler_t::onion_handler_new(), onion_low_malloc(), onion_low_strdup(), onion_handler_auth_pam_data_t::pamname, and onion_handler_auth_pam_data_t::realm.

void onion_handler_auth_pam_delete ( onion_handler_auth_pam_data d)
int onion_handler_auth_pam_handler ( onion_handler_auth_pam_data d,
onion_request request,
onion_response res 
)