Commit Graph

74 Commits

Author SHA1 Message Date
William Grzybowski 34c7f0c04e bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165) 2018-12-05 21:10:18 +02:00
Zackery Spytz 570e371fd6 Fix possible crashes in pwdmodule.c. (GH-10331)
"p" was not initialized if the first PyMem_RawRealloc() call failed.
2018-11-05 21:26:40 +02:00
Alexey Izbyshev e359bc24b1 bpo-35161: Fix stack-use-after-scope in grp.getgr{nam,gid} and pwd.getpw{nam,uid}. (GH-10319)
Reported by ASAN.
2018-11-04 17:44:16 +02:00
William Grzybowski 28658485a5 bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)
Pass the user/group name as Unicode to the formatting function,
instead of always decoding a bytes string from UTF-8.
2018-09-07 19:10:39 +02:00
William Grzybowski 23e65b2555 bpo-33625: Release GIL for grp.getgr{nam,gid} and pwd.getpw{nam,uid} (GH-7081)
Release GIL on grp.getgrnam(), grp.getgrgid(), pwd.getpwnam() and
pwd.getpwuid() if reentrant variants of these functions are available.

Patch by William Grzybowski.
2018-09-07 14:06:15 +02:00
Serhiy Storchaka f7eae0adfc [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302)
Based on patch by Victor Stinner.

Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters.
2017-06-28 08:30:06 +03:00
Serhiy Storchaka 2954f83999 - Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 18:20:03 +03:00
Serhiy Storchaka 1a2b24f02d Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Stefan Krah 45009778aa Issue #20306: Android is the only system that returns NULL for the pw_passwd
field.  Rather than cluttering the tests, translate the arguably more correct
"None" to an empty string.
2016-04-26 11:43:21 +02:00
Stefan Krah 267b639a26 Issue #20306: The pw_gecos and pw_passwd fields are not required by POSIX.
If they aren't present, set them to an empty string.
2016-04-26 01:09:18 +02:00
Serhiy Storchaka 1009bf18b3 Issue #23501: Argumen Clinic now generates code into separate files by default. 2015-04-03 23:53:51 +03:00
Brett Cannon 3d25e16760 Issue #20152: Port the pwd module to Argument Clinic. 2014-08-22 14:03:51 -04:00
Christian Heimes af01f66817 Issue #16136: Remove VMS support and VMS-related code 2013-12-21 16:19:10 +01:00
Victor Stinner 1c8f059019 Issue #18520: Add a new PyStructSequence_InitType2() function, same than
PyStructSequence_InitType() except that it has a return value (0 on success,
-1 on error).

 * PyStructSequence_InitType2() now raises MemoryError on memory allocation failure
 * Fix also some calls to PyDict_SetItemString(): handle error
2013-07-22 22:24:54 +02:00
Serhiy Storchaka fd6e6cfa29 Raise KeyError instead of OverflowError when getpwuid's argument is out of
uid_t range.
2013-02-11 20:33:24 +02:00
Serhiy Storchaka 55e2238272 Raise KeyError instead of OverflowError when getpwuid's argument is out of
uid_t range.
2013-02-11 20:32:47 +02:00
Serhiy Storchaka c2d020090b Issue #4591: Uid and gid values larger than 2**31 are supported now. 2013-02-10 22:03:08 +02:00
Serhiy Storchaka 7cf5599346 Issue #4591: Uid and gid values larger than 2**31 are supported now. 2013-02-10 21:56:49 +02:00
Jesus Cea 14c81aba50 #16135: Removal of OS/2 support (Modules/*) 2012-10-05 02:11:36 +02:00
Georg Brandl 71c23d4473 Include structseq.h in Python.h, and remove now-redundant includes in individual sources. 2010-11-30 09:30:54 +00:00
Alexander Belopolsky 977a684c94 Issue #8983: Corrected docstrings. 2010-08-16 20:17:07 +00:00
Victor Stinner ae6265f8d0 Issue #8715: Create PyUnicode_EncodeFSDefault() function: Encode a Unicode
object to Py_FileSystemDefaultEncoding with the "surrogateescape" error
handler, return a bytes object. If Py_FileSystemDefaultEncoding is not set,
fall back to UTF-8.
2010-05-15 16:27:27 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Benjamin Peterson 02a004ea1d correct call 2010-05-07 16:42:51 +00:00
Victor Stinner 97c18ab6a5 Replace PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,
"surrogateescape") by PyUnicode_DecodeFSDefault(val).
2010-05-07 16:34:53 +00:00
Martin v. Löwis e23c8683a5 Merged revisions 73016 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73016 | martin.v.loewis | 2009-05-29 17:58:08 +0200 (Fr, 29 Mai 2009) | 2 lines

  Issue #4873: Fix resource leaks in error cases of pwd and grp.
