summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-08-02 16:07:43 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-03 14:26:02 +1000
commit52d602335be1826e6a99a6470c03062ba908d373 (patch)
tree7992df8de77cdfeb8b3a647ebc1b6d4dcf1483fb /source4
parent38b8d38b30370bf930a647bceceed7fd407b649b (diff)
downloadsamba-52d602335be1826e6a99a6470c03062ba908d373.tar.gz
samba-52d602335be1826e6a99a6470c03062ba908d373.tar.bz2
samba-52d602335be1826e6a99a6470c03062ba908d373.zip
s4-libcli: Check if short_name is not null, before converting to python string
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/pysmb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/libcli/pysmb.c b/source4/libcli/pysmb.c
index ccd765634a..43478ea5a8 100644
--- a/source4/libcli/pysmb.c
+++ b/source4/libcli/pysmb.c
@@ -165,7 +165,14 @@ static void py_smb_list_callback(struct clilist_file_info *f, const char *mask,
dict = PyDict_New();
if(dict) {
PyDict_SetItemString(dict, "name", PyString_FromString(f->name));
- PyDict_SetItemString(dict, "short_name", PyString_FromString(f->short_name));
+
+ /* Windows does not always return short_name */
+ if (f->short_name) {
+ PyDict_SetItemString(dict, "short_name", PyString_FromString(f->short_name));
+ } else {
+ PyDict_SetItemString(dict, "short_name", Py_None);
+ }
+
PyDict_SetItemString(dict, "size", PyLong_FromUnsignedLongLong(f->size));
PyDict_SetItemString(dict, "attrib", PyInt_FromLong(f->attrib));
PyDict_SetItemString(dict, "mtime", PyInt_FromLong(f->mtime));