summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-09-11 04:54:20 +0000
committerTim Potter <tpot@samba.org>2002-09-11 04:54:20 +0000
commit735eb8fdd26f23e585f575d3a67787e33117db5a (patch)
treeff0d2e3f0b7f7e38c7ca7bebd313447fd6886f8d /source3/python
parent3600395b373acb48379d8500eaf2aaa11805ab08 (diff)
downloadsamba-735eb8fdd26f23e585f575d3a67787e33117db5a.tar.gz
samba-735eb8fdd26f23e585f575d3a67787e33117db5a.tar.bz2
samba-735eb8fdd26f23e585f575d3a67787e33117db5a.zip
Added char *, uid_t and gid_t types to generic conversion routines.
(This used to be commit a938863914cbfec247586c92fd06203fec7febde)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_conv.c25
-rw-r--r--source3/python/py_conv.h2
2 files changed, 26 insertions, 1 deletions
diff --git a/source3/python/py_conv.c b/source3/python/py_conv.c
index 39b20ace86..20302c83e8 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 ed06b9a852..24f5a66287 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 */