Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | |
| 2 | :mod:`nis` --- Interface to Sun's NIS (Yellow Pages) |
| 3 | ==================================================== |
| 4 | |
| 5 | .. module:: nis |
| 6 | :platform: Unix |
| 7 | :synopsis: Interface to Sun's NIS (Yellow Pages) library. |
Terry Jan Reedy | fa089b9 | 2016-06-11 15:02:54 -0400 | [diff] [blame] | 8 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 9 | .. moduleauthor:: Fred Gansevles <Fred.Gansevles@cs.utwente.nl> |
| 10 | .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il> |
| 11 | |
Terry Jan Reedy | fa089b9 | 2016-06-11 15:02:54 -0400 | [diff] [blame] | 12 | -------------- |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 13 | |
| 14 | The :mod:`nis` module gives a thin wrapper around the NIS library, useful for |
| 15 | central administration of several hosts. |
| 16 | |
| 17 | Because NIS exists only on Unix systems, this module is only available for Unix. |
| 18 | |
| 19 | The :mod:`nis` module defines the following functions: |
| 20 | |
| 21 | |
Hynek Schlawack | dfa4652 | 2012-05-21 11:01:54 +0200 | [diff] [blame] | 22 | .. function:: match(key, mapname, domain=default_domain) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 23 | |
| 24 | Return the match for *key* in map *mapname*, or raise an error |
| 25 | (:exc:`nis.error`) if there is none. Both should be strings, *key* is 8-bit |
| 26 | clean. Return value is an arbitrary array of bytes (may contain ``NULL`` and |
| 27 | other joys). |
| 28 | |
| 29 | Note that *mapname* is first checked if it is an alias to another name. |
| 30 | |
Martin Panter | c04fb56 | 2016-02-10 05:44:01 +0000 | [diff] [blame] | 31 | The *domain* argument allows overriding the NIS domain used for the lookup. If |
Georg Brandl | 55ac8f0 | 2007-09-01 13:51:09 +0000 | [diff] [blame] | 32 | unspecified, lookup is in the default NIS domain. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 33 | |
| 34 | |
Hynek Schlawack | dfa4652 | 2012-05-21 11:01:54 +0200 | [diff] [blame] | 35 | .. function:: cat(mapname, domain=default_domain) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 36 | |
| 37 | Return a dictionary mapping *key* to *value* such that ``match(key, |
| 38 | mapname)==value``. Note that both keys and values of the dictionary are |
| 39 | arbitrary arrays of bytes. |
| 40 | |
| 41 | Note that *mapname* is first checked if it is an alias to another name. |
| 42 | |
Martin Panter | c04fb56 | 2016-02-10 05:44:01 +0000 | [diff] [blame] | 43 | The *domain* argument allows overriding the NIS domain used for the lookup. If |
Georg Brandl | 55ac8f0 | 2007-09-01 13:51:09 +0000 | [diff] [blame] | 44 | unspecified, lookup is in the default NIS domain. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 45 | |
| 46 | |
Hynek Schlawack | dfa4652 | 2012-05-21 11:01:54 +0200 | [diff] [blame] | 47 | .. function:: maps(domain=default_domain) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 48 | |
| 49 | Return a list of all valid maps. |
| 50 | |
Martin Panter | c04fb56 | 2016-02-10 05:44:01 +0000 | [diff] [blame] | 51 | The *domain* argument allows overriding the NIS domain used for the lookup. If |
Georg Brandl | 55ac8f0 | 2007-09-01 13:51:09 +0000 | [diff] [blame] | 52 | unspecified, lookup is in the default NIS domain. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 53 | |
| 54 | |
| 55 | .. function:: get_default_domain() |
| 56 | |
| 57 | Return the system default NIS domain. |
| 58 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 59 | |
| 60 | The :mod:`nis` module defines the following exception: |
| 61 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 62 | .. exception:: error |
| 63 | |
| 64 | An error raised when a NIS function returns an error code. |
| 65 | |