Defines | Functions

usercerts.c File Reference

Functions for working with the openvpn_usercerts table. More...

#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <libxml/tree.h>
#include <sqlite3.h>
#include <eurephia_nullsafe.h>
#include <eurephia_context.h>
#include <eurephia_log.h>
#include <eurephia_xml.h>
#include <eurephia_values.h>
#include <eurephiadb_session_struct.h>
#include <eurephiadb_mapping.h>
#include "../sqlite.h"
#include "../fieldmapping.h"
Include dependency graph for usercerts.c:

Go to the source code of this file.

Functions

xmlDoc * usercerts_search (eurephiaCTX *ctx, eDBfieldMap *where_m, const char *sortkeys)
xmlDoc * usercerts_add_del (eurephiaCTX *ctx, const char *mode, eDBfieldMap *usrcrt_m)
xmlDoc * usercerts_update (eurephiaCTX *ctx, const char *uicid, eDBfieldMap *usrcrt_m)
xmlDoc * eDBadminUserCertsLink (eurephiaCTX *ctx, xmlDoc *usrcrt_xml)

Detailed Description

Functions for working with the openvpn_usercerts table.

Author:
David Sommerseth <dazo@users.sourceforge.net>
Date:
2009-08-29

Definition in file usercerts.c.


Function Documentation

xmlDoc* eDBadminUserCertsLink ( eurephiaCTX ctx,
xmlDoc *  usrcrt_xml 
)

Retrieve, add, modify or delete user/certificate links

Version:
API version level 2
Parameters:
ctx eurephiaCTX
usrcrt_xml XML document containing operation information

Skeleton of needed XML document

    <eurephia format="1">
        <usercerts mode="{search|register|remove|update}" [uicid="{uicid}"]>
            <fieldMapping table="usercerts">
               <{field name}>{search value}</{field name}>
            </fieldMapping>
            [<sortfields>{field name}[, {field name},...]</sortfields>] <!-- Only for mode='search' -->
        </usercerts
    </eurephia>

In search mode, it can be several field name tags to narrow the search. If mode is 'update' the 'uicid' attribute must be present in the usercerts tag.

Returns:
Returns a valid eurephia XML document on success. If errors happened, either an XML document with an error message will be returned or NULL.
See also:
eurephiaXML_CreateDoc(), eurephiaXML_getRoot()

< Messages intended when debugging. Only for log level > 10

< The context is used via the eurephiadm console utility

< The context is used via a web based utility

< Alias for LOG_CRITICAL

< Operation failed and might have been aborted. Log level always 0

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

Definition at line 249 of file usercerts.c.

Here is the call graph for this function:

xmlDoc* usercerts_add_del ( eurephiaCTX ctx,
const char *  mode,
eDBfieldMap usrcrt_m 
)

Internal function. Adds or deletes a user-certificate link

Parameters:
ctx eurephiaCTX
mode String containing the operation mode. Must be "register" or "remove"
usrcrt_m eDBfieldMap containing information about the link to add or remove
Returns:
Returns an eurephia ResultMsg XML document, with success message or an error message

< Messages intended when debugging. Only for log level > 10

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

Definition at line 147 of file usercerts.c.

Here is the call graph for this function:

Here is the caller graph for this function:

xmlDoc* usercerts_search ( eurephiaCTX ctx,
eDBfieldMap where_m,
const char *  sortkeys 
)

Internal function. Queries the database for a list of user-certificate links

Parameters:
ctx eurephiaCTX
where_m eDBfieldMap containing the search criteria
sortkeys String containing the sort order of the data
Returns:
Returns a valid eurephia XML document on success, otherwise NULL

< Messages intended when debugging. Only for log level > 10

< The context is used via the eurephiadm console utility

< The context is used via a web based utility

< Alias for LOG_CRITICAL

< Operation failed and might have been aborted. Log level always 0

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

Definition at line 62 of file usercerts.c.

Here is the call graph for this function:

Here is the caller graph for this function:

xmlDoc* usercerts_update ( eurephiaCTX ctx,
const char *  uicid,
eDBfieldMap usrcrt_m 
)

Internal function. Updates a user-certs link in the database

Parameters:
ctx eurephiaCTX
uicid String containing the numeric record ID (uicid field) of the record to be updated
usrcrt_m eDBfieldMap containing the new information for the record. Only the fields being changed needs to be set.
Returns:
Returns an eurephia ResultMsg XML document, with success message or an error message

< Messages intended when debugging. Only for log level > 10

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

Definition at line 199 of file usercerts.c.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines