mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 07:39:35 -05:00
Now related ITSes need be audited and possibly closed.
Enhancements:
- re-styled code for better readability
- upgraded backend API to reflect recent changes
- LDAP schema is checked when loading SQL/LDAP mapping
- AttributeDescription/ObjectClass pointers used for more efficient
mapping lookup
- bervals used where string length is required often
- atomized write operations by committing at the end of each operation
and defaulting connection closure to rollback
- added LDAP access control to write operations
- fully implemented modrdn (with rdn attrs change, deleteoldrdn,
access check, parent/children check and more)
- added parent access control, children control to delete operation
- added structuralObjectClass operational attribute check and
value return on search
- added hasSubordinate operational attribute on demand
- search limits are appropriately enforced
- function backsql_strcat() has been made more efficient
- concat function has been made configurable by means of a pattern
- added config switches:
- fail_if_no_mapping write operations fail if there is no mapping
- has_ldapinfo_dn_ru overrides autodetect
- concat_pattern a string containing two '?' is used
(note that "?||?" should be more portable
than builtin function "CONCAT(?,?)")
- strcast_func cast of string constants in "SELECT DISTINCT statements (needed by PostgreSQL)
- upper_needs_cast cast the argument of upper when required
(basically when building dn substring queries)
Todo:
- add security checks for SQL statements that can be injected (?)
- re-test with previously supported RDBMs
- replace dn_ru and so with normalized dn (no need for upper() and so
in dn match)
- implement a backsql_normalize() function to replace the upper()
conversion routines
- note that subtree deletion, subtree renaming and so could be easily
implemented (rollback and consistency checks are available :)
- implement "lastmod" and other operational stuff (ldap_entries table ?)
90 lines
3 KiB
C
90 lines
3 KiB
C
#ifndef __BACKSQL_SCHEMA_MAP_H__
|
|
#define __BACKSQL_SCHEMA_MAP_H__
|
|
|
|
/*
|
|
* Copyright 1999, Dmitry Kovalev <mit@openldap.org>, All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms are permitted only
|
|
* as authorized by the OpenLDAP Public License. A copy of this
|
|
* license is available at http://www.OpenLDAP.org/license.html or
|
|
* in file LICENSE in the top-level directory of the distribution.
|
|
*/
|
|
|
|
typedef struct {
|
|
/*
|
|
* FIXME: we explicitly keep the objectClass name because
|
|
* the ObjectClass structure does not use bervals (yet?)
|
|
*/
|
|
struct berval name;
|
|
/*
|
|
* Structure of corresponding LDAP objectClass definition
|
|
*/
|
|
ObjectClass *oc;
|
|
struct berval keytbl;
|
|
struct berval keycol;
|
|
/* expected to return keyval of newly created entry */
|
|
char *create_proc;
|
|
/* in case create_proc does not return the keyval of the newly
|
|
* created row */
|
|
char *create_keyval;
|
|
/* supposed to expect keyval as parameter and delete
|
|
* all the attributes as well */
|
|
char *delete_proc;
|
|
/* flags whether delete_proc is a function (whether back-sql
|
|
* should bind first parameter as output for return code) */
|
|
int expect_return;
|
|
unsigned long id;
|
|
Avlnode *attrs;
|
|
} backsql_oc_map_rec;
|
|
|
|
typedef struct {
|
|
/* Description of corresponding LDAP attribute type */
|
|
AttributeDescription *ad;
|
|
struct berval from_tbls;
|
|
struct berval join_where;
|
|
struct berval sel_expr;
|
|
/* supposed to expect 2 binded values: entry keyval
|
|
* and attr. value to add, like "add_name(?,?,?)" */
|
|
char *add_proc;
|
|
/* supposed to expect 2 binded values: entry keyval
|
|
* and attr. value to delete */
|
|
char *delete_proc;
|
|
/* for optimization purposes attribute load query
|
|
* is preconstructed from parts on schemamap load time */
|
|
char *query;
|
|
/* following flags are bitmasks (first bit used for add_proc,
|
|
* second - for delete_proc) */
|
|
/* order of parameters for procedures above;
|
|
* 1 means "data then keyval", 0 means "keyval then data" */
|
|
int param_order;
|
|
/* flags whether one or more of procedures is a function
|
|
* (whether back-sql should bind first parameter as output
|
|
* for return code) */
|
|
int expect_return;
|
|
/* TimesTen */
|
|
struct berval sel_expr_u;
|
|
} backsql_at_map_rec;
|
|
|
|
/* defines to support bitmasks above */
|
|
#define BACKSQL_ADD 0x1
|
|
#define BACKSQL_DEL 0x2
|
|
|
|
#define BACKSQL_IS_ADD(x) ( BACKSQL_ADD & (x) )
|
|
#define BACKSQL_IS_DEL(x) ( BACKSQL_DEL & (x) )
|
|
|
|
#define BACKSQL_NCMP(v1,v2) ber_bvcmp((v1),(v2))
|
|
|
|
int backsql_load_schema_map( backsql_info *si, SQLHDBC dbh );
|
|
/* Deprecated */
|
|
backsql_oc_map_rec *backsql_name2oc( backsql_info *si, struct berval *oc_name );
|
|
backsql_oc_map_rec *backsql_oc2oc( backsql_info *si, ObjectClass *oc );
|
|
backsql_oc_map_rec *backsql_id2oc( backsql_info *si, unsigned long id );
|
|
/* Deprecated */
|
|
backsql_at_map_rec *backsql_name2at( backsql_oc_map_rec *objclass,
|
|
struct berval *at_name );
|
|
backsql_at_map_rec *backsql_ad2at( backsql_oc_map_rec *objclass,
|
|
AttributeDescription *ad );
|
|
int backsql_destroy_schema_map( backsql_info *si );
|
|
|
|
#endif /* __BACKSQL_SCHEMA_MAP_H__ */
|
|
|