Please send feedback to [email protected]
Table of Contents
NIS is Network Information Service. It is the network-wide system
database used by Solaris and other Unix(TM)-based operating system for
storing information related to users, machines and network services.
The NIS service provider implements the DirContext interface. You can
use this provider with JNDI in order to access NIS service. The
provider presents the data in NIS maps as JNDI DirContext and
Attribute objects using the IETF RFC 2307.
This document describes the features of the NIS service provider
and contains details of how JNDI is mapped to the NIS operations.
The NIS service provider supports Version 2 of the NIS
protocol. It does not support any of the ancillary protocols (such as
those for updating password or public keys).
RFC 2307
describes the mapping of NIS map entries to X.500/LDAP-style
entries. The NIS service provider uses this mapping to present the
data it obtains from the NIS service.
The NIS provider supports the standard NIS maps using the mapping
described in the RFC. Nonstandard maps can be accessed as well,
but their entries are not parsed into separate attributes.
The following JNDI environment properties are relevant for the NIS
service provider. See the
JNDI documentation
for a
description of how properties are initialized using the environment
properties, system properties, applet parameters, and resource files.
For example:
This environment property must be set if you are using the NIS provider
for the initial context. The only exception is if you supply
only URLs to the initial context, in which case, you don't need
to specify this property. See the Types of Contexts and
how Objects are Named section for details.
For example, this setting:
If this property is not set, or if
There are three types of contexts in the NIS provider:
Only standard NIS maps have aliases. Nonstandard maps must be named
using their full map name as they appear on the server.
"user" is a shortcut for "system/passwd.byname".
"host" is a shortcut for "system/hosts.byname".
Each map context presents the contents of a single NIS map. To name
an entry within a map, use the primary key for the primary map.
For example, "system/passwd/jsmith" names the entry
with user name jsmith in the passwd map.
The attributes of entries in a map have String values as
specified in RFC 2307. The entries of each map (including those not
described in RFC 2307) have the attributes "cn", "nisMapName", and
"nisMapEntry", the definitions of which are in RFC 2307. The only
exception is the optional "userPassword" attribute that is found in the
paswd.byname and group.byname maps.
The value of this attribute is of type
byte[] instead of String (because according to RFC2307,
its value is an octet string, not character string).
You can also supply NIS URLs to the initial context. For example,
will list all the NIS entries in the passwd.byname map.
Introduction
Conformance
Environment Properties
java.naming.factory.initial
This environment property is used to select the NIS provider;
it's not actually used by the provider itself. It specifies the
class name of the initial context factory for the provider.
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.nis.NISCtxFactory");
java.naming.provider.url
Specifies NIS server information. The valid formats of the
URL expected by the NIS service provider are:
where
nis://
will cause the provider to contact the server megasrv
to access the NIS service for the NIS domain eng.widget.com.
env.put(Context.PROVIDER_URL, "nis://megasvr/eng.widget.com");
java.naming.factory.object
A colon-separated list of the fully qualified class names
of object factory classes for transforming objects read from the NIS server.
You can use this mechanism to transform an object into forms expected
by the application. See
javax.naming.spi.DirectoryManager.getObjectInstance() for details.
com.sun.jndi.nis.mailaliases
If the value is the string "nonull", the NIS mailaliases map
assumes that keys are terminated by whitespace instead of null.
The NIS server that ships with Solaris uses null terminated strings
for keys. If you are using an NIS server that does not do this, you
need to set this property.
By default, mail.aliases and mail.byaddr maps are assumed to have
null-terminated keys and values.
Types of Contexts and how Objects are Named
In the initial context, there are three names: system, user, host.
"system" is bound to the map-list context, which contains a list of
the maps found in the NIS service. You can name a map using its full
map name (e.g. "passwd.byname") or using its alias (e.g. "passwd").
Standard maps that contain the same information but using different
keys are from the JNDI perspective the same context. For example,
both "passwd.byname" and "passby.byuid" point to the same context.
ictx.list("nis://ypserver/eng.widget.com/user");