'\" te
.\" Copyright (C) 1990, Regents of the University of Michigan.  All Rights Reserved.
.\" Portions Copyright (C) 2004, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ldapmodify 1 "15 Jan 2004" "SunOS 5.11" "User Commands"
.SH NAME
ldapmodify, ldapadd \- ldap entry addition and modification tools
.SH SYNOPSIS
.LP
.nf
\fBldapmodify\fR [\fB-a\fR] [\fB-c\fR] [\fB-r\fR] [\fB-n\fR] [\fB-v\fR] [\fB-F\fR] [\fB-b\fR] [\fB-A\fR] [\fB-q\fR] 
     [\fB-H\fR] [\fB-?\fR] [\fB-E\fR] [\fB-J\fR] [\fB-Z\fR] [\fB-M\fR] [\fB-d\fR \fIdebuglevel\fR] 
     [\fB-D\fR \fIbindDN\fR] [\fB-j\fR \fIfilename\fR] [\fB-J\fR [:\fIcriticality\fR]] 
     [\fB-B\fR \fIbaseDN\fR] [\fB-V\fR \fIversion\fR] [\fB-Y\fR \fIproxyDN\fR] [\fB-O\fR \fIhopLimit\fR] 
     [\fB-i\fR \fIlocale\fR] [\fB-k\fR \fIpath\fR] [\fB-e\fR \fIerrorFile\fR] [\fB-P\fR \fIpath\fR] 
     [\fB-N\fR \fIcertificate\fR] [\fB-w\fR \fIpasswd\fR] [\fB-o\fR \fIattributename\fR=\fIvalue\fR] 
     [\fB-h\fR \fIldaphost\fR] [\fB-W\fR \fIpassword\fR] [\fB-p\fR \fIldapport\fR] [\fB-f\fR \fIfile\fR] 
     [\fB-l\fR \fInb-ldap-connections\fR]
.fi

.LP
.nf
\fBldapadd\fR [\fB-c\fR] [\fB-n\fR] [\fB-v\fR] [\fB-F\fR] 
     [ [\fB-b\fR] [\fB-A\fR] [\fB-q\fR] [\fB-H\fR] [\fB-?\fR] [\fB-E\fR] [\fB-J\fR] [\fB-Z\fR] [\fB-M\fR]\fB-d\fR \fIdebuglevel\fR] 
     [\fB-D\fR \fIbindDN\fR] [\fB-j\fR \fIfilename\fR] [\fB-B\fR \fIbaseDN\fR] [\fB-V\fR \fIversion\fR] 
     [\fB-Y\fR \fIproxyDN\fR] [\fB-O\fR \fIhopLimit\fR] [\fB-i\fR \fIlocale\fR] [\fB-k\fR \fIpath\fR] 
     [\fB-e\fR \fIerrorFile\fR] [\fB-P\fR \fIpath\fR] [\fB-N\fR \fIcertificate\fR] [\fB-w\fR \fIpasswd\fR] 
     [\fB-o\fR \fIattributename\fR=\fIvalue\fR] [\fB-h\fR \fIldaphost\fR] [\fB-W\fR \fIpassword\fR] 
     [\fB-p\fR \fIldapport\fR] [\fB-f\fR \fIfile\fR] [\fB-l\fR \fInb-ldap-connections\fR]
.fi

.SH DESCRIPTION
.sp
.LP
The \fBldapmodify\fR utility opens a connection to an \fBLDAP\fR server, binds
and modifies or adds entries. The entry information is read from standard input
or from \fIfile\fR, specified using the \fB-f\fR option. The \fBldapadd\fR
utility is implemented as a hard link to the \fBldapmodify\fR tool. When
invoked as \fBldapadd\fR, the \fB-a\fR (add new entry) option is turned on
automatically.
.sp
.LP
Both \fBldapadd\fR and \fBldapmodify\fR reject duplicate attribute-name/value
pairs for the same entry.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fB-a\fR\fR
.ad
.sp .6
.RS 4n
Adds new entries. The default for \fBldapmodify\fR is to modify existing
entries. If invoked as \fBldapadd\fR, this option is always set.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-A\fR\fR
.ad
.sp .6
.RS 4n
Non-ASCII mode: display non-ASCII values, in conjunction with the \fB-v\fR
option.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-b\fR\fR
.ad
.sp .6
.RS 4n
Handle binary files. The \fBldapmodify\fR tool will scan every attribute value
in the input to determine whether it is a valid file reference. If the
reference is valid, it will use the contents of the file as the attribute's
value. This option is used to input binary data, such as a JPEG image, for an
attribute. For example, the corresponding LDIF input would be: "\fB jpegPhoto:
/tmp/photo.jpg\fR" The \fBldapmodify\fR tool also supports the LDIF \fB:<
\fIURL\fR\fR notation for directly including file contents.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-B\fR\ \fIbaseDN\fR\fR
.ad
.sp .6
.RS 4n
Specify the base DN when performing additions, usually in double quotes
(\fB""\fR) for the shell. All entries will be placed under this suffix, thus
providing bulk import functionality.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-c\fR\fR
.ad
.sp .6
.RS 4n
Specifies continuous operation mode. Errors are reported, but \fBldapmodify\fR
and  \fBldapadd\fR continue with modifications. The default is to exit after
reporting an error.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-D\fR \fIbindDN\fR \fR
.ad
.sp .6
.RS 4n
Uses the distinguished name \fIbindDN\fR to bind to the directory.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-d\fR \fIdebuglevel\fR\fR
.ad
.sp .6
.RS 4n
Sets the \fBLDAP\fR debugging level. Useful levels of debugging for
\fBldapmodify\fR and \fBldapadd\fR are:
.sp
.ne 2
.mk
.na
\fB\fB1\fR\fR
.ad
.RS 7n
.rt  
Trace
.RE

.sp
.ne 2
.mk
.na
\fB\fB2\fR\fR
.ad
.RS 7n
.rt  
Packets
.RE

.sp
.ne 2
.mk
.na
\fB\fB4\fR\fR
.ad
.RS 7n
.rt  
Arguments
.RE

.sp
.ne 2
.mk
.na
\fB\fB32\fR\fR
.ad
.RS 7n
.rt  
Filters
.RE

.sp
.ne 2
.mk
.na
\fB\fB128\fR\fR
.ad
.RS 7n
.rt  
Access control
.RE

To request more than one category of debugging information, add the masks. For
example, to request trace and filter information, specify a \fIdebuglevel\fR of
33.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-e\fR\ \fIerrorFile\fR\fR
.ad
.sp .6
.RS 4n
Invalid update statements in the input will be copied to the \fIerrorFile\fR
for debugging. Use with the \fB-c\fR option to correct errors when processing
large LDIF input.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-E\fR\fR
.ad
.sp .6
.RS 4n
Ask server to expose (report) bind identity by means of authentication response
control.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-F\fR\fR
.ad
.sp .6
.RS 4n
Forces application of all changes regardless of the content of input lines that
begin with \fBreplica:\fR. By default, \fBreplica:\fR lines are compared
against the \fBLDAP\fR server host and port in use to decide whether a replog
record should be applied.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-f\fR \fIfile\fR\fR
.ad
.sp .6
.RS 4n
Reads the entry modification information from \fIfile\fR instead of from
standard input.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-?\fR\fR
.ad
.sp .6
.RS 4n
Display the usage help text that briefly describes all options.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-H\fR\fR
.ad
.sp .6
.RS 4n
Display the usage help text that briefly describes all options.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-h\fR \fIldaphost\fR\fR
.ad
.sp .6
.RS 4n
Specifies an alternate host on which the LAPD server is running.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-i\fR \fIlocale\fR\fR
.ad
.sp .6
.RS 4n
Specify the character set to use for the \fB-f\fR \fILDIFfile\fR or standard
input. The default is the character set specified in the \fBLANG\fR environment
variable. You might choose to use this option to perform the conversion from
the specified character set to UTF8, thus overriding the \fBLANG\fR setting.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-j\fR \fIfilename\fR\fR
.ad
.sp .6
.RS 4n
Specify a file containing the password for the bind DN or the password for the
SSL client's key database. To protect the password, use this option in scripts
and place the password in a secure file. This option is mutually exclusive of
the \fB-w\fR and \fB-W\fR options.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-J\fR [:\fIcriticality\fR[:\fIvalue\fR|::\fIb64value\fR|\fIb64value\fR|:\
fIfileurl\fR]]\fR
.ad
.sp .6
.RS 4n
Criticality is a boolean value (default is \fBfalse\fR).
.RE

.sp
.ne 2
.mk
.na
\fB\fB-k\fR \fIpath\fR\fR
.ad
.sp .6
.RS 4n
Specify the path to a directory containing conversion routines. These routines
are used if you want to specify a locale that is not supported by default by
your directory server. This is for NLS support.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-l\fR\fI nb-ldap-connections\fR\fR
.ad
.sp .6
.RS 4n
Specifies the number of \fBLDAP\fR connections that \fBldapadd\fR or
\fBldapmodify\fR will open to process the modifications in the directory. The
default is one connection.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-M\fR\fR
.ad
.sp .6
.RS 4n
Manage smart referrals. When they are the target of the operation, modify the
entry containing the referral instead of the entry obtained by following the
referral.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-n\fR \fR
.ad
.sp .6
.RS 4n
Previews modifications, but makes no changes to entries. Useful in conjunction
with \fB-v\fR and \fB-d\fR for debugging.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-N\fR \fIcertificate\fR\fR
.ad
.sp .6
.RS 4n
Specify the certificate name to use for certificate-based client
authentication. For example: \fB-N\fR \fB"Directory-Cert"\fR.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-o\fR \fIattributename\fR=\fIvalue\fR\fR
.ad
.sp .6
.RS 4n
For SASL mechanisms and other options such as security properties, mode of
operation, authorization ID, authentication ID, and so forth.
.sp
The different attribute names and their values are as follows:
.sp
.ne 2
.mk
.na
\fB\fBsecProp\fR=\fI"number"\fR\fR
.ad
.RS 20n
.rt  
For defining SASL security properties.
.RE

.sp
.ne 2
.mk
.na
\fB\fBrealm\fR=\fI"value"\fR\fR
.ad
.RS 20n
.rt  
Specifies SASL realm (default is \fBrealm=none\fR).
.RE

.sp
.ne 2
.mk
.na
\fB\fBauthzid\fR=\fI"value"\fR\fR
.ad
.RS 20n
.rt  
Specify the authorization ID name for SASL bind.
.RE

.sp
.ne 2
.mk
.na
\fB\fBauthid\fR=\fI"value"\fR\fR
.ad
.RS 20n
.rt  
Specify the authentication ID for SASL bind.
.RE

.sp
.ne 2
.mk
.na
\fB\fBmech\fR=\fI"value"\fR\fR
.ad
.RS 20n
.rt  
Specifies the various SASL mechanisms.
.RE

.RE

.sp
.ne 2
.mk
.na
\fB\fB-O\fR \fIhopLimit\fR\fR
.ad
.sp .6
.RS 4n
Specify the maximum number of referral hops to follow while finding an entry to
modify. By default, there is no limit.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-p\fR \fIldapport\fR \fR
.ad
.sp .6
.RS 4n
Specifies an alternate \fBTCP\fR port where the secure LDAP server is
listening.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-P\fR \fIpath\fR\fR
.ad
.sp .6
.RS 4n
Specify the path and filename of the client's certificate database. For
example:
.sp
.in +2
.nf
-P /home/uid/.netscape/cert7.db
.fi
.in -2

When using the command on the same host as the directory server, you can use
the server's own certificate database. For example:
.sp
.in +2
.nf
-P \fIinstallDir\fR/lapd-serverID/alias/cert7.db
.fi
.in -2

Use the \fB-P\fR option alone to specify server authentication only.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-r\fR \fR
.ad
.sp .6
.RS 4n
Replaces existing value with the specified value. This is the default for
\fBldapmodify\fR. When \fBldapadd\fR is called, or if the \fB-a\fR option is
specified, the \fB-r\fR option is ignored.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-v\fR \fR
.ad
.sp .6
.RS 4n
Uses verbose mode, with diagnostics written to standard output.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-V\fR \fIversion\fR\fR
.ad
.sp .6
.RS 4n
Specify the LDAP protocol version number to be used for the delete operation,
either 2 or 3. LDAP v3 is the default. Specify LDAP v2 when connecting to
servers that do not support v3.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-W\fR \fIpassword\fR\fR
.ad
.sp .6
.RS 4n
Specify the password for the client's key database given in the \fB-P\fR
option. This option is required for certificate-based client authentication.
Specifying \fIpassword\fR on the command line has security issues because the
password can be seen by others on the system by means of the \fBps\fR command.
Use the \fB-j\fR instead to specify the password from the file. This option is
mutually exclusive of \fB-j\fR.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-w\fR \fIpasswd\fR \fR
.ad
.sp .6
.RS 4n
Use \fIpasswd\fR as the password for authentication to the directory. When you
use \fB-w\fR\fI passwd\fR to specify the password to be used for
authentication, the password is visible to other users of the system by means
of the \fBps\fR command, in script files or in shell history. If you use either
the \fBldapmodify\fR command or the \fBldapadd\fR command without this option,
the command will prompt for the password and read it from standard in. When
used without the \fB-w\fR option, the password will not be visible to other
users.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-Y\fR \fIproxyid\fR\fR
.ad
.sp .6
.RS 4n
Specify the proxy DN (proxied authorization id) to use for the modify
operation, usually in double quotes ("") for the shell.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-Z\fR\fR
.ad
.sp .6
.RS 4n
Specify that SSL be used to provide certificate-based client authentication.
This option requires the \fB-N\fR and SSL password and any other of the SSL
options needed to identify the certificate and the key database.
.RE

