summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-08-25 16:50:34 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-26 10:06:33 +1000
commit0cfeb65a0b559e2a7e5f6e672d68d9d076b6fd7b (patch)
treea621ba201997b083c1201ef2083abffcdfd9d9bb /source3/passdb
parenta38a3b16e1b39985d8d9e084a1ca31e7e14d0198 (diff)
downloadsamba-0cfeb65a0b559e2a7e5f6e672d68d9d076b6fd7b.tar.gz
samba-0cfeb65a0b559e2a7e5f6e672d68d9d076b6fd7b.tar.bz2
samba-0cfeb65a0b559e2a7e5f6e672d68d9d076b6fd7b.zip
s3-passdb: Return assigned number of hours and not MAX_HOURS_LEN
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/py_passdb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index cc59b64608..c4129c35e3 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -774,19 +774,20 @@ static PyObject *py_samu_get_hours(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_hours;
const char *hours;
- int i;
+ int hours_len, i;
hours = (const char *)pdb_get_hours(sam_acct);
if(! hours) {
Py_RETURN_NONE;
}
- if ((py_hours = PyList_New(MAX_HOURS_LEN)) == NULL) {
+ hours_len = pdb_get_hours_len(sam_acct);
+ if ((py_hours = PyList_New(hours_len)) == NULL) {
PyErr_NoMemory();
return NULL;
}
- for (i=0; i<MAX_HOURS_LEN; i++) {
+ for (i=0; i<hours_len; i++) {
PyList_SetItem(py_hours, i, PyInt_FromLong(hours[i]));
}
return py_hours;