NIS+ enumeration of all database entries

Gerald W. Carter cartegw at Eng.Auburn.EDU
Mon May 18 12:38:58 GMT 1998

On Mon, 18 May 1998, Luke Kenneth Casson Leighton wrote:

> how, in NIS+, do you enumerate all the entries in a database table?

command line utilities include niscat, nismatch, etc....

	niscat passwd.org_dir

On Solaris 2.5.1, the following functions are defined in <rpc/nis.h>

You could just use a loop to enumerate all entries in a table.  I can send
you the entire set of man pages if you need them.


-------------- man nis_tables -----------------------------------
nis_tables(3N)          Network Functions          nis_tables(3N)
     nis_tables,   nis_list,   nis_add_entry,   nis_remove_entry,
     nis_modify_entry,  nis_first_entry,  nis_next_entry  -  NIS+
     table functions
     cc [ flag... ] file...  -lnsl [ library... ]
     #include <rpcsvc/nis.h>
     nis_result *nis_list(const nis_name  name,
          const u_long flags,
          int (*callback)(const nis_name table_name,
          const nis_object *object, const void *userdata),
          const void *userdata);
     nis_result *nis_add_entry(const nis_name table_name,
          const nis_object *object, const u_long flags);
     nis_result *nis_remove_entry(const nis_name name,
          const nis_object *object, const u_long flags);
     nis_result *nis_modify_entry(const nis_name name,
          const nis_object *object, const u_long flags);
     nis_result *nis_first_entry(const nis_name table_name);
     nis_result *nis_next_entry(const nis_name table_name,
          const netobj *cookie);
     void nis_freeresult(nis_result *result);

     These functions are used to search and modify  NIS+  tables.
     nis_list()  is used to search a table in the NIS+ namespace.
     nis_first_entry() and nis_next_entry() are used to enumerate
     a   table   one   entry   at   a   time.    nis_add_entry(),
     nis_remove_entry(),  and  nis_modify_entry()  are  used   to
     change  the information stored in a table.  nis_freeresult()
     is used to free the memory associated  with  the  nis_result
     Entries within a table are named by NIS+ indexed names.   An
     indexed name is a compound name that is composed of a search
     criteria and a simple NIS+  name  that  identifies  a  table
     object.  A  search  criteria is a series of column names and
     their associated values enclosed in bracket `[]' characters.
     Indexed names have the following form:
          [ colname=value, ... ],tablename
     The list function, nis_list(), takes an indexed name as  the
     value for the name parameter.  Here, the tablename should be
     a fully qualified NIS+  name  unless  the  EXPAND_NAME  flag
     (described  below)  is  set.   The  second parameter, flags,
     defines how the function will respond to various conditions.
     The  value  for this parameter is created by logically ORing
     together one or more flags from the following list.



                            Gerald ( Jerry ) Carter	
Engineering Network Services                           Auburn University 
jerry at   

       "...a hundred billion castaways looking for a home."
                                  - Sting "Message in a Bottle" ( 1979 )

More information about the samba-ntdom mailing list