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
57a34e80
Kaydet (Commit)
57a34e80
authored
Şub 04, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1422385: Changes to nis module to support multiple NIS domains
üst
faa26dfd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
26 deletions
+101
-26
libnis.tex
Doc/lib/libnis.tex
+18
-3
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
nismodule.c
Modules/nismodule.c
+79
-23
No files found.
Doc/lib/libnis.tex
Dosyayı görüntüle @
57a34e80
...
@@ -15,7 +15,7 @@ only available for \UNIX.
...
@@ -15,7 +15,7 @@ only available for \UNIX.
The
\module
{
nis
}
module defines the following functions:
The
\module
{
nis
}
module defines the following functions:
\begin{funcdesc}
{
match
}{
key, mapname
}
\begin{funcdesc}
{
match
}{
key, mapname
[, domain=default
_
domain]
}
Return the match for
\var
{
key
}
in map
\var
{
mapname
}
, or raise an
Return the match for
\var
{
key
}
in map
\var
{
mapname
}
, or raise an
error (
\exception
{
nis.error
}
) if there is none.
error (
\exception
{
nis.error
}
) if there is none.
Both should be strings,
\var
{
key
}
is 8-bit clean.
Both should be strings,
\var
{
key
}
is 8-bit clean.
...
@@ -24,9 +24,13 @@ and other joys).
...
@@ -24,9 +24,13 @@ and other joys).
Note that
\var
{
mapname
}
is first checked if it is an alias to another
Note that
\var
{
mapname
}
is first checked if it is an alias to another
name.
name.
\versionchanged
[The
\var
{
domain
}
argument allows to override
the NIS domain used for the lookup. If unspecified, lookup is in the
default NIS domain]
{
2.5
}
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
cat
}{
mapname
}
\begin{funcdesc}
{
cat
}{
mapname
[, domain=default
_
domain]
}
Return a dictionary mapping
\var
{
key
}
to
\var
{
value
}
such that
Return a dictionary mapping
\var
{
key
}
to
\var
{
value
}
such that
\code
{
match(
\var
{
key
}
,
\var
{
mapname
}
)==
\var
{
value
}}
.
\code
{
match(
\var
{
key
}
,
\var
{
mapname
}
)==
\var
{
value
}}
.
Note that both keys and values of the dictionary are arbitrary
Note that both keys and values of the dictionary are arbitrary
...
@@ -34,12 +38,23 @@ arrays of bytes.
...
@@ -34,12 +38,23 @@ arrays of bytes.
Note that
\var
{
mapname
}
is first checked if it is an alias to another
Note that
\var
{
mapname
}
is first checked if it is an alias to another
name.
name.
\versionchanged
[The
\var
{
domain
}
argument allows to override
the NIS domain used for the lookup. If unspecified, lookup is in the
default NIS domain]
{
2.5
}
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
maps
}{
}
\begin{funcdesc}
{
maps
}{
[domain=default
_
domain]
}
Return a list of all valid maps.
Return a list of all valid maps.
\versionchanged
[The
\var
{
domain
}
argument allows to override
the NIS domain used for the lookup. If unspecified, lookup is in the
default NIS domain]
{
2.5
}
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
get
_
default
_
domain
}{}
Return the system default NIS domain.
\versionadded
{
2.5
}
\end{funcdesc}
The
\module
{
nis
}
module defines the following exception:
The
\module
{
nis
}
module defines the following exception:
...
...
Misc/ACKS
Dosyayı görüntüle @
57a34e80
...
@@ -47,6 +47,7 @@ Neal Becker
...
@@ -47,6 +47,7 @@ Neal Becker
Robin Becker
Robin Becker
Bill Bedford
Bill Bedford
Reimer Behrends
Reimer Behrends
Ben Bell
Thomas Bellman
Thomas Bellman
Juan M. Bello Rivas
Juan M. Bello Rivas
Alexander Belopolsky
Alexander Belopolsky
...
...
Misc/NEWS
Dosyayı görüntüle @
57a34e80
...
@@ -216,6 +216,9 @@ Core and builtins
...
@@ -216,6 +216,9 @@ Core and builtins
Extension
Modules
Extension
Modules
-----------------
-----------------
-
Patch
#
1422385
:
The
nis
module
now
supports
access
to
domains
other
than
the
system
default
domain
.
-
Use
Win32
API
to
implement
os
.
stat
/
fstat
.
As
a
result
,
subsecond
timestamps
-
Use
Win32
API
to
implement
os
.
stat
/
fstat
.
As
a
result
,
subsecond
timestamps
are
reported
,
the
limit
on
path
name
lengths
is
removed
,
and
stat
reports
are
reported
,
the
limit
on
path
name
lengths
is
removed
,
and
stat
reports
WindowsError
now
(
instead
of
OSError
).
WindowsError
now
(
instead
of
OSError
).
...
...
Modules/nismodule.c
Dosyayı görüntüle @
57a34e80
...
@@ -23,6 +23,27 @@
...
@@ -23,6 +23,27 @@
extern
int
yp_get_default_domain
(
char
**
);
extern
int
yp_get_default_domain
(
char
**
);
#endif
#endif
PyDoc_STRVAR
(
get_default_domain__doc__
,
"get_default_domain() -> str
\n
\
Corresponds to the C library yp_get_default_domain() call, returning
\n
\
the default NIS domain.
\n
"
);
PyDoc_STRVAR
(
match__doc__
,
"match(key, map, domain = defaultdomain)
\n
\
Corresponds to the C library yp_match() call, returning the value of
\n
\
key in the given map. Optionally domain can be specified but it
\n
\
defaults to the system default domain.
\n
"
);
PyDoc_STRVAR
(
cat__doc__
,
"cat(map, domain = defaultdomain)
\n
\
Returns the entire map as a dictionary. Optionally domain can be
\n
\
specified but it defaults to the system default domain.
\n
"
);
PyDoc_STRVAR
(
maps__doc__
,
"maps(domain = defaultdomain)
\n
\
Returns an array of all available NIS maps within a domain. If domain
\n
\
is not specified it defaults to the system default domain.
\n
"
);
static
PyObject
*
NisError
;
static
PyObject
*
NisError
;
static
PyObject
*
static
PyObject
*
...
@@ -116,19 +137,36 @@ nis_foreach (int instatus, char *inkey, int inkeylen, char *inval,
...
@@ -116,19 +137,36 @@ nis_foreach (int instatus, char *inkey, int inkeylen, char *inval,
}
}
static
PyObject
*
static
PyObject
*
nis_
match
(
PyObject
*
self
,
PyObject
*
args
)
nis_
get_default_domain
(
PyObject
*
self
)
{
{
char
*
match
;
char
*
domain
;
char
*
domain
;
int
err
;
PyObject
*
res
;
if
((
err
=
yp_get_default_domain
(
&
domain
))
!=
0
)
return
nis_error
(
err
);
res
=
PyString_FromStringAndSize
(
domain
,
strlen
(
domain
));
return
res
;
}
static
PyObject
*
nis_match
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwdict
)
{
char
*
match
;
char
*
domain
=
NULL
;
int
keylen
,
len
;
int
keylen
,
len
;
char
*
key
,
*
map
;
char
*
key
,
*
map
;
int
err
;
int
err
;
PyObject
*
res
;
PyObject
*
res
;
int
fix
;
int
fix
;
static
const
char
*
kwlist
[]
=
{
"key"
,
"map"
,
"domain"
,
NULL
};
if
(
!
PyArg_ParseTuple
(
args
,
"t#s:match"
,
&
key
,
&
keylen
,
&
map
))
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwdict
,
"t#s|s:match"
,
kwlist
,
&
key
,
&
keylen
,
&
map
,
&
domain
))
return
NULL
;
return
NULL
;
if
(
(
err
=
yp_get_default_domain
(
&
domain
))
!=
0
)
if
(
!
domain
&&
((
err
=
yp_get_default_domain
(
&
domain
))
!=
0
)
)
return
nis_error
(
err
);
return
nis_error
(
err
);
map
=
nis_mapname
(
map
,
&
fix
);
map
=
nis_mapname
(
map
,
&
fix
);
if
(
fix
)
if
(
fix
)
...
@@ -146,18 +184,20 @@ nis_match (PyObject *self, PyObject *args)
...
@@ -146,18 +184,20 @@ nis_match (PyObject *self, PyObject *args)
}
}
static
PyObject
*
static
PyObject
*
nis_cat
(
PyObject
*
self
,
PyObject
*
args
)
nis_cat
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwdict
)
{
{
char
*
domain
;
char
*
domain
=
NULL
;
char
*
map
;
char
*
map
;
struct
ypall_callback
cb
;
struct
ypall_callback
cb
;
struct
ypcallback_data
data
;
struct
ypcallback_data
data
;
PyObject
*
dict
;
PyObject
*
dict
;
int
err
;
int
err
;
static
const
char
*
kwlist
[]
=
{
"map"
,
"domain"
,
NULL
};
if
(
!
PyArg_ParseTuple
(
args
,
"s:cat"
,
&
map
))
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwdict
,
"s|s:cat"
,
kwlist
,
&
map
,
&
domain
))
return
NULL
;
return
NULL
;
if
(
(
err
=
yp_get_default_domain
(
&
domain
))
!=
0
)
if
(
!
domain
&&
((
err
=
yp_get_default_domain
(
&
domain
))
!=
0
)
)
return
nis_error
(
err
);
return
nis_error
(
err
);
dict
=
PyDict_New
();
dict
=
PyDict_New
();
if
(
dict
==
NULL
)
if
(
dict
==
NULL
)
...
@@ -301,19 +341,12 @@ nisproc_maplist_2(domainname *argp, CLIENT *clnt)
...
@@ -301,19 +341,12 @@ nisproc_maplist_2(domainname *argp, CLIENT *clnt)
static
static
nismaplist
*
nismaplist
*
nis_maplist
(
void
)
nis_maplist
(
char
*
dom
)
{
{
nisresp_maplist
*
list
;
nisresp_maplist
*
list
;
char
*
dom
;
CLIENT
*
cl
;
CLIENT
*
cl
;
char
*
server
=
NULL
;
char
*
server
=
NULL
;
int
mapi
=
0
;
int
mapi
=
0
;
int
err
;
if
((
err
=
yp_get_default_domain
(
&
dom
))
!=
0
)
{
nis_error
(
err
);
return
NULL
;
}
while
(
!
server
&&
aliases
[
mapi
].
map
!=
0L
)
{
while
(
!
server
&&
aliases
[
mapi
].
map
!=
0L
)
{
yp_master
(
dom
,
aliases
[
mapi
].
map
,
&
server
);
yp_master
(
dom
,
aliases
[
mapi
].
map
,
&
server
);
...
@@ -344,12 +377,23 @@ nis_maplist (void)
...
@@ -344,12 +377,23 @@ nis_maplist (void)
}
}
static
PyObject
*
static
PyObject
*
nis_maps
(
PyObject
*
self
)
nis_maps
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwdict
)
{
{
char
*
domain
=
NULL
;
nismaplist
*
maps
;
nismaplist
*
maps
;
PyObject
*
list
;
PyObject
*
list
;
int
err
;
static
const
char
*
kwlist
[]
=
{
"domain"
,
NULL
};
if
((
maps
=
nis_maplist
())
==
NULL
)
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwdict
,
"|s:maps"
,
kwlist
,
&
domain
))
return
NULL
;
if
(
!
domain
&&
((
err
=
yp_get_default_domain
(
&
domain
))
!=
0
))
{
nis_error
(
err
);
return
NULL
;
}
if
((
maps
=
nis_maplist
(
domain
))
==
NULL
)
return
NULL
;
return
NULL
;
if
((
list
=
PyList_New
(
0
))
==
NULL
)
if
((
list
=
PyList_New
(
0
))
==
NULL
)
return
NULL
;
return
NULL
;
...
@@ -368,17 +412,29 @@ nis_maps (PyObject *self)
...
@@ -368,17 +412,29 @@ nis_maps (PyObject *self)
}
}
static
PyMethodDef
nis_methods
[]
=
{
static
PyMethodDef
nis_methods
[]
=
{
{
"match"
,
nis_match
,
METH_VARARGS
},
{
"match"
,
(
PyCFunction
)
nis_match
,
{
"cat"
,
nis_cat
,
METH_VARARGS
},
METH_VARARGS
|
METH_KEYWORDS
,
{
"maps"
,
(
PyCFunction
)
nis_maps
,
METH_NOARGS
},
match__doc__
},
{
NULL
,
NULL
}
/* Sentinel */
{
"cat"
,
(
PyCFunction
)
nis_cat
,
METH_VARARGS
|
METH_KEYWORDS
,
cat__doc__
},
{
"maps"
,
(
PyCFunction
)
nis_maps
,
METH_VARARGS
|
METH_KEYWORDS
,
maps__doc__
},
{
"get_default_domain"
,
(
PyCFunction
)
nis_get_default_domain
,
METH_NOARGS
,
get_default_domain__doc__
},
{
NULL
,
NULL
}
/* Sentinel */
};
};
PyDoc_STRVAR
(
nis__doc__
,
"This module contains functions for accessing NIS maps.
\n
"
);
void
void
initnis
(
void
)
initnis
(
void
)
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
m
=
Py_InitModule
(
"nis"
,
nis_methods
);
m
=
Py_InitModule
3
(
"nis"
,
nis_methods
,
nis__doc__
);
if
(
m
==
NULL
)
if
(
m
==
NULL
)
return
;
return
;
d
=
PyModule_GetDict
(
m
);
d
=
PyModule_GetDict
(
m
);
...
...
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