nis_names, nis_lookup, nis_add, nis_remove, nis_modify, nis_freeresult - NIS+ namespace functions
cc [ flag ... ] file ... -lnsl [ library ... ] #include <rpcsvc/nis.h> nis_result *nis_lookup(nis_name name, uint_t flags);
nis_result *nis_add(nis_name name, nis_object *obj);
nis_result *nis_remove(nis_name name, nis_object *obj);
nis_result *nis_modify(nis_name name, nis_object *obj);
void nis_freeresult(nis_result *result);
The NIS+ namespace functions are used to locate and manipulate all NIS+ objects except the NIS+ entry objects. See nis_objects(3NSL). To look up the NIS+ entry objects within a NIS+ table, refer to nis_subr(3NSL).
nis_lookup() resolves a NIS+ name and returns a copy of that object from a NIS+ server. nis_add() and nis_remove() add and remove objects to the NIS+ namespace, respectively. nis_modify() can change specific attributes of an object that already exists in the namespace.
These functions should be used only with names that refer to an NIS+ Directory, NIS+ Table, NIS+ Group, or NIS+ Private object. If a name refers to an NIS+ entry object, the functions listed in nis_subr(3NSL) should be used.
nis_freeresult() frees all memory associated with a nis_result structure. This function must be called to free the memory associated with a NIS+ result. nis_lookup(), nis_add(), nis_remove(), and nis_modify() all return a pointer to a nis_result() structure which must be freed by calling nis_freeresult() when you have finished using it. If one or more of the objects returned in the structure need to be retained, they can be copied with nis_clone_object(3NSL). See nis_subr(3NSL).
nis_lookup() takes two parameters, the name of the object to be resolved in name, and a flags parameter, flags, which is defined below. The object name is expected to correspond to the syntax of a non-indexed NIS+ name . See nis_tables(3NSL). The nis_lookup() function is the only function from this group that can use a non-fully qualified name. If the parameter name is not a fully qualified name, then the flag EXPAND_NAME must be specified in the call. If this flag is not specified, the function will fail with the error NIS_BADNAME.
The flags parameter is constructed by logically ORing zero or more flags from the following list.
FOLLOW_LINKS
HARD_LOOKUP
NO_CACHE
MASTER_ONLY
EXPAND_NAME
The status value may be translated to ASCII text using the function nis_sperrno(). See nis_error(3NSL).
On return, the objects array in the result will contain one and possibly several objects that were resolved by the request. If the FOLLOW_LINKS flag was present, on success the function could return several entry objects if the link in question pointed within a table. If an error occurred when following a link, the objects array will contain a copy of the link object itself.
The function nis_add() will take the object obj and add it to the NIS+ namespace with the name name. This operation will fail if the client making the request does not have the create access right for the domain in which this object will be added. The parameter name must contain a fully qualified NIS+ name. The object members zo_name and zo_domain will be constructed from this name. This operation will fail if the object already exists. This feature prevents the accidental addition of objects over another object that has been added by another process.
The function nis_remove() will remove the object with name name from the NIS+ namespace. The client making this request must have the destroy access right for the domain in which this object resides. If the named object is a link, the link is removed and not the object that it points to. If the parameter obj is not NULL, it is assumed to point to a copy of the object being removed. In this case, if the object on the server does not have the same object identifier as the object being passed, the operation will fail with the NIS_NOTSAMEOBJ error. This feature allows the client to insure that it is removing the desired object. The parameter name must contain a fully qualified NIS+ name.
The function nis_modify() will modify the object named by name to the field values in the object pointed to by obj. This object should contain a copy of the object from the name space that is being modified. This operation will fail with the error NIS_NOTSAMEOBJ if the object identifier of the passed object does not match that of the object being modified in the namespace.
Normally the contents of the member zo_name in the nis_object structure would be constructed from the name passed in the name parameter. However, if it is non-null the client library will use the name in the zo_name member to perform a rename operation on the object. This name must not contain any unquoted `.'(dot) characters. If these conditions are not met the operation will fail and return the NIS_BADNAME error code.
You cannot modify the name of an object if that modification would cause the object to reside in a different domain.
You cannot modify the schema of a table object.
These functions return a pointer to a structure of type nis_result:
struct nis_result { nis_error status; struct { uint_t objects_len; nis_object *objects_val; } objects; netobj cookie; uint32_t zticks; uint32_t dticks; uint32_t aticks; uint32_t cticks; };
The status member contains the error status of the the operation. A text message that describes the error can be obtained by calling the function nis_sperrno(). See nis_error(3NSL).
The objects structure contains two members. objects_val is an array of nis_object structures; objects_len is the number of cells in the array. These objects will be freed by the call to nis_freeresult(). If you need to keep a copy of one or more objects, they can be copied with the function nis_clone_object() and freed with the function nis_destroy_object(). See nis_server(3NSL). Refer to nis_objects(3NSL) for a description of the nis_object structure.
The various ticks contain details of where the time was taken during a request. They can be used to tune one's data organization for faster access and to compare different database implementations.
zticks
dticks
aticks
cticks
Subtracting the value in dticks from the value in zticks will yield the time spent in the service code itself. Subtracting the sum of the values in zticks and aticks from the value in cticks will yield the time spent in the client library itself. Note: all of the tick times are measured in microseconds.
The client library can return a variety of error returns and diagnostics. The more salient ones are documented below.
NIS_SUCCESS
NIS_S_SUCCESS
NIS_NOTFOUND
NIS_CACHEEXPIRED
NIS_NAMEUNREACHABLE
NIS_UNKNOWNOBJ
NIS_TRYAGAIN
NIS_SYSTEMERROR
NIS_NOT_ME
NIS_NOMEMORY
NIS_NAMEEXISTS
NIS_NOTMASTER
NIS_INVALIDOBJ
NIS_BADNAME
NIS_LINKNAMEERROR
NIS_NOTSAMEOBJ
NIS_NOSUCHNAME
NIS_NOSUCHTABLE
NIS_MODFAIL
NIS_FOREIGNNS
NIS_RPCERROR
NIS_PATH
See attributes(5) for descriptions of the following attributes:
|
nis_error(3NSL), nis_objects(3NSL), nis_server(3NSL), nis_subr(3NSL), nis_tables(3NSL), attributes(5)
NIS+ might not be supported in future releases of the Solaris operating system. Tools to aid the migration from NIS+ to LDAP are available in the current Solaris release. For more information, visit http://www.sun.com/directory/nisplus/transition.html.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |