backend_mysql.h File Reference
#include <security/pam_modules.h>
#include <mysql/mysql.h>
#include "pam_kmux_options.h"
Go to the source code of this file.
Functions |
| void * | mysql_db_connect (const modopt_t *options) |
| | Connect to mysql database.
|
| void | mysql_db_disconnect (void *vconn) |
| | Terminate database connection.
|
| int | mysql_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 | mysql_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 mysql database.
|
| int | mysql_backend_authenticate (const char *service, const char *user, const char *passwd, const char *rhost, const modopt_t *options) |
| | Authenticate against mysql backend.
|
Detailed Description
pam_kmux-mysql-API. In this file all mysql-pam-kmux-backend-API-functions are defined.
- Author:
- Julian Thome
- Date:
- 2009-11-11
Function Documentation
| int mysql_backend_authenticate |
( |
const char * |
service, |
|
|
const char * |
user, |
|
|
const char * |
passwd, |
|
|
const char * |
rhost, |
|
|
const modopt_t * |
options | |
|
) |
| | |
Authenticate against mysql 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 gsomething 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* mysql_db_connect |
( |
const modopt_t * |
options |
) |
|
Connect to mysql database.
This functinos establish a mysql 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 MYSQL-database-handle if everything is ok, NULL if something went wrong trying to establish a connection.
| void mysql_db_disconnect |
( |
void * |
vconn |
) |
|
Terminate database connection.
This function takes an MYSQL-database-handle an releases it properly.
- Parameters:
-
| vconn | A connection handle to a mysql database. |
- Returns:
- Nothing to return.
| int mysql_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 mysql 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 | MYSQL-database-connection handle. |
| vres | MYSQL_RES-mysql-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 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. |
| int mysql_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 the value of PAM_RHOST. 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 '0' indicated the occurrence of an error.