From 735eb8fdd26f23e585f575d3a67787e33117db5a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 11 Sep 2002 04:54:20 +0000 Subject: Added char *, uid_t and gid_t types to generic conversion routines. (This used to be commit a938863914cbfec247586c92fd06203fec7febde) --- source3/python/py_conv.c | 25 +++++++++++++++++++++++++ source3/python/py_conv.h | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'source3/python') diff --git a/source3/python/py_conv.c b/source3/python/py_conv.c index 39b20ace861..20302c83e87 100644 --- a/source3/python/py_conv.c +++ b/source3/python/py_conv.c @@ -68,7 +68,32 @@ PyObject *from_struct(void *s, struct pyconv *conv) break; } + case PY_STRING: { + char *str = (char *)s + conv[i].offset; + + item = PyString_FromString(str); + PyDict_SetItemString(obj, conv[i].name, item); + + break; + } + case PY_UID: { + uid_t *uid = (uid_t *)((char *)s + conv[i].offset); + + item = PyInt_FromLong(*uid); + PyDict_SetItemString(obj, conv[i].name, item); + + break; + } + case PY_GID: { + gid_t *gid = (gid_t *)((char *)s + conv[i].offset); + + item = PyInt_FromLong(*gid); + PyDict_SetItemString(obj, conv[i].name, item); + + break; + } default: + break; } } diff --git a/source3/python/py_conv.h b/source3/python/py_conv.h index ed06b9a852a..24f5a66287b 100644 --- a/source3/python/py_conv.h +++ b/source3/python/py_conv.h @@ -21,7 +21,7 @@ #ifndef _PY_CONV_H #define _PY_CONV_H -enum pyconv_types { PY_UNISTR, PY_UINT32, PY_UINT16 }; +enum pyconv_types { PY_UNISTR, PY_UINT32, PY_UINT16, PY_STRING, PY_UID, PY_GID }; struct pyconv { char *name; /* Name of member */ -- cgit