Skip Headers
Oracle® Fusion Middleware Man Page Reference for Oracle Directory Server Enterprise Edition
11g Release 1 (11.1.1.7.0)

Part Number E28967-01
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

ldapcompare

compare a value with an LDAP entry attribute value

Synopsis

install-path/dsrk/bin/ldapcompare 
 [options] attrtype:attrvalue [dn]...

install-path/dsrk/bin/ldapcompare 
 [options] attrtype::base64value [dn]...

install-path/dsrk/bin/ldapcompare 
 [options] attrtype:<fileurl [dn]...

Description

The ldapcompare command asserts that a value you specify is the same as an entry attribute value stored by the directory server.

Specify the attribute type, followed by the attribute value, either as a string, a base64–encoded value, or a URL to a file containing the attribute value, such as a photo or certificate. You typically enclose the attribute type/value pair in single quotes ('') for the shell.

Also specify one or more entry DNs, separated by space, and typically enclosed in double quotes ("") for the shell. The ldapcompare command then compares the specified attribute value to that of attributes on each of the entries indicated by the DNs you provide.

Options

The following options are supported:

-0

Ignore LDAP library version mismatches.

When this option is omitted, the default behavior is to assert that the revision number of the LDAP API be greater than or equal to that used to compile the tool. Also, if the library and the tool have the same vendor name, the tool will assert that the vendor version number of the API be greater than or equal to that used to compile the tool. Revision and version numbers are based on the contents of the LDAPAPIInfo structure defined in <ldap.h> or header files included by <ldap.h>.

-3

Check host names in SSL certificates.

-D bindDN

Use the specified bind DN to authenticate to the directory server.

If the bind DN and its password are omitted, the ldapcompare command binds anonymously. The bind DN determines what entries and attributes appear in the comparison results, according to the search permissions for the bind DN.

-E

Request that the directories expose (report) bind identities.

-H
-help
--help
-?

Display usage information.

-I filename

Read SSL key password for the client key database specified using the -P option from filename.

The default is key3.db.

-J controloid[:criticality[:value|::base64value|:<fileurl]]

Use the specified control OID.

The criticality, a boolean, is false by default.

An LDAP control can be associated with a value. Proxy authorization takes a proxy authorization ID, for example, passed with the control OID, and criticality. If a value is necessary you specify it using value, base64value, or <fileurl.

-K pathname

Use the SSL key database located in pathname, the full path to the key database file.

The default is to search for the key database file, key3.db, in the directory specified by the -P option.

-M

Manage referrals, comparing the entry containing the referral instead of the entry obtained by following the referral.

-N certificate

Use the specified certificate for certificate-based client authentication, for example: -N "Client-Cert", where Client-Cert is the subject name of the user certificate.

-O limit

Follow at maximum limit referral hops. Default is 5.

-P pathname

Use the certificate database located in pathname, the full path to the certificate database file.

The default is to search for the certificate database file, cert8.db, in the current directory.

-Q [token][:certificate-name]

Use PKCS 11.

-R

Do not follow referrals automatically.

-V n

Use LDAP protocol version n, where n is 2 or 3. Default is 3.

-W -

Prompt for the password for the client key database specified using the -P option.

The -W option is required for certificate-based client authentication.

-W password

Specify the password for the client key database specified using the -P option.

The -W option is required for certificate-based client authentication.

-Y proxydn

Use the rights of the entry having the specified DN for performing LDAP operations. When using this option, you must also specify how to bind before you assume the rights of the proxy. Thus, when using simple authentication, you would also use the -D and -w options with this option.

Before proxy authentication can work in Directory Server, you must set up the appropriate access control instructions.

-Z

Use SSL to provide certificate-based client authentication.

The -Z option requires the -N and -W options and any other SSL options needed to identify the certificate and the key database.

-ZZ

Use Start TLS to provide certificate-based client authentication.

The -ZZ option requires the -N and -W options and any other SSL options needed to identify the certificate and the key database.

-c

Run in continuous mode, not stopping on errors.

In continuous mode, errors are reported but the ldapcompare command continues performing comparisons. When not running in continuous mode, the ldapcompare command quits after the first error.

-d level

Set LDAP debug level to the specified value.

The following debug levels are supported:

1

Display verbose debugging messages; LDAP_DEBUG_TRACE.

2

Display messages about the content of network packets; LDAP_DEBUG_PACKETS.

320

Display messages about LDIF parsing; LDAP_DEBUG_PARSE.

16384

Display informational messages; LDAP_DEBUG_ANY.

Use the sum of the levels to specify more than one debug level. For example, to set the debug level to display both verbose debugging messages, and messages about the content of network packets, specify -d 3.

-f filename

Read DNs from the specified file.

The file format is one DN per line without quotes around DNs. The ldapcompare command reads each line as one literal DN, performing the comparison for each entry whose DN is specified.

-h host

Contact the LDAP server on the specified host, which may be a host name or an IP address. Enclose IPv6 addresses in brackets ([]) as described in RFC 2732.

For example, when mapping the IPv4 address 192.168.0.99 to IPv6, pass the -h option with its argument as -h [::ffff:192.168.0.99]. Notice the brackets.

When using GSSAPI with Directory Server, specify the host as a fully-qualified host name which matches the value of the nsslapd-localhost attribute on the cn=config entry. The GSSAPI authentication process requires that the host name provided by the client match the one provided by the server.

The default is localhost.

-i charset

Use the specified character set to override the value of the LANG environment variable. This option is useful, as the command converts certain arguments you specify to UTF-8 before sending the request to the server. The following arguments are converted: base DN, bind DN, LDAP filter, and password.

You can prevent the command from converting passwords by using the -k option.

Examples of charset values include ISO8859-1, ISO8859-15, ibm-1275, and windows-1251.

-j filename

Read the bind password for simple authentication from the specified file.

-k

Do not convert the passwords to UTF-8.

-m pathname

Use the security module database located in the specified directory.

Use the -m option if the security module database is in a different directory from the certificate database itself.

-n

Show what would be done, but do not actually do it.

-o attrname=attrvalue

Use the specified attribute values when performing SASL authentication.

The following attrname arguments are supported:

authid

Use the specified authentication identity.

authzid

Use the specified authorization identity.

mech

Request the specified SASL mechanism for the bind.

realm

Use the specified realm to complete the bind.

secProp

Use the specified security level.

The attrvalue is a valid value corresponding to the attrname you specify.

-p port

Contact the LDAP server on the specified port.

The default is 389 (636 if SSL is used).

-q

Run in quiet mode, displaying no information about results of comparisons, but only about LDAP errors.

-v

Run in verbose mode, displaying diagnostics on standard output.

-w

Prompt for the bind password for simple authentication.

-w password

Use the specified bind password for simple authentication.

Examples

Examples in this section use the following conventions:

Example 1   Comparing String Values

The following command compares a specified string with an attribute value:

$ ./ldapcompare -h host 'givenname:Barbara' \
"uid=bjensen,ou=People,dc=example,dc=com"
comparing type: "givenname" value: "Barbara" 
 in entry "uid=bjensen,ou=People,dc=example,dc=com"
compare TRUE
Example 2   Comparing Base 64 Encoded Values

The following command compares a base64–encoded value with an attribute value:

$ ./ldapcompare -h host 'cn::QmFicyBKZW5zZW4=' \
"uid=bjensen,ou=People,dc=example,dc=com"
comparing type: "cn" value: "Babs Jensen" 
 in entry "uid=bjensen,ou=People,dc=example,dc=com"
compare TRUE
Example 3   Comparing Binary Values in Files

The following command compares an image with an attribute value:

$ ./ldapcompare -h host 'jpegphoto:<file:///home/bjensen/bjensen.jpg' \
"uid=bjensen,ou=People,dc=example,dc=com"
comparing type: "jpegphoto" value: "NOT ASCII (3674 bytes)" 
 in entry "uid=bjensen,ou=People,dc=example,dc=com"
compare TRUE

Exit Status

The exit status returned either corresponds to 5 (LDAP_COMPARE_FALSE) or 6 (LDAP_COMPARE_TRUE), or reflects the return values of the underlying functions used, which may depend on return values sent by the server. Common exit status codes follow:

1

Server encountered errors while processing the request; LDAP_OPERATIONS_ERROR; 0x01.

2

Server encountered errors, such as a BER-decoding error, while processing the request; LDAP_PROTOCOL_ERROR; 0x02.

3

Search exceeded the time limit for operations on the server; LDAP_TIMELIMIT_EXCEEDED; 0x03.

5

Operation was successful but the values did not match; LDAP_COMPARE_FALSE; 0x05.

6

Operation was successful and the values match; LDAP_COMPARE_TRUE; 0x06.

10

DN of the entry to compare belongs to an entry handled by neither server, and the referral URL identifies another server that handles the entry; LDAP_REFERRAL; 0x0a.

32

DN of the entry to compare belongs to an entry handled by neither server, and no referral URL is available for the entry; LDAP_NO_SUCH_OBJECT; 0x20.

34

DN of the entry to compare is not a valid DN; LDAP_INVALID_DN_SYNTAX; 0x22.

50

Bind DN user does not have permission to read the entry from the directory; LDAP_INSUFFICIENT_ACCESS; 0x32.

81

One of the directories did not respond to the request, or the connection was lost; LDAP_SERVER_DOWN; 0x51.

82

An error occurred while receiving results; LDAP_LOCAL_ERROR; 0x52.

83

The request could not be BER-encoded; LDAP_ENCODING_ERROR; 0x53.

84

A result could not be decoded; LDAP_DECODING_ERROR; 0x54.

89

An option or argument is not valid; LDAP_PARAM_ERROR; 0x59.

90

Needed memory could not be allocated; LDAP_NO_MEMORY; 0x5a.

91

A specified host name or port is not valid; LDAP_CONNECT_ERROR; 0x5b.

92

At least one server supports only LDAPv2, and the -V 2 option was not used, or the -V 2 option was used, but the server no longer supports LDAP v2; LDAP_NOT_SUPPORTED; 0x5c.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE

Availability

SUNWldapcsdk-tools

Stability Level

Evolving


See Also

ldapcmp(1), ldapdelete(1), ldapmodify(1), ldapsearch(1), ldappasswd(1)