Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3c3d7f4b
Kaydet (Commit)
3c3d7f4b
authored
Mar 19, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #18787: spwd.getspnam() now raises a PermissionError if the user
doesn't have privileges.
üst
af4a1f20
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
1 deletion
+22
-1
spwd.rst
Doc/library/spwd.rst
+3
-0
3.6.rst
Doc/whatsnew/3.6.rst
+2
-0
test_spwd.py
Lib/test/test_spwd.py
+10
-0
NEWS
Misc/NEWS
+3
-0
spwdmodule.c
Modules/spwdmodule.c
+4
-1
No files found.
Doc/library/spwd.rst
Dosyayı görüntüle @
3c3d7f4b
...
...
@@ -54,6 +54,9 @@ The following functions are defined:
Return the shadow password database entry for the given user name.
.. versionchanged:: 3.6
Raises a :exc:`PermissionError` instead of :exc:`KeyError` if the user
doesn't have privileges.
.. function:: getspall()
...
...
Doc/whatsnew/3.6.rst
Dosyayı görüntüle @
3c3d7f4b
...
...
@@ -471,6 +471,8 @@ Changes in the Python API
the exception will stop a single-threaded server. (Contributed by
Martin Panter in :issue:`23430`.)
* :func:`spwd.getspnam` now raises a :exc:`PermissionError` instead of
:exc:`KeyError` if the user doesn't have privileges.
Changes in the C API
--------------------
...
...
Lib/test/test_spwd.py
Dosyayı görüntüle @
3c3d7f4b
...
...
@@ -56,5 +56,15 @@ class TestSpwdRoot(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
spwd
.
getspnam
,
bytes_name
)
@unittest.skipUnless
(
hasattr
(
os
,
'geteuid'
)
and
os
.
geteuid
()
!=
0
,
'non-root user required'
)
class
TestSpwdNonRoot
(
unittest
.
TestCase
):
def
test_getspnam_exception
(
self
):
with
self
.
assertRaises
(
PermissionError
)
as
cm
:
spwd
.
getspnam
(
'bin'
)
self
.
assertEqual
(
str
(
cm
.
exception
),
'[Errno 13] Permission denied'
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Misc/NEWS
Dosyayı görüntüle @
3c3d7f4b
...
...
@@ -226,6 +226,9 @@ Core and Builtins
Library
-------
-
Issue
#
18787
:
spwd
.
getspnam
()
now
raises
a
PermissionError
if
the
user
doesn
't have privileges.
- Issue #26560: Avoid potential ValueError in BaseHandler.start_response.
Initial patch by Peter Inglesby.
...
...
Modules/spwdmodule.c
Dosyayı görüntüle @
3c3d7f4b
...
...
@@ -137,7 +137,10 @@ spwd_getspnam_impl(PyModuleDef *module, PyObject *arg)
if
(
PyBytes_AsStringAndSize
(
bytes
,
&
name
,
NULL
)
==
-
1
)
goto
out
;
if
((
p
=
getspnam
(
name
))
==
NULL
)
{
PyErr_SetString
(
PyExc_KeyError
,
"getspnam(): name not found"
);
if
(
errno
!=
0
)
PyErr_SetFromErrno
(
PyExc_OSError
);
else
PyErr_SetString
(
PyExc_KeyError
,
"getspnam(): name not found"
);
goto
out
;
}
retval
=
mkspent
(
p
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment