backend.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ibase.h>
#include <postgresql/libpq-fe.h>
#include <mysql/mysql.h>
#include "backend.h"
#include <security/pam_appl.h>
#include "/usr/include/postgresql/libpq-fe.h"
#include <security/pam_modules.h>
#include "pam_kmux_options.h"
#include <security/pam_ext.h>
#include <stdarg.h>
#include <stdbool.h>
#include "pam_kmux.h"
#include <syslog.h>
Include dependency graph for backend.c:
This graph shows which files directly or indirectly include this file:

Functions

int exec_param (const char *service, const char *user, const char *newpass, const char *rhost, const modopt_t *options)
 Start the right exec_param function in dependency of the database-type.
int exec_params (const char *service, const char *user, const char *newpass, const char *rhost, const modopts_t *options_container)
 This function is a wrapper for exec_param.
int backend_authenticate (const char *service, const char *user, const char *passwd, const char *rhost, const modopt_t *options)
 Start the right backend_authenticate function in dependency of the database-type.
int backends_authenticate (const char *service, const char *user, const char *passwd, const char *rhost, const modopts_t *options_container)
 This function is a wrapper for backend_authenticate.

Variables

pam_modopt_t pamod_options

Detailed Description

Backend wrappers. This file contains wrappers to call the right function of the <database>_backend - files. To find out which function with which modopt_t-connection-structure has to be called the specified database types (db_type) are used.

Author:
Julian Thome
Date:
2009-11-09

Backend wrappers API. This file contains the API to call the right function of the <database>_backend - files. To find out which function with which modopt_t-connection-structure has to be called, the specified database types (db_type) are used.

Author:
Julian Thome
Date:
2009-11-11

Function Documentation

int backend_authenticate ( const char *  service,
const char *  user,
const char *  passwd,
const char *  rhost,
const modopt_t options 
)

Start the right backend_authenticate function in dependency of the database-type.

This function finds out the database type given by the modopt_t *options object and run a authentification query on it.

Parameters:
service Character array.
user Character array contains username/uid of the user that tries to change password.
passwd Character array contains the password of the user.
rhost Character array contains the value of PAM_RHOST. This is only needed if you need somethin like this in your defined queries.
options Struct which represents exactly one database connection.
Return values:
PAM_SUCCESS Successfully authenticate against backend.
PAM_AUTH_ERR Malformed options (passwd, options or user = NULL), connection error during dial-up, password comarison between database-stored-password and entered password fails, or query expandation fails.
PAM_AUTHINFO_UNAVAIL Fetched no valid result.
int backends_authenticate ( const char *  service,
const char *  user,
const char *  passwd,
const char *  rhost,
const modopts_t options_container 
)

This function is a wrapper for backend_authenticate.

It calls backend_authenticate for every modopt_t struct which is contained by the array of modopt_t structs contained by the modopts_t struct options_container.

Parameters:
service Character array.
user Character array contains username/uid of the user that tries to change password.
passwd Character array contains the password of the user.
rhost Character array contains the value of PAM_RHOST. This is only needed if you need somethin like this in your defined queries.
options_container Struct which represents a collection of database connections.
Return values:
PAM_SUCCESS Successfully authenticate against backend.
PAM_AUTH_ERR Malformed options (passwd, options or user = NULL), connection error during dial-up password comarison between database-stored-password and entered password fails, or query expandation fails.
PAM_AUTHINFO_UNAVAIL Fetched no valid result.
int exec_param ( const char *  service,
const char *  user,
const char *  newpass,
const char *  rhost,
const modopt_t options 
)

Start the right exec_param function in dependency of the database-type.

This function tries to find out the database type given by the modopt_t *options object and run a query on it.

Parameters:
service Service name character array.
user Character array which contains username/uid of the user that tries to change password.
newpass Contains new cleartext array of user.
rhost Character array contains the value of PAM_RHOST. This is only needed if you need something like this in your defined queries.
options Struct which represents exactly one database connection.
Return values:
PAM_SUCCESS Successfully executed query.
PAM_AUTH_ERR Failure durin password encryption.

Encrypt password with the hastype specified in the struct options

int exec_params ( const char *  service,
const char *  user,
const char *  newpass,
const char *  rhost,
const modopts_t options_container 
)

This function is a wrapper for exec_param.

It calls exec_param for every modopt_t struct which is contained by the list of modopt_t structs contained by the modopts_t struct options_container.

Parameters:
service character array.
user Character array contains username/uid of the user that tries to change password.
newpass Contains new cleartext array of user.
rhost Character array contains the value of PAM_RHOST. This is only needed if you need something like this in your defined queries.
options_container Struct which represents a collection of database connections.
Return values:
PAM_SUCCESS Successfully executed query.
PAM_AUTH_ERR Failure durin password encryption.

Variable Documentation

C-Structure which contains pam-module options. In this global variable the pam-module options like debug level or the path of the configuration file are stored.

Generated on Mon Apr 5 22:28:42 2010 for pam_kmux by  doxygen 1.6.3