summaryrefslogtreecommitdiffstats
path: root/database/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* edb-pgsql: Added the needed authentication functions for the admin modulepgsqlDavid Sommerseth2013-06-132-1/+531
| | | | | | eurephiadm is now able to authenticate, login and logout a user. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Added an update SQL view for eurephia_adminlogDavid Sommerseth2013-06-131-0/+10
| | | | | | | This is to restrict the eurephia-admin database user to only be allowed to update a few fields of the eurephia_adminlog table. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: ePGprepLoadStatements() was missing a break in the switch/case ↵David Sommerseth2013-06-131-0/+1
| | | | | | | | | statment Without this break, this function would return an error that the web or console admin interface were invalid. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Added ePGprepParamsAddArgumentChar()David Sommerseth2013-06-132-0/+10
| | | | | | This is used to add a single char value to the prepared arguments stack. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Added prepared SQL statements needed for the admin authenticationDavid Sommerseth2013-06-132-9/+107
| | | | | | | Aslo moved one query from the "plugin section" to the "admin section" where it belongs. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Added ePGgetValue_bool()David Sommerseth2013-06-132-0/+13
| | | | | | | | This will parse the database result value as a boolean value and return (int) 1 if the value is 't' (true in PostgreSQL). Otherwise the function will return (int) 0. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Added ePGerrorMessageXML() to return PostgreSQL errors in XMLDavid Sommerseth2013-06-132-0/+76
| | | | Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Reworked the prepared statement loadingDavid Sommerseth2013-06-132-49/+106
| | | | | | | | | | | | | | | | Rewrote the loading of prepared statements to be able to switch which statements are loaded, based on the eurephia context type. This ensures that the database connection for the OpenVPN connection will not have any prepared statements related to the administration queries. With this change, it also made sense to replace the ePGprepStatementGetID() function with ePGprepGetStatement() which returns a pointer directly to related statement, instead of looking up the "slot ID" for the requested statement. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Reworked the prepared statements infrastructureDavid Sommerseth2013-06-136-781/+943
| | | | | | | | | | Moved all SQL statements out of each function and into a const struct which is loaded at startup. Implemented a safer way of handling parameters to these prepared statements as well. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: First implementation of all OpenVPN auth related functionsDavid Sommerseth2013-06-131-343/+1043
| | | | | | | | | This is a working implementation of the PostgreSQL driver, where only the driver functions needed by OpenVPN for authentication are implemented. There are still more enhancements to be done, but this is usable. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Add an updatable view for the lastlog tableDavid Sommerseth2013-06-131-0/+15
| | | | | | | This allows the eurephia-auth user to only update the columns in the lastlog which it is supposed to update. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Use correct sessionkey length in macaddr_historyDavid Sommerseth2013-06-131-1/+1
| | | | | | | The macaddr_history table was declared with a too small field for storing session keys. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Change lastlog.sessionduration to intervalDavid Sommerseth2013-06-131-1/+1
| | | | | | PostgreSQL have a better data type for storing session duration. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Correct some wrong table names and referencesDavid Sommerseth2013-06-131-17/+17
| | | | | | | None of the tables used by the edb-pgsql driver uses the 'openvpn_' prefix Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Add an SQL VIEW for updating users.last_accessed more safelyDavid Sommerseth2013-06-131-0/+11
| | | | | | | | It's not ideal to let the eurephia-auth user have write access to the users table. This view will allow the eurephia-auth user only to touch users.last_accessed; and this value will be enforced to be CURRENT_TIMESTAMP. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Renamed local PostgreSQL functionsDavid Sommerseth2013-06-131-36/+36
| | | | | | | | Generic local PostgreSQL functions were prefixed with 'PG'. As this is too close to the prefix PostgreSQL uses, these functions where changed to 'ePG'. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Reworked PostgreSQL error handlingDavid Sommerseth2013-06-131-95/+101
| | | | | | Added a generic error reporting function, to stream line this process. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: Make use of internal PGgetValue() instead of PQgetvalue() in ↵David Sommerseth2013-06-131-3/+3
| | | | | | | | | eDBblacklist_check() PGgetValue() will return NULL if the database field is NULL, which is expected several places in the eDBblacklist_check() function. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* edb-pgsql: The very beginning of a PostgreSQL driverDavid Sommerseth2013-06-133-0/+1422
This is far from production ready, but is the first step. Only tested with initialisation and startup of OpenVPN so far. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>