diff options
author | Tim Potter <tpot@samba.org> | 2002-09-11 04:54:20 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-09-11 04:54:20 +0000 |
commit | a938863914cbfec247586c92fd06203fec7febde (patch) | |
tree | 0e46725f7f2257ab4c9d5266a14ffc7958fb652b | |
parent | d6d0f121d95b79d4acc68354b35fb0fb3e42e1c0 (diff) | |
download | samba-a938863914cbfec247586c92fd06203fec7febde.tar.gz samba-a938863914cbfec247586c92fd06203fec7febde.tar.xz samba-a938863914cbfec247586c92fd06203fec7febde.zip |
Added char *, uid_t and gid_t types to generic conversion routines.
-rw-r--r-- | source/python/py_conv.c | 25 | ||||
-rw-r--r-- | source/python/py_conv.h | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/source/python/py_conv.c b/source/python/py_conv.c index 39b20ace861..20302c83e87 100644 --- a/source/python/py_conv.c +++ b/source/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/source/python/py_conv.h b/source/python/py_conv.h index ed06b9a852a..24f5a66287b 100644 --- a/source/python/py_conv.h +++ b/source/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 */ |