Previous Contents Index Next |
Setup Util Programmer's Guide |
Chapter 16 Setupldap.h Library Reference
This chapter describes setupldap.h, the library containing LDAP functions used by the Common Install Shell. It is divided into the following sections:
General Routines
setupCreateLdap
Creates an LDAP Object. binddn and bindpwd are optional so specify NULL if they are not present.
NSAPI_EXTERN LdapErrorCode setupCreateLdap(Ldap ** ldap,
const char *ldapURL,
const char *ldapUser,
const char *ldapPwd,
const char *binddn,
const char *bindpwd);
setupDestroyLdap
Destroys an LDAP Object.
NSAPI_EXTERN void setupDestroyLdap (Ldap *);
setupGetUserDN
Retrieves the true Bind DN of the LDAP user
NSAPI_EXTERN const char *setupGetUserDN (const Ldap *);
setupGetServerVersion
Retrieves the LDAP server version
NSAPI_EXTERN const char *setupGetServerVersion(const Ldap *);
setupCreateLdapEntry
Creates LdapEntry object.
NSAPI_EXTERN LdapEntry *setupCreateLdapEntry(const Ldap *);
setupDestroyLdapEntry
Destroys LdapEntry object.
NSAPI_EXTERN void setupDestroyLdapEntry(LdapEntry *);
setupGetEntryDN
Retrieves the DN associated with an entry.
NSAPI_EXTERN const char *setupGetEntryDN (const LdapEntry
*ldapEntry);
setupEntryExists
Determines whether an entry (as specified by entryDN) exists.
NSAPI_EXTERN Bool setupEntryExists(LdapEntry *ldapEntry, const char
*entryDN);
setupRetrieveLdapEntry[Entries]
Retrieve one or more LDAP entries from the Directory Server.
NSAPI_EXTERN LdapErrorCode setupRetrieveLdapEntry(LdapEntry
*ldapEntry, const char *entryDN);
NSAPI_EXTERN LdapErrorCode setupRetrieveLdapEntries(LdapEntry
*ldapEntry, const char *criteria, int scope, const char *baseDN);
setupNextLdapEntry
Gets the next LDAP entry from the Directory Server.
NSAPI_EXTERN LdapErrorCode setupNextLdapEntry(LdapEntry *ldapEntry);
setupGetLdapAttributeNames
Gets all the attribute names in this entry Use setupFreeLdapAttributeNames after use to free the returned list.
NSAPI_EXTERN char **setupGetLdapAttributeNames(const LdapEntry *);
NSAPI_EXTERN void setupFreeLdapAttributeNames(LdapEntry *, char
**attrNames);
setupGetLdapAttributes
Given the name of an attribute, returns the NULL terminated list of associated attribute value(s). Use freeAttributes() to free the returned list after use.
NSAPI_EXTERN char **setupGetLdapAttributes(const LdapEntry *, const
char *name);
NSAPI_EXTERN void setupFreeLdapAttributes(LdapEntry *, char
**attributes);
NSAPI_EXTERN const char *setupGetEntryDN(const LdapEntry *);
For a single-value attribute, use setAttribute. For attributes that are typically multivalue, especially objectclass, use setAttributes(). Don't mix setAttribute and setAttributes on the same attribute.
NSAPI_EXTERN void setupSetLdapAttribute(LdapEntry *, const char
*name, const char *value);
NSAPI_EXTERN void setupAddLdapAttribute(LdapEntry *, const char
*name, const char *value);
NSAPI_EXTERN void setupAddLdapAttributes(LdapEntry *, const char
*name,const char **values);
NSAPI_EXTERN LdapErrorCode setupRenameLdapEntry(LdapEntry *, const
char *entryDN, const char *rdn);
NSAPI_EXTERN LdapErrorCode setupInsertLdapEntry(LdapEntry *, const
char *entryDN);
NSAPI_EXTERN LdapErrorCode setupUpdateLdapEntry(LdapEntry *, const
char *entryDN);
NSAPI_EXTERN LdapErrorCode setupReplaceLdapEntry(LdapEntry *, const
char *entryDN);
setupDropLdapEntry
Drops an entry
NSAPI_EXTERN LdapErrorCode setupDropLdapEntry(Ldap *, const char
*entryDN);
setupDropAllLdapEntries
Drops all entries
NSAPI_EXTERN LdapErrorCode setupDropAllLdapEntries(Ldap *, const
char *entryDN);
setupInstallFramework
NSAPI_EXTERN LdapErrorCode setupInstallFramework(const Ldap *, const
char *adminDomain);
createSIE
Registers a Server Instance Entry specified by sieEntry. This entry is associated with the nsApplication specified by isieDN. The entry is inserted at subTreeDN. This routine does the following:
Creates an installed software instance under NetscapeRoot if it has not been created. Otherwise, it updates the entry with appropriate information
Generates the SIE entry's common name to guarantee the uniqueness of the SIE. seeAlso links are created between the SIE and the ISIE. createSIE has the following parameters:
sieEntry: LDAP entry for the SIE
appEntry: LDAP entry for the ISIE
hostName: name of this machine. Does not need to be a Fully Qualified Domain Name (FQDN). If it is not an FQDN, make sure the serverHostName attribute for appEntry is.
installedLocation: location where this product is installed
subTreeDN: the DN of the subtree in which to install the SIE. The default is o=NetscapeRoot, ou=<administration domain>.
objectclass = nsApplication
name = product name. For instance, Netscape Enterprise Server
version = product version. For instance, 4.0a0
other attributes from the Product Information File.
* sieEntry
NSAPI_EXTERN LdapErrorCode setupCreateSIE(
LdapEntry *sieEntry, LdapEntry *appEntry,const char *hostName, const
char *installedLocation, const char *adminDomain);
RemoveSIE
Removes the server instance (and the pointer to it) from ISIE. Optionally, you can set removeISIE to True to remove the ISIE itself. In general, you should set the removeISIE flag to False. Only set it to True when you are writing binary uninstallation code
NSAPI_EXTERN LdapErrorCode setupRemoveSIE(Ldap *, const char *sieDN,
Bool removeISIE);
RemoveISIE
Removes the installed software instance. Only use this function in uninstallation code. You can only remove the ISIE when there are no associated server instances. If possible, this routine will remove the whole SIE hierarchy up to, but not including, netscapeRoot.
NSAPI_EXTERN LdapErrorCode setupRemoveISIE(Ldap *, const char
*isieDN);
updateISIEVersionInfo
Updates ISIE version and product information. This routine is only used by the setup program.
NSAPI_EXTERN LdapErrorCode setupUpdateISIEVersionInfo (Ldap *,
LdapEntry *, const char *productName, const char *hostName, const
char *installedLocation, const char *adminDomainName);
createACIForConfigData
Sets the appropriate access control for the LDAP entry that contains modifiable configuration data. For example, cn=Configuration, cn=sie-cn, ou=Netscape Suitespot, o=example.com. sieDN must be a valid DN for an existing SIE entry.
NSAPI_EXTERN LdapErrorCode setupCreateACIForConfigEntry (LdapEntry
*configEntry, const char *sieDN);
printEntry
Prints entry to fileName. Set fileName to NULL to print to stdout.
NSAPI_EXTERN void setupPrintLdapEntry(const LdapEntry *, const char
*fileName);
verifyLdapUrl
Verifies the validity of an LDAP URL (format, LDAP server, etc...).
NSAPI_EXTERN LdapErrorCode setupVerifyLdapUrl(
const char *url, const char *bindDN, const char *bindPwd);
authLdapUser()
Authenticates an LDAP user. This is a wrapper for createLdap() that does not return an LDAP object.
NSAPI_EXTERN LdapErrorCode setupAuthLdapUser(const char *url, const
char *ldapUser, const char *ldapPwd, const char *bindDN, const
char *bindPwd);
isSubTreeWritable
Tests whether a subtree is writable.
NSAPI_EXTERN LdapErrorCode setupIsSubTreeWritable(const Ldap *,
const char *subTreeDN);
setupUpdateLdifEntries
setupReplaceLdifEntries
Updates or replaces LDAP entries below a given DN. The new entries are specified in an LDIF file. If the entries do not exist, they will be inserted. Otherwise, the entries will be updated using setupUpdateLdifEntries or replaced using setupReplaceLdifEntries. These functions have the following parameters:
Ldap: pointer to a valid Ldap struct
subTreeDN: the DN of the location where the entries will be inserted. If the entry in the LDIF file has a DN attribute, it should be a relative DN as it will be prepended to subTreeDN to form the location where the entry is inserted.
If subTreeDN is NULL, the DN attribute found in the entry will be used as an absolute DN. If subTreeDN is not NULL and there's no DN attribute in the LDIF entry, subTreeDN will be used as an absolute DN. If both subTreeDN and the DN attribute are missing, the entry is skipped.
ldifFile: name of the LDIF file
adminSIEDN: NULL in general. If not NULL, specify the DN of the Admin's SIE to be appended to the values of all className attributes found in the LDIF entries. NSAPI_EXTERN LdapErrorCode setupUpdateLdifEntries (const Ldap *ldap,
const char *subTreeDN, const char *ldifFile, const char
*adminSieDN);
NSAPI_EXTERN LdapErrorCode setupReplaceLdifEntries (const Ldap
*ldap, const char *subTreeDN, const char *ldifFile, const char
*adminSieDN);
NSAPI_EXTERN LdapErrorCode setupInsertSchemaEntries (Ldap *ldap,
const char *schemaFile);
guessAdminDomain
Guesses the Administration Domain that might exist on this Directory Server.
NSAPI_EXTERN char * setupGuessAdminDomainName(const char *ldapURL,
const char *ldapUser, const char *ldapPwd);
checkAdminDomain
Checks the validity of the Administration Domain that exists on this Directory Server.
NSAPI_EXTERN LdapErrorCode setupCheckAdminDomain(const Ldap *ldap,
const char *adminDomain);
addUserDirectory
Configures a domain with a User Directory.
NSAPI_EXTERN LdapErrorCode setupAddGlobalUserDirectory (const Ldap
*ldap, const char *domain, const char *userDirUrl, const char
*bindDN, const char *bindPwd);
getUserDirectory
Gets the user Directory associated with this SIE.
NSAPI_EXTERN LdapErrorCode setupGetUserDirectory(const Ldap *ldap,
const char *sieDN, char **url, char **bindDN, char **bindPwd);
getLocalUserDirectory
Gets the User Directory associated with this server root.
NSAPI_EXTERN LdapErrorCode setupGetLocalUserDirectory (const Ldap *,
const char *domain, const char *hostName, const char *serverRoot,
char **userDirUrl, char **bindDN, char **bindPwd);
getGlobalUserDirectory
Gets the User Directory associated with this domain.
NSAPI_EXTERN LdapErrorCode setupGetGlobalUserDirectory (const Ldap
*, const char *domain, char **userDirUrl, char **bindDN, char
**bindPwd);
NSAPI_EXTERN LdapErrorCode setupCreateSuffix(Ldap *ldap, char
*suffix);
Previous Contents Index Next
Copyright (C) 2005 Red Hat, Inc. All rights reserved.
This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/
Last Updated September 21, 2001