diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-25 15:25:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:35 -0500 |
commit | 9bf5e494f7ccbb2a9587dce961a99fa07392bf97 (patch) | |
tree | 556785b1c4fcf4f184d796c6e8a0f3e32b7daff6 /source4/lib/ldb/ldb_map/ldb_map.h | |
parent | 05065108f4da76e6152b9f75fc266d15c316c32d (diff) | |
download | samba-9bf5e494f7ccbb2a9587dce961a99fa07392bf97.tar.gz samba-9bf5e494f7ccbb2a9587dce961a99fa07392bf97.tar.bz2 samba-9bf5e494f7ccbb2a9587dce961a99fa07392bf97.zip |
r9616: Finish ldb_map module (still needs a lot of testing though...)
Add initial mapping table for ldb_samba3. Contains most attributes.
(This used to be commit b73441b04d048919e95ee7f7bcae330c4dafefe7)
Diffstat (limited to 'source4/lib/ldb/ldb_map/ldb_map.h')
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map.h | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/source4/lib/ldb/ldb_map/ldb_map.h b/source4/lib/ldb/ldb_map/ldb_map.h index 3ebf2fa9d1..da3198429d 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.h +++ b/source4/lib/ldb/ldb_map/ldb_map.h @@ -25,9 +25,88 @@ #ifndef __LDB_MAP_H__ #define __LDB_MAP_H__ -struct ldb_map_mappings +/* ldb_map is a skeleton LDB module that can be used for any other modules + * that need to map attributes. + * + * The term 'remote' in this header refers to the connection where the + * original schema is used on while 'local' means the local connection + * that any upper layers will use. + * + * All local attributes will have to have a definition. Not all remote + * attributes need a definition as LDB is a lot less stricter then LDAP + * (in other words, sending unknown attributes to an LDAP server hurts us, + * returning too much attributes in ldb_search() doesn't) + */ + +struct ldb_map_attribute { + const char *local_name; /* local name */ + + enum { + MAP_IGNORE, /* Ignore this local attribute. Doesn't exist remotely. */ + MAP_KEEP, /* Keep as is */ + MAP_RENAME, /* Simply rename the attribute. Name changes, data is the same */ + MAP_CONVERT, /* Rename + convert data */ + MAP_GENERATE /* Use generate function for generating new name/data. + Used for generating attributes based on + multiple remote attributes. */ + } type; + + /* if set, will be called for expressions that contain this attribute */ + struct ldb_parse_tree *(*convert_operator) (TALLOC_CTX *ctx, const struct ldb_parse_tree *); + + union { + struct { + const char *remote_name; + } rename; + + struct { + const char *remote_name; + struct ldb_message_element *(*convert_local) ( + TALLOC_CTX *ctx, + const char *remote_attr, + const struct ldb_message_element *); + + struct ldb_message_element *(*convert_remote) ( + TALLOC_CTX *ctx, + const char *local_attr, + const struct ldb_message_element *); + } convert; + + struct { + /* Generate the local attribute from remote message */ + struct ldb_message_element *(*generate_local) ( + TALLOC_CTX *ctx, + const char *attr, + const struct ldb_message *remote); + + /* Update remote message with information from local message */ + void (*generate_remote) ( + const char *local_attr, + const struct ldb_message *local, + struct ldb_message *remote); + + /* Name(s) for this attribute on the remote server. This is an array since + * one local attribute's data can be split up into several attributes + * remotely */ + const char *remote_names[]; + } generate; + } u; }; +struct ldb_map_objectclass +{ + const char *local_name; + const char *remote_name; +}; + +/* Base ldb_map struct. Fill this in to create a mapping backend */ +struct ldb_map_mappings +{ + const char *name; + const struct ldb_map_attribute *attribute_maps[]; +}; + + #endif /* __LDB_MAP_H__ */ |