backend_firebird.c File Reference
#include "common.h"
#include <ctype.h>
#include <errno.h>
#include <mhash.h>
#include <netdb.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "backend_common.h"
#include "pam_kmux_options.h"
#include <ibase.h>
#include "backend_firebird.h"
Functions |
| void * | firebird_db_connect (const modopt_t *options) |
| | Connect to firebird database.
|
| void | firebird_db_disconnect (void *vconn) |
| | Terminate database connection.
|
| int | firebird_expand_query (char **command, const char **values, const char *query, const char *service, const char *user, const char *passwd, const char *rhost, const char *raddr, const modopt_t *options) |
| | Build a SQL-query. This function build a valid SQL-query. Some variables like u for user or c for column_password are substitutet by their meaning.
|
| int | firebird_exec_param (void *vconn, void **vres, const char *query, const char *service, const char *user, const char *passwd, const char *rhost, const modopt_t *options) |
| | Execute a query on the firebird database.
|
| int | firebird_backend_authenticate (const char *service, const char *user, const char *passwd, const char *rhost, const modopt_t *options) |
| | Authenticate against firebird backend.
|
Variables |
| pam_modopt_t | pamod_options |
Detailed Description
Pam_kmux-firebird-function-implementation. In this file all firebird-pam-kmux-backend-functions are implemented.
- Author:
- Julian Thome
- Date:
- 2009-11-12
Function Documentation
| int firebird_backend_authenticate |
( |
const char * |
service, |
|
|
const char * |
user, |
|
|
const char * |
passwd, |
|
|
const char * |
rhost, |
|
|
const modopt_t * |
options | |
|
) |
| | |
Authenticate against firebird backend.
This function tries to finds out the database type given by the modopt_t *options object and run a authentification query on it.
- Parameters:
-
| service | 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 something 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. |
| void* firebird_db_connect |
( |
const modopt_t * |
options |
) |
|
Connect to firebird database.
This functinos establish a firebird database connection and returns a database handle.
- Parameters:
-
| options | A modopt_t struct, which contains the database information will be used establish a database connection. |
- Returns:
- An isc_db_handle-firebird-database-handle if everything is ok, NULL if something went wrong trying to establish a connection.
| void firebird_db_disconnect |
( |
void * |
vconn |
) |
|
Terminate database connection.
This function takes an isc_db_handle-firebird-handle and releases it properly.
- Parameters:
-
| vconn | A connection handle to a firebird database. |
- Returns:
- Nothing to return.
| int firebird_exec_param |
( |
void * |
vconn, |
|
|
void ** |
vres, |
|
|
const char * |
query, |
|
|
const char * |
service, |
|
|
const char * |
user, |
|
|
const char * |
passwd, |
|
|
const char * |
rhost, |
|
|
const modopt_t * |
options | |
|
) |
| | |
Execute a query on the firebird database.
This function tries to find out the database type given by the modopt_t *options object and run a query on it.
- Parameters:
-
| vconn | isc_db_handle-firebird-database-connection handle. |
| vres | Query result. |
| query | Contains the unhandled SQL-query (still contains variables like u or c, ...). |
| service | Service name character array. |
| user | Character array which contains username/uid of the user that tries to change password. |
| passwd | The probably hashified password which should be entered into database. |
| rhost | Character array contains name of remote host. 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. |
| int firebird_expand_query |
( |
char ** |
command, |
|
|
const char ** |
values, |
|
|
const char * |
query, |
|
|
const char * |
service, |
|
|
const char * |
user, |
|
|
const char * |
passwd, |
|
|
const char * |
rhost, |
|
|
const char * |
raddr, |
|
|
const modopt_t * |
options | |
|
) |
| | |
Build a SQL-query. This function build a valid SQL-query. Some variables like u for user or c for column_password are substitutet by their meaning.
- Parameters:
-
| command | In this char arry the resulting (expanded) query will be stored. |
| values | Array not used in firebird. |
| query | Contains the unhandled SQL-query (still contains variables like u or c, ...). |
| service | Service name character array. |
| user | Character array which contains username/uid of the user that tries to change password. |
| passwd | The probably hashified password which should be entered into database. |
| rhost | Character array contains name of remote host. This is only needed if you need something like this in your defined queries. |
| raddr | Contains the address of rhost |
| options | Struct which represents exactly one database connection. |
- Returns:
- This function returns the length of the expanded query. So the returnvalue zero indicated the occurrence of an error.
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.