.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.mk
.na
\fB\fB0\fR \fR
.ad
.RS 13n
.rt  
Successful completion.
.RE

.sp
.ne 2
.mk
.na
\fBNon-zero \fR
.ad
.RS 13n
.rt  
An error occurred. A diagnostic message is written to standard error.
.RE

.SH EXAMPLES
.sp
.LP
The format of the content of \fIfile\fR (or standard input if no \fB-f\fR
option is specified) is illustrated in the following examples.
.LP
\fBExample 1 \fRModifying an Entry
.sp
.LP
The file \fB/tmp/entrymods\fR contains the following modification instructions:

.sp
.in +2
.nf
     dn: cn=Modify Me, o=XYZ, c=US
    changetype: modify
    replace: mail
    mail: modme@atlanta.xyz.com
    -
    add: title
    title: System Manager
    -
    add: jpegPhoto
    jpegPhoto:< file:///tmp/modme.jpeg
    -
    delete: description
    -
.fi
.in -2

.sp
.LP
The command:

.sp
.in +2
.nf
example% \fBldapmodify -r -f /tmp/entrymods\fR
.fi
.in -2
.sp

.sp
.LP
modifies the \fBModify Me\fR entry as follows:

.RS +4
.TP
1.
The current value of the \fBmail\fR attribute is replaced with the value,
\fBmodme@atlanta.xyz.com\fR.
.RE
.RS +4
.TP
2.
A \fBtitle\fR attribute with the value, \fBSystem Manager\fR, is added.
.RE
.RS +4
.TP
3.
A \fBjpegPhoto\fR attribute is added, using the contents of the file,
\fB/tmp/modme.jpeg\fR, as the attribute value.
.RE
.RS +4
.TP
4.
The \fBdescription\fR attribute is removed.
.RE
.LP
\fBExample 2 \fRCreating a New Entry
.sp
.LP
The file, \fB/tmp/newentry\fR, contains the following information for creating
a new entry:

.sp
.in +2
.nf
    dn: cn=Ann Jones, o=XYZ, c=US
    objectClass: person
    cn: Ann Jones
    cn: Annie Jones
    sn: Jones
    title: Director of Research and Development
    mail: ajones@londonrd.xyz.us.com
    uid: ajones
.fi
.in -2

.sp
.LP
The command

.sp
.in +2
.nf
example% \fBldapadd -f /tmp/newentry\fR
.fi
.in -2
.sp

.sp
.LP
adds a new entry for \fBAnn Jones\fR, using the information in the file.

.LP
\fBExample 3 \fRCreating a New Entry on an IPv6 Server
.sp
.LP
The file, \fB/tmp/newentry\fR, contains the following information for creating
a new entry: on an IPv6 server.

.sp
.in +2
.nf
    dn: cn=Ann Jones, o=XYZ, c=US
    objectClass: person
    cn: Ann Jones
    cn: Annie Jones
    sn: Jones
    title: Director of Research and Development
    mail: ajones@londonrd.xyz.us.com
    uid: ajones
.fi
.in -2

.sp
.LP
The command

.sp
.in +2
.nf
example% \fBldapadd -c -v -h '['fec0::111:a00:20ff:feaa:a364']':389 \e
                         -D cn=Directory Manager -w secret \e
                         -f /tmp/entry \fR
.fi
.in -2
.sp

.sp
.LP
adds a new entry for \fBDirectory Manager\fR, using the information in the
file.

.LP
\fBExample 4 \fRDeleting an Entry
.sp
.LP
The file, \fB/tmp/badentry\fR, contains the following information about an
entry to be deleted:

.sp
.in +2
.nf
    dn: cn=Ann Jones, o=XYZ, c=US
    changetype: delete
.fi
.in -2

.sp
.LP
The command:

.sp
.in +2
.nf
example% \fBldapmodify -f /tmp/badentry\fR
.fi
.in -2
.sp

.sp
.LP
removes Ann Jones' entry.

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for a description of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
Stability LevelEvolving
.TE

.SH SEE ALSO
.sp
.LP
\fBldap\fR(1), \fBldapdelete\fR(1), \fBldaplist\fR(1), \fBldapmodrdn\fR(1),
\fBldapsearch\fR(1), \fBldapaddent\fR(1M), \fBldap_cachemgr\fR(1M),
\fBldap_get_option\fR(3LDAP), \fBldap_set_option\fR(3LDAP), \fBattributes\fR(5)