From 0cfeb65a0b559e2a7e5f6e672d68d9d076b6fd7b Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Thu, 25 Aug 2011 16:50:34 +1000 Subject: s3-passdb: Return assigned number of hours and not MAX_HOURS_LEN Signed-off-by: Andrew Bartlett --- source3/passdb/py_passdb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/passdb') 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