backend_firebird.h File Reference
#include <security/pam_modules.h>
#include <ibase.h>
#include "pam_kmux_options.h"
Go to the source code of this file.
Defines |
| #define | EXPORT |
| #define | ERRDESC(status) |
| #define | SQL_VARCHAR(len) struct {short vary_length; char vary_string[(len)+1];} |
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.
|
Detailed Description
pam_kmux-firebird-API In this file all firebird-pam-kmux-backend-API-functions are defined.
- Author:
- Julian Thome
- Date:
- 2009-11-09
Define Documentation
| #define ERRDESC |
( |
status |
|
) |
|
Value:{ sql_code = isc_sqlcode(status); \
isc_sql_interprete(sql_code,buf, sizeof(buf)); \
logdbg("%s for db (%s:%s)", buf, options->db, options->port); \
}
Macro to log status information of firebird db to syslog
| #define SQL_VARCHAR |
( |
len |
|
) |
struct {short vary_length; char vary_string[(len)+1];} |
Needed to initialize a field which contains the result information
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.