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
50c5cf13
Kaydet (Commit)
50c5cf13
authored
Ara 11, 1996
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Renamed.
üst
d96dfb72
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
23 deletions
+29
-23
pwdmodule.c
Modules/pwdmodule.c
+29
-23
No files found.
Modules/pwdmodule.c
Dosyayı görüntüle @
50c5cf13
...
...
@@ -31,16 +31,16 @@ PERFORMANCE OF THIS SOFTWARE.
/* UNIX password file access module */
#include "allobjects.h"
#include "modsupport.h"
#include "Python.h"
#include <sys/types.h>
#include <pwd.h>
static
object
*
mkpwent
(
p
)
static
PyObject
*
mkpwent
(
p
)
struct
passwd
*
p
;
{
return
mkv
alue
(
"(ssllsss)"
,
return
Py_BuildV
alue
(
"(ssllsss)"
,
p
->
pw_name
,
p
->
pw_passwd
,
#if defined(NeXT) && defined(_POSIX_SOURCE) && defined(__LITTLE_ENDIAN__)
...
...
@@ -57,56 +57,62 @@ static object *mkpwent(p)
p
->
pw_shell
);
}
static
object
*
pwd_getpwuid
(
self
,
args
)
object
*
self
,
*
args
;
static
PyObject
*
pwd_getpwuid
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
int
uid
;
struct
passwd
*
p
;
if
(
!
getintarg
(
args
,
&
uid
))
if
(
!
PyArg_Parse
(
args
,
"i"
,
&
uid
))
return
NULL
;
if
((
p
=
getpwuid
(
uid
))
==
NULL
)
{
err_setstr
(
KeyError
,
"getpwuid(): uid not found"
);
PyErr_SetString
(
PyExc_
KeyError
,
"getpwuid(): uid not found"
);
return
NULL
;
}
return
mkpwent
(
p
);
}
static
object
*
pwd_getpwnam
(
self
,
args
)
object
*
self
,
*
args
;
static
PyObject
*
pwd_getpwnam
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
char
*
name
;
struct
passwd
*
p
;
if
(
!
getstrarg
(
args
,
&
name
))
if
(
!
PyArg_Parse
(
args
,
"s"
,
&
name
))
return
NULL
;
if
((
p
=
getpwnam
(
name
))
==
NULL
)
{
err_setstr
(
KeyError
,
"getpwnam(): name not found"
);
PyErr_SetString
(
PyExc_
KeyError
,
"getpwnam(): name not found"
);
return
NULL
;
}
return
mkpwent
(
p
);
}
static
object
*
pwd_getpwall
(
self
,
args
)
object
*
self
,
*
args
;
static
PyObject
*
pwd_getpwall
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
o
bject
*
d
;
PyO
bject
*
d
;
struct
passwd
*
p
;
if
(
!
getnoarg
(
args
))
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
if
((
d
=
newlistobject
(
0
))
==
NULL
)
if
((
d
=
PyList_New
(
0
))
==
NULL
)
return
NULL
;
setpwent
();
while
((
p
=
getpwent
())
!=
NULL
)
{
o
bject
*
v
=
mkpwent
(
p
);
if
(
v
==
NULL
||
addlistitem
(
d
,
v
)
!=
0
)
{
XDECREF
(
v
);
DECREF
(
d
);
PyO
bject
*
v
=
mkpwent
(
p
);
if
(
v
==
NULL
||
PyList_Append
(
d
,
v
)
!=
0
)
{
Py_
XDECREF
(
v
);
Py_
DECREF
(
d
);
return
NULL
;
}
}
return
d
;
}
static
struct
methodlist
pwd_methods
[]
=
{
static
PyMethodDef
pwd_methods
[]
=
{
{
"getpwuid"
,
pwd_getpwuid
},
{
"getpwnam"
,
pwd_getpwnam
},
{
"getpwall"
,
pwd_getpwall
},
...
...
@@ -116,5 +122,5 @@ static struct methodlist pwd_methods[] = {
void
initpwd
()
{
initm
odule
(
"pwd"
,
pwd_methods
);
Py_InitM
odule
(
"pwd"
,
pwd_methods
);
}
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