This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: nis.match('username', 'aliases') does not work under Linux
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: fdrake Nosy List: fdrake, nobody
Priority: normal Keywords:

Created on 2001-02-19 15:17 by anonymous, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (6)
msg3486 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-02-19 15:17
The exception 'nis.error: No such key in map' is thrown
when issuing

>>> nis.match('username', 'aliases')

under SuSE-Linux 6.4 and 7.0 with both Python 2.0 and 
Python 2.1a2, even if 'username' is valid and 

$ ypmatch username aliases

works.

Fix: Apply the following patch to Modules/nismodule.c

--- nismodule.c.sv      Mon Feb 19 16:12:10 2001
+++ nismodule.c Mon Feb 19 16:15:28 2001
@@ -43,7 +43,7 @@
        {"hosts",       "hosts.byname",         0},
        {"protocols",   "protocols.bynumber",   0},
        {"services",    "services.byname",      0},
-       {"aliases",     "mail.aliases",         1}, /* created with 'makedbm -a' */
+       {"aliases",     "mail.aliases",         0}, /* created with 'makedbm -a' */
        {"ethers",      "ethers.byname",        0},
        {0L,            0L,                     0}
 };
msg3487 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2001-02-19 21:33
Can anyone confirm this bug for other platforms?  How about the fix?  I don't have any access a network that uses NIS these days.
msg3488 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-02-23 19:52
You are all going down on this one
msg3489 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-06-29 12:39
Logged In: NO 

The fix (or the Python 1.5.2 behavior) is correct for such
platforms as RedHat Linux 6.2 (NIS server BSDI 2.1) and an
unknown FreeBSD version.

The need for the "fix" flag is likely dependent on the
server, not the client, and may very well need to be guessed
at runtime.

A related bug causes a segmentation violation in memcpy()
for 'nis.cat("aliases")' when a zero-length key or value
appears in the map, because (unsigned)-1 is passed as the
length argument.
msg3490 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2001-07-19 14:22
Logged In: YES 
user_id=3066

After soliciting information from python-dev, it appears
that there's no clear fix -- fixing this properly may not be
possible, as it has a lot to do with the server
configuration.  See the "NIS on Linux, others?" thread that
starts at:

http://mail.python.org/pipermail/python-dev/2001-June/015633.html

Closing this as "Won't Fix".  If there is a portable and
reliable way to fix this, please submit a patch.
msg3491 - (view) Author: Nobody/Anonymous (nobody) Date: 2002-08-16 00:47
Logged In: NO 

Actually I think the right fix is to remove the bogus 'fix'
code from nismodule.c.  It seems to do the wrong thing in
several places.  It's broken under MacOS X and Solaris, at
least with Python 2.2.
History
Date User Action Args
2022-04-10 16:03:46adminsetgithub: 33962
2001-02-19 15:17:37anonymouscreate