|
DTS Application Library
0.2.3
Application library containing referenced objects and interfaces to common libraries
|
Functions to interface with a LDAP server. More...
Files | |
| file | openldap.c |
| Openldap/SASL Implementation. | |
Data Structures | |
| struct | ldap_rdn |
| LDAP Relative distingushed name linked list. More... | |
| struct | ldap_attrval |
| LDAP attribute value. More... | |
| struct | ldap_attr |
| LDAP attirbute. More... | |
| struct | ldap_entry |
| LDAP entry. More... | |
| struct | ldap_results |
| LDAP results. More... | |
| struct | sasl_defaults |
| SASL Paramaters used in authentification. More... | |
| struct | ldap_simple |
| LDAP Simple bind. More... | |
| struct | ldap_conn |
| LDAP connection. More... | |
| struct | ldap_modify |
| LDAP Modify structure. More... | |
| struct | ldap_add |
| LDAP Add structure. More... | |
| struct | ldap_modval |
| Linked list of mod values. More... | |
| struct | ldap_modreq |
| LDAP mod request. More... | |
Typedefs | |
| typedef struct ldap_conn | ldap_conn |
| Forward decleration of structure. More... | |
| typedef struct ldap_modify | ldap_modify |
| Forward decleration of structure. More... | |
| typedef struct ldap_add | ldap_add |
| Forward decleration of structure. More... | |
Enumerations | |
| enum | ldap_starttls { LDAP_STARTTLS_NONE, LDAP_STARTTLS_ATTEMPT, LDAP_STARTTLS_ENFORCE } |
| SSL connection requirements. More... | |
| enum | ldap_attrtype { LDAP_ATTRTYPE_CHAR, LDAP_ATTRTYPE_B64, LDAP_ATTRTYPE_OCTET } |
| LDAP attribute types. More... | |
Functions | |
| struct ldap_conn * | ldap_connect (const char *uri, enum ldap_starttls starttls, int timelimit, int limit, int debug, int *err) |
| Connect to a LDAP server. More... | |
| int | ldap_simplebind (struct ldap_conn *ld, const char *dn, const char *passwd) |
| Bind to the connection with simple bind requireing a distingushed name and password. More... | |
| int | ldap_simplerebind (struct ldap_conn *ldap, const char *initialdn, const char *initialpw, const char *base, const char *filter, const char *uidrdn, const char *uid, const char *passwd) |
| Bind to LDAP connection using rebind. More... | |
| int | ldap_saslbind (struct ldap_conn *ld, const char *mech, const char *realm, const char *authcid, const char *passwd, const char *authzid) |
| Bind to the server with SASL. More... | |
| const char * | ldap_errmsg (int res) |
| Return LDAP error for a ldap error. More... | |
| struct ldap_results * | ldap_search_sub (struct ldap_conn *ld, const char *base, const char *filter, int b64enc, int *res,...) |
| Search LDAP connection subtree. More... | |
| struct ldap_results * | ldap_search_one (struct ldap_conn *ld, const char *base, const char *filter, int b64enc, int *res,...) |
| Search LDAP connection one level. More... | |
| struct ldap_results * | ldap_search_base (struct ldap_conn *ld, const char *base, const char *filter, int b64enc, int *res,...) |
| Search LDAP connection base. More... | |
| void | ldap_unref_attr (struct ldap_entry *entry, struct ldap_attr *attr) |
| Remove a attribute from a entry. More... | |
| void | ldap_unref_entry (struct ldap_results *results, struct ldap_entry *entry) |
| Remove a entry from a result. More... | |
| struct ldap_entry * | ldap_getentry (struct ldap_results *results, const char *dn) |
| Find and return the entry from the results for a specific dn. More... | |
| struct ldap_attr * | ldap_getattr (struct ldap_entry *entry, const char *attr) |
| Find and return attribute in a entry. More... | |
| struct ldap_modify * | ldap_modifyinit (const char *dn) |
| Create a modification reference for a DN. More... | |
| int | ldap_mod_del (struct ldap_modify *lmod, const char *attr,...) |
| Delete values from a attribute. More... | |
| int | ldap_mod_add (struct ldap_modify *lmod, const char *attr,...) |
| Add values to a attribute. More... | |
| int | ldap_mod_rep (struct ldap_modify *lmod, const char *attr,...) |
| Replace a attribute. More... | |
| int | ldap_domodify (struct ldap_conn *ld, struct ldap_modify *lmod) |
| Apply the modification to the server. More... | |
| int | ldap_mod_delattr (struct ldap_conn *ldap, const char *dn, const char *attr, const char *value) |
| Delete a value from a attribute in a DN. More... | |
| int | ldap_mod_remattr (struct ldap_conn *ldap, const char *dn, const char *attr) |
| Delete a attribute from a DN. More... | |
| int | ldap_mod_addattr (struct ldap_conn *ldap, const char *dn, const char *attr, const char *value) |
| Add a value for a attribute in a DN. More... | |
| int | ldap_mod_repattr (struct ldap_conn *ldap, const char *dn, const char *attr, const char *value) |
| Replace the value of a attribute in a DN. More... | |
| struct ldap_add * | ldap_addinit (const char *dn) |
| Create a reference to add a new DN. More... | |
| int | ldap_add_attr (struct ldap_add *ladd, const char *attr,...) |
| Add a attribute to new DN. More... | |
| int | ldap_doadd (struct ldap_conn *ld, struct ldap_add *ladd) |
| Write new DN to server. More... | |
Functions to interface with a LDAP server.
| typedef struct ldap_modify ldap_modify |
| enum ldap_attrtype |
| enum ldap_starttls |
| int ldap_add_attr | ( | struct ldap_add * | ladd, |
| const char * | attr, | ||
| ... | |||
| ) |
Add a attribute to new DN.
| ladd | Reference to new DN structure. |
| attr | Attribute to add. |
| ... | NULL terminated list of values. |
Definition at line 1500 of file openldap.c.
References objunref().
| struct ldap_add* ldap_addinit | ( | const char * | dn | ) |
Create a reference to add a new DN.
| dn | DN to be created. |
Definition at line 1462 of file openldap.c.
References ALLOC_CONST, ldap_add::bl, create_bucketlist(), ldap_add::dn, objalloc(), and objunref().
| struct ldap_conn* ldap_connect | ( | const char * | uri, |
| enum ldap_starttls | starttls, | ||
| int | timelimit, | ||
| int | limit, | ||
| int | debug, | ||
| int * | err | ||
| ) |
Connect to a LDAP server.
| uri | Server to connect too. |
| starttls | Starttls flags to disallow,allow or enforce SSL. |
| timelimit | Query timelimit. |
| limit | Results limit. |
| debug | Set LDAP_OPT_DEBUG_LEVEL and LBER_OPT_DEBUG_LEVEL to this level. |
| err | Pointer to a int that will contain the ldap error on failure. |
Definition at line 335 of file openldap.c.
References ldap_conn::ldap, LDAP_STARTTLS_ENFORCE, LDAP_STARTTLS_NONE, ldap_conn::limit, objalloc(), objunref(), ldap_conn::sasl, ldap_conn::sctrlsp, ldap_conn::timelim, and ldap_conn::uri.
Write new DN to server.
| ld | Reference to connection to the LDAP server. |
| ladd | Reference to new DN to commit to server. |
Definition at line 1526 of file openldap.c.
References ldap_add::bl, bucket_list_cnt(), ldap_add::dn, init_bucket_loop(), ldap_conn::ldap, next_bucket_loop(), objlock(), objunlock(), objunref(), and ldap_conn::sctrlsp.
| int ldap_domodify | ( | struct ldap_conn * | ld, |
| struct ldap_modify * | lmod | ||
| ) |
Apply the modification to the server.
| ld | Reference to LDAP connection. |
| lmod | Reference to modification structure. |
Definition at line 1339 of file openldap.c.
References ldap_modify::bl, bucket_list_cnt(), ldap_modreq::cnt, ldap_modify::dn, init_bucket_loop(), ldap_conn::ldap, next_bucket_loop(), objlock(), objref(), objunlock(), objunref(), and ldap_conn::sctrlsp.
Referenced by ldap_mod_addattr(), ldap_mod_delattr(), and ldap_mod_repattr().
| const char* ldap_errmsg | ( | int | res | ) |
Return LDAP error for a ldap error.
| res | LDAP error id. |
Definition at line 576 of file openldap.c.
| struct ldap_attr* ldap_getattr | ( | struct ldap_entry * | entry, |
| const char * | attr | ||
| ) |
Find and return attribute in a entry.
| entry | Entry to return attribute from. |
| attr | Atttribute to return. |
Definition at line 1108 of file openldap.c.
References ldap_entry::attrs, and bucket_list_find_key().
| struct ldap_entry* ldap_getentry | ( | struct ldap_results * | results, |
| const char * | dn | ||
| ) |
Find and return the entry from the results for a specific dn.
| results | Results to search in. |
| dn | DN search for. |
Definition at line 1096 of file openldap.c.
References bucket_list_find_key(), and ldap_results::entries.
| int ldap_mod_add | ( | struct ldap_modify * | lmod, |
| const char * | attr, | ||
| ... | |||
| ) |
Add values to a attribute.
| lmod | LDAP modification referenece. |
| attr | Attribute to modify. |
| ... | Values to add. |
Definition at line 1238 of file openldap.c.
References objunref().
Referenced by ldap_mod_addattr().
| int ldap_mod_addattr | ( | struct ldap_conn * | ldap, |
| const char * | dn, | ||
| const char * | attr, | ||
| const char * | value | ||
| ) |
Add a value for a attribute in a DN.
| ldap | Reference to the connection. |
| dn | DN to remove values from. |
| attr | Attribute to add value to. |
| value | Value to remove from attribute. |
Definition at line 1416 of file openldap.c.
References ldap_domodify(), ldap_mod_add(), ldap_modifyinit(), and objunref().
| int ldap_mod_del | ( | struct ldap_modify * | lmod, |
| const char * | attr, | ||
| ... | |||
| ) |
Delete values from a attribute.
| lmod | LDAP modification referenece. |
| attr | Attribute to modify. |
| ... | Values to remove. |
Definition at line 1211 of file openldap.c.
References objunref().
Referenced by ldap_mod_delattr().
| int ldap_mod_delattr | ( | struct ldap_conn * | ldap, |
| const char * | dn, | ||
| const char * | attr, | ||
| const char * | value | ||
| ) |
Delete a value from a attribute in a DN.
| ldap | Reference to the connection. |
| dn | DN to remove values from. |
| attr | Attribute to remove values from. |
| value | Value to remove from attribute. |
Definition at line 1384 of file openldap.c.
References ldap_domodify(), ldap_mod_del(), ldap_modifyinit(), and objunref().
Referenced by ldap_mod_remattr().
| int ldap_mod_remattr | ( | struct ldap_conn * | ldap, |
| const char * | dn, | ||
| const char * | attr | ||
| ) |
Delete a attribute from a DN.
| ldap | Reference to the connection. |
| dn | DN to remove attribute from. |
| attr | Attribute to remove. |
Definition at line 1406 of file openldap.c.
References ldap_mod_delattr().
| int ldap_mod_rep | ( | struct ldap_modify * | lmod, |
| const char * | attr, | ||
| ... | |||
| ) |
Replace a attribute.
| lmod | LDAP modification referenece. |
| attr | Attribute to modify. |
| ... | Values to replace. |
Definition at line 1265 of file openldap.c.
References objunref().
Referenced by ldap_mod_repattr().
| int ldap_mod_repattr | ( | struct ldap_conn * | ldap, |
| const char * | dn, | ||
| const char * | attr, | ||
| const char * | value | ||
| ) |
Replace the value of a attribute in a DN.
| ldap | Reference to the connection. |
| dn | DN to replace attribute in. |
| attr | Attribute to replace. |
| value | Value to replace attr with. |
Definition at line 1441 of file openldap.c.
References ldap_domodify(), ldap_mod_rep(), ldap_modifyinit(), and objunref().
| struct ldap_modify* ldap_modifyinit | ( | const char * | dn | ) |
Create a modification reference for a DN.
| dn | DN to modify. |
Definition at line 1118 of file openldap.c.
References ALLOC_CONST, ldap_modify::bl, create_bucketlist(), ldap_modify::dn, objalloc(), and objunref().
Referenced by ldap_mod_addattr(), ldap_mod_delattr(), and ldap_mod_repattr().
| int ldap_saslbind | ( | struct ldap_conn * | ld, |
| const char * | mech, | ||
| const char * | realm, | ||
| const char * | authcid, | ||
| const char * | passwd, | ||
| const char * | authzid | ||
| ) |
Bind to the server with SASL.
| ld | Reference to LDAP connection. |
| mech | SASL mechanisim. |
| realm | SASL realm. |
| authcid | SASL auth id. |
| passwd | Password for authid. |
| authzid | Proxy authid. |
Definition at line 524 of file openldap.c.
References ALLOC_CONST, sasl_defaults::authcid, sasl_defaults::authzid, ldap_conn::ldap, sasl_defaults::mech, objalloc(), objlock(), objref(), objunlock(), objunref(), sasl_defaults::passwd, sasl_defaults::realm, ldap_conn::sasl, and ldap_conn::sctrlsp.
| struct ldap_results* ldap_search_base | ( | struct ldap_conn * | ld, |
| const char * | base, | ||
| const char * | filter, | ||
| int | b64enc, | ||
| int * | res, | ||
| ... | |||
| ) |
Search LDAP connection base.
| ld | Reference to LDAP connection. |
| base | Search base dn. |
| filter | Search filter. |
| b64enc | Base 64 encode attributes. |
| res | Pointer containing LDAP error. |
| ... | NULL termincated list of attributes to include. |
Definition at line 669 of file openldap.c.
| struct ldap_results* ldap_search_one | ( | struct ldap_conn * | ld, |
| const char * | base, | ||
| const char * | filter, | ||
| int | b64enc, | ||
| int * | res, | ||
| ... | |||
| ) |
Search LDAP connection one level.
| ld | Reference to LDAP connection. |
| base | Search base dn. |
| filter | Search filter. |
| b64enc | Base 64 encode attributes. |
| res | Pointer containing LDAP error. |
| ... | NULL termincated list of attributes to include. |
Definition at line 635 of file openldap.c.
| struct ldap_results* ldap_search_sub | ( | struct ldap_conn * | ld, |
| const char * | base, | ||
| const char * | filter, | ||
| int | b64enc, | ||
| int * | res, | ||
| ... | |||
| ) |
Search LDAP connection subtree.
| ld | Reference to LDAP connection. |
| base | Search base dn. |
| filter | Search filter. |
| b64enc | Base 64 encode attributes. |
| res | Pointer containing LDAP error. |
| ... | NULL termincated list of attributes to include. |
Definition at line 601 of file openldap.c.
Referenced by ldap_simplerebind().
| int ldap_simplebind | ( | struct ldap_conn * | ld, |
| const char * | dn, | ||
| const char * | passwd | ||
| ) |
Bind to the connection with simple bind requireing a distingushed name and password.
| ld | LDAP connection to bind to. |
| dn | Distinguished name to bind with. |
| passwd | Password for dn. |
Definition at line 434 of file openldap.c.
References ldap_simple::cred, ldap_simple::dn, ldap_conn::ldap, objalloc(), objlock(), objref(), objunlock(), objunref(), ldap_conn::sctrlsp, and ldap_conn::simple.
Referenced by ldap_simplerebind().
| int ldap_simplerebind | ( | struct ldap_conn * | ldap, |
| const char * | initialdn, | ||
| const char * | initialpw, | ||
| const char * | base, | ||
| const char * | filter, | ||
| const char * | uidrdn, | ||
| const char * | uid, | ||
| const char * | passwd | ||
| ) |
Bind to LDAP connection using rebind.
Bind to a connection with a lower privlidge distingushed name and password search for a user dn, bind to the connection with the retrieved dn and user password.
| ldap | LDAP connection to bind too. |
| initialdn | Initial dn to bind with. |
| initialpw | Password for the initial dn. |
| base | Search base to find user. |
| filter | LDAP filter to apply to find user. |
| uidrdn | Attribute containing user id. |
| uid | To search and bind as. |
| passwd | Password for the user id. |
Definition at line 478 of file openldap.c.
References ldap_results::count, ldap_entry::dn, ldap_results::first_entry, ldap_search_sub(), ldap_simplebind(), objref(), and objunref().
| void ldap_unref_attr | ( | struct ldap_entry * | entry, |
| struct ldap_attr * | attr | ||
| ) |
Remove a attribute from a entry.
| entry | The entry to remove attr from. |
| attr | Attribute to remove. |
Definition at line 1059 of file openldap.c.
References ldap_entry::attrs, ldap_entry::first_attr, ldap_attr::next, objcnt(), objunref(), and remove_bucket_item().
| void ldap_unref_entry | ( | struct ldap_results * | results, |
| struct ldap_entry * | entry | ||
| ) |
Remove a entry from a result.
| results | The result to remove entry from. |
| entry | Entry to remove. |
Definition at line 1077 of file openldap.c.
References ldap_results::entries, ldap_results::first_entry, ldap_entry::next, objcnt(), objunref(), and remove_bucket_item().