........
2009-05-29 16:01:34 +00:00
Martin v. Löwis b6a748b817 Issue #4859: Implement PEP 383 for pwd, spwd, and grp. 2009-05-29 15:23:17 +00:00
Benjamin Peterson e04b627a11 remove old undocumented compat interfaces in hashlib and pwd #5881 2009-05-04 22:25:21 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00
Christian Heimes 217cfd1c86 Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h 2007-12-02 14:31:20 +00:00
Neal Norwitz 3d7a90dea1 Get the locale and pwd tests working on the Solaris box where there
are some unicode values used.  I'm not sure if this is the correct
on all operating systems, but this works on Linux w/o unicode.
2007-10-27 05:40:06 +00:00
Neal Norwitz eb8b3a6d61 Use unicode for password modules 2007-08-24 23:26:23 +00:00
Thomas Wouters 49fd7fa443 Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html

Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:

test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec

This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.
2006-04-21 10:40:58 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Guido van Rossum 8ee3e5aa93 - Changes donated by Elemental Security to make it work on AIX 5.3
with IBM's 64-bit compiler (SF patch #1284289).  This also closes SF
  bug #105470: test_pwd fails on 64bit system (Opteron).
2005-09-14 18:09:42 +00:00
Barry Warsaw e1b1c87636 pwd_getpwuid(), pwd_getpwnam(): Patch # 868499, improvement to the error
messages.
2004-01-20 21:07:23 +00:00
Guido van Rossum 16b9fa8db3 - The pwd module incorrectly advertised its struct type as
struct_pwent; this has been renamed to struct_passwd.  (The old name
  is still supported for backwards compatibility.)
2003-10-23 23:54:57 +00:00
Martin v. Löwis 79acb9edfa Patch #614055: Support OpenVMS. 2002-12-06 12:48:53 +00:00
Martin v. Löwis 29275c9331 Deal with NULL fields in mkpwent. 2002-09-17 09:34:06 +00:00
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Neal Norwitz 726e013eff Remove unused variable reported by Walter Dörwald 2002-04-15 16:29:00 +00:00
Fred Drake 88c9344986 initpwd(): Clean up initialization, avoid PyModule_GetDict(). 2002-04-13 21:07:45 +00:00
Neal Norwitz ba3a16c6c3 Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
  Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Please review.  All tests pass, but some modules don't have tests.
I spot checked various functions to try to make sure nothing broke.
2002-03-31 15:27:00 +00:00
Neil Schemenauer cc07ec17a3 Add missing typecast. 2002-03-29 19:58:25 +00:00
Neal Norwitz 3a6f97850b Remove many uses of PyArg_NoArgs macro, change METH_OLDARGS to METH_NOARGS. 2002-03-25 20:46:46 +00:00
Andrew MacIntyre 7bf6833e17 OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    _hotshot.c
    dbmmodule.c
    fcntlmodule.c
    main.c
    pwdmodule.c
    readline.c
    selectmodule.c
    signalmodule.c
    termios.c
    timemodule.c
    unicodedata.c
2002-03-03 02:59:16 +00:00
Martin v. Löwis dbd55b3737 Patch #523268, #522027: return enhanced tuples. 2002-03-01 10:38:44 +00:00
Jack Jansen 4892f2406f Got rid of a few more NeXT ifdefs. The last, I think. 2002-02-01 15:46:29 +00:00
Fred Drake 8e68eb61f2 Make sure we close the group and password databases when we are done with
them; this closes SF bug #407504.
2001-03-11 03:03:07 +00:00