[SCM] Samba Shared Repository - branch master updated

2011-06-16 Thread Matthias Dieter Wallnöfer
The branch, master has been updated
   via  03ea6b5 s4:winbind/wb_samba3_protocol.c - rework it using concrete 
enum values
   via  75e77f9 s4:ntvfs subsystems - rework it using concrete enum values
  from  9ba1087 auth/kerberos/gssapi_pac: fix compiler warnings

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 03ea6b5b9e6baae3596649b9d9cfe79dbd44a9a4
Author: Matthias Dieter Wallnöfer m...@samba.org
Date:   Thu Jun 16 09:01:04 2011 +0200

s4:winbind/wb_samba3_protocol.c - rework it using concrete enum values

This changes commit 49352cafb4259503e6afb44d38db9bfd525d5e0d to comply
with kblin's plans.

Autobuild-User: Matthias Dieter Wallnöfer m...@samba.org
Autobuild-Date: Thu Jun 16 10:14:52 CEST 2011 on sn-devel-104

commit 75e77f9fa023d81a57e7913bcbd712eae7a677b1
Author: Matthias Dieter Wallnöfer m...@samba.org
Date:   Thu Jun 16 08:39:03 2011 +0200

s4:ntvfs subsystems - rework it using concrete enum values

This changes commit 260bc987b00b3fff6c9b99211627b14e9bd0789a to comply
with metze's plans.

---

Summary of changes:
 source4/ntvfs/ntvfs_generic.c|   14 --
 source4/ntvfs/posix/pvfs_qfileinfo.c |6 +-
 source4/ntvfs/posix/pvfs_search.c|6 +-
 source4/torture/gentest.c|   22 +-
 source4/winbind/wb_samba3_protocol.c |   30 +++---
 5 files changed, 70 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c
index 9aa8e04..bed9c9c 100644
--- a/source4/ntvfs/ntvfs_generic.c
+++ b/source4/ntvfs/ntvfs_generic.c
@@ -664,9 +664,12 @@ static NTSTATUS ntvfs_map_fsinfo_finish(struct 
ntvfs_module_context *ntvfs,
ZERO_STRUCT(fs-objectid_information.out.unknown);
return NT_STATUS_OK;
 
-   default:
+   case RAW_QFS_GENERIC:
+   case RAW_QFS_UNIX_INFO:
return NT_STATUS_INVALID_LEVEL;
}
+
+   return NT_STATUS_INVALID_LEVEL;
 }
 
 /*
@@ -926,9 +929,16 @@ NTSTATUS ntvfs_map_fileinfo(TALLOC_CTX *mem_ctx,
info-unix_link_info.out.link_dest = 
info2-generic.out.link_dest;
return NT_STATUS_OK;
 #endif
-   default:
+   case RAW_FILEINFO_GENERIC:
+   case RAW_FILEINFO_SEC_DESC:
+   case RAW_FILEINFO_EA_LIST:
+   case RAW_FILEINFO_UNIX_INFO2:
+   case RAW_FILEINFO_SMB2_ALL_EAS:
+   case RAW_FILEINFO_SMB2_ALL_INFORMATION:
return NT_STATUS_INVALID_LEVEL;
}
+
+   return NT_STATUS_INVALID_LEVEL;
 }
 
 /* 
diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c 
b/source4/ntvfs/posix/pvfs_qfileinfo.c
index 515819b..9284306 100644
--- a/source4/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_qfileinfo.c
@@ -331,10 +331,14 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
NT_STATUS_HAVE_NO_MEMORY(info-all_info2.out.fname.s);
return NT_STATUS_OK;
 
-   default:
+   case RAW_FILEINFO_GENERIC:
+   case RAW_FILEINFO_UNIX_BASIC:
+   case RAW_FILEINFO_UNIX_INFO2:
+   case RAW_FILEINFO_UNIX_LINK:
return NT_STATUS_INVALID_LEVEL;
}
 
+   return NT_STATUS_INVALID_LEVEL;
 }
 
 /*
diff --git a/source4/ntvfs/posix/pvfs_search.c 
b/source4/ntvfs/posix/pvfs_search.c
index 668f8d7..893f55c 100644
--- a/source4/ntvfs/posix/pvfs_search.c
+++ b/source4/ntvfs/posix/pvfs_search.c
@@ -220,9 +220,13 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs,
file-id_both_directory_info.name.s   = fname;
return NT_STATUS_OK;
 
-   default:
+   case RAW_SEARCH_DATA_GENERIC:
+   case RAW_SEARCH_DATA_UNIX_INFO:
+   case RAW_SEARCH_DATA_UNIX_INFO2:
return NT_STATUS_INVALID_LEVEL;
}
+
+   return NT_STATUS_INVALID_LEVEL;
 }
 
 
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 28e6953..9b6e7fc 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -2309,7 +2309,27 @@ static void gen_setfileinfo(int instance, union 
smb_setfileinfo *info)
info-full_ea_information.in.eas = gen_ea_list();
break;
 
-   default:
+   case RAW_SFILEINFO_GENERIC:
+   case RAW_SFILEINFO_SEC_DESC:
+   case RAW_SFILEINFO_1025:
+   case RAW_SFILEINFO_1029:
+   case RAW_SFILEINFO_1032:
+   case RAW_SFILEINFO_UNIX_BASIC:
+   case RAW_SFILEINFO_UNIX_INFO2:
+   case RAW_SFILEINFO_UNIX_LINK:
+   case RAW_SFILEINFO_UNIX_HLINK:
+   case RAW_SFILEINFO_LINK_INFORMATION:
+   case RAW_SFILEINFO_PIPE_INFORMATION:
+   case RAW_SFILEINFO_VALID_DATA_INFORMATION:
+   case RAW_SFILEINFO_SHORT_NAME_INFORMATION:
+   case RAW_SFILEINFO_1027:
+   case 

[SCM] Samba Shared Repository - branch master updated

2011-06-16 Thread Stefan Metzmacher
The branch, master has been updated
   via  48de3e5 s3:rpc_server/svcctl: don't allocate return values on a 
temporary stackframe
  from  03ea6b5 s4:winbind/wb_samba3_protocol.c - rework it using concrete 
enum values

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 48de3e51eacbd1051f79dc99aaac8a4ec988fde5
Author: Stefan Metzmacher me...@samba.org
Date:   Thu Jun 16 08:33:09 2011 +0200

s3:rpc_server/svcctl: don't allocate return values on a temporary stackframe

And always initialize the whole return structure.

This caused samba3.posix_s3.rpc.svcctl to be flakey.

metze

Autobuild-User: Stefan Metzmacher me...@samba.org
Autobuild-Date: Thu Jun 16 11:34:34 CEST 2011 on sn-devel-104

---

Summary of changes:
 source3/rpc_server/svcctl/srv_svcctl_nt.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c 
b/source3/rpc_server/svcctl/srv_svcctl_nt.c
index 96ac399..4f8a2c1 100644
--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
@@ -668,17 +668,18 @@ WERROR _svcctl_QueryServiceStatusEx(struct pipes_struct 
*p,
 /
 /
 
-static WERROR fill_svc_config(TALLOC_CTX *ctx,
+static WERROR fill_svc_config(TALLOC_CTX *mem_ctx,
  struct messaging_context *msg_ctx,
  struct auth_serversupplied_info *session_info,
  const char *name,
  struct QUERY_SERVICE_CONFIG *config)
 {
-   TALLOC_CTX *mem_ctx = talloc_stackframe();
const char *result = NULL;
 
/* now fill in the individual values */
 
+   ZERO_STRUCTP(config);
+
config-displayname = svcctl_lookup_dispname(mem_ctx,
 msg_ctx,
 session_info,
@@ -720,9 +721,6 @@ static WERROR fill_svc_config(TALLOC_CTX *ctx,
else
config-start_type = SVCCTL_DEMAND_START;
 
-
-   talloc_free(mem_ctx);
-
return WERR_OK;
 }
 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-06-16 Thread Stefan Metzmacher
The branch, master has been updated
   via  6751215 s3:rpc_server/svcctl: fix valgrind bug in 
_svcctl_QueryServiceObjectSecurity()
   via  11683cc s3:rpc_server/svcctl: fix valgrind bugs in 
_svcctl_QueryServiceConfig2W()
  from  48de3e5 s3:rpc_server/svcctl: don't allocate return values on a 
temporary stackframe

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 67512152c007bb186e4fd8dac5d1aab89bce0689
Author: Stefan Metzmacher me...@samba.org
Date:   Thu Jun 16 12:47:22 2011 +0200

s3:rpc_server/svcctl: fix valgrind bug in 
_svcctl_QueryServiceObjectSecurity()

r-out.buffer needs to stay in its size, as it will be marshalled 
completely.
As it's preallocated and initialized with zeros, we just need to copy
the payload into it, even if it's smaller than the offered buffer size.

metze

Autobuild-User: Stefan Metzmacher me...@samba.org
Autobuild-Date: Thu Jun 16 14:15:47 CEST 2011 on sn-devel-104

commit 11683ccf3e68606ecb1cdfa455f7921b119803c6
Author: Stefan Metzmacher me...@samba.org
Date:   Thu Jun 16 12:34:42 2011 +0200

s3:rpc_server/svcctl: fix valgrind bugs in _svcctl_QueryServiceConfig2W()

r-out.buffer needs to stay in its size, as it will be marshalled 
completely.
As it's preallocated and initialized with zeros, we just need to copy
the payload into it.

If we always marshall the return buffer, we already have the needed
buffer size and don't need to call ndr_size_* functions.

metze

---

Summary of changes:
 source3/rpc_server/svcctl/srv_svcctl_nt.c |   16 ++--
 1 files changed, 6 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c 
b/source3/rpc_server/svcctl/srv_svcctl_nt.c
index 4f8a2c1..f515906 100644
--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
@@ -775,7 +775,8 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p,
struct svcctl_QueryServiceConfig2W *r)
 {
SERVICE_INFO *info = find_service_info_by_hnd( p, r-in.handle );
-   uint32 buffer_size;
+   uint32_t buffer_size;
+   DATA_BLOB blob = data_blob_null;
 
/* perform access checks */
 
@@ -795,7 +796,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p,
struct SERVICE_DESCRIPTION desc_buf;
const char *description;
enum ndr_err_code ndr_err;
-   DATA_BLOB blob;
 
description = svcctl_lookup_description(p-mem_ctx,
p-msg_ctx,
@@ -810,9 +810,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p,
return WERR_INVALID_PARAM;
}
 
-   buffer_size = ndr_size_SERVICE_DESCRIPTION(desc_buf, 
0);
-   r-out.buffer = blob.data;
-
break;
}
break;
@@ -820,7 +817,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p,
{
struct SERVICE_FAILURE_ACTIONS actions;
enum ndr_err_code ndr_err;
-   DATA_BLOB blob;
 
/* nothing to say...just service the request */
 
@@ -832,9 +828,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p,
return WERR_INVALID_PARAM;
}
 
-   buffer_size = 
ndr_size_SERVICE_FAILURE_ACTIONS(actions, 0);
-   r-out.buffer = blob.data;
-
break;
}
break;
@@ -843,12 +836,15 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct 
*p,
return WERR_UNKNOWN_LEVEL;
}
 
+   buffer_size = blob.length;
buffer_size += buffer_size % 4;
*r-out.needed = (buffer_size  r-in.offered) ? buffer_size : 
r-in.offered;
 
 if (buffer_size  r-in.offered)
 return WERR_INSUFFICIENT_BUFFER;
 
+   memcpy(r-out.buffer, blob.data, blob.length);
+
return WERR_OK;
 }
 
@@ -940,7 +936,7 @@ WERROR _svcctl_QueryServiceObjectSecurity(struct 
pipes_struct *p,
}
 
*r-out.needed = len;
-   r-out.buffer = buffer;
+   memcpy(r-out.buffer, buffer, len);
 
return WERR_OK;
 }


-- 
Samba Shared Repository


Re: autobuild: intermittent test failure detected

2011-06-16 Thread Stefan (metze) Metzmacher
Hi,

I think I've fixed the problems with this flakey test:
samba3.posix_s3.winbind.wbclient .wbcListUsers

See https://bugzilla.samba.org/show_bug.cgi?id=8215 for more details.

metze

 The autobuild test system has detected an intermittent failing test in 
 the current master tree.
 
 The autobuild log of the failure is available here:
 
http://git.samba.org/autobuild.flakey/2011-06-16-0225/flakey.log
 
 The samba3 build logs are available here:
 
http://git.samba.org/autobuild.flakey/2011-06-16-0225/samba3.stderr
http://git.samba.org/autobuild.flakey/2011-06-16-0225/samba3.stdout
 
 The source4 build logs are available here:
 
http://git.samba.org/autobuild.flakey/2011-06-16-0225/samba4.stderr
http://git.samba.org/autobuild.flakey/2011-06-16-0225/samba4.stdout
   



signature.asc
Description: OpenPGP digital signature


[SCM] Samba Shared Repository - branch master updated

2011-06-16 Thread Stefan Metzmacher
The branch, master has been updated
   via  5961852 s3:wb_lookupsids: add some paranoia checks to 
wb_lookupsids_recv()
   via  85809cc s3:wb_lookupsids: don't ignore 'result' and check if we got 
useable values
   via  283f8a7 Revert s3-winbind: Fix paranoia checks in winbindd_samr.c.
  from  6751215 s3:rpc_server/svcctl: fix valgrind bug in 
_svcctl_QueryServiceObjectSecurity()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 5961852d9c0e5cf64cea988586d610af9d63d487
Author: Stefan Metzmacher me...@samba.org
Date:   Thu Jun 16 18:25:15 2011 +0200

s3:wb_lookupsids: add some paranoia checks to wb_lookupsids_recv()

This hopefully catches future bugs.

metze

Autobuild-User: Stefan Metzmacher me...@samba.org
Autobuild-Date: Thu Jun 16 19:50:16 CEST 2011 on sn-devel-104

commit 85809ccbe3a79f307af1fdd227f33b899d8db1b4
Author: Stefan Metzmacher me...@samba.org
Date:   Thu Jun 16 18:16:15 2011 +0200

s3:wb_lookupsids: don't ignore 'result' and check if we got useable values

The wrong fix for bug #8215 discovered this bug, as it caused
sam_rids_to_names() to always return NT_STATUS_NONE_MAPPED.

metze

commit 283f8a7fb5089a7126f07e26315fd06ab59997d8
Author: Stefan Metzmacher me...@samba.org
Date:   Thu Jun 16 18:40:04 2011 +0200

Revert s3-winbind: Fix paranoia checks in winbindd_samr.c.

This reverts commit 207a84d725b905c2b119d2ef0f4f4d4eb391140d.

This is the wrong fix for the problem, see bug #8215.

metze

---

Summary of changes:
 source3/winbindd/wb_lookupsids.c |   70 +++--
 source3/winbindd/winbindd_samr.c |4 +-
 2 files changed, 68 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c
index f3fac6c..92eee03 100644
--- a/source3/winbindd/wb_lookupsids.c
+++ b/source3/winbindd/wb_lookupsids.c
@@ -428,6 +428,7 @@ static void wb_lookupsids_done(struct tevent_req *subreq)
req, struct wb_lookupsids_state);
struct wb_lookupsids_domain *d;
uint32_t i;
+   bool fallback = false;
 
NTSTATUS status, result;
 
@@ -437,13 +438,31 @@ static void wb_lookupsids_done(struct tevent_req *subreq)
return;
}
 
+   d = state-domains[state-domains_done];
+
+   if (NT_STATUS_IS_ERR(result)) {
+   fallback = true;
+   } else if (state-tmp_names.count != d-sids.num_sids) {
+   fallback = true;
+   }
+
+   if (fallback) {
+   for (i=0; i  d-sids.num_sids; i++) {
+   uint32_t res_sid_index = d-sid_indexes[i];
+
+   state-single_sids[state-num_single_sids] =
+   res_sid_index;
+   state-num_single_sids += 1;
+   }
+   state-domains_done += 1;
+   wb_lookupsids_next(req, state);
+   return;
+   }
+
/*
-* Ignore result here. We depend on the individual states in
-* the translated names.
+* Look at the individual states in the translated names.
 */
 
-   d = state-domains[state-domains_done];
-
for (i=0; istate-tmp_names.count; i++) {
 
uint32_t res_sid_index = d-sid_indexes[i];
@@ -544,6 +563,7 @@ static void wb_lookupsids_lookuprids_done(struct tevent_req 
*subreq)
NTSTATUS status, result;
struct wb_lookupsids_domain *d;
uint32_t i;
+   bool fallback = false;
 
status = dcerpc_wbint_LookupRids_recv(subreq, state, result);
TALLOC_FREE(subreq);
@@ -552,6 +572,30 @@ static void wb_lookupsids_lookuprids_done(struct 
tevent_req *subreq)
}
 
d = state-domains[state-domains_done];
+
+   if (NT_STATUS_IS_ERR(result)) {
+   fallback = true;
+   } else if (state-rid_names.num_principals != d-sids.num_sids) {
+   fallback = true;
+   }
+
+   if (fallback) {
+   for (i=0; i  d-sids.num_sids; i++) {
+   uint32_t res_sid_index = d-sid_indexes[i];
+
+   state-single_sids[state-num_single_sids] =
+   res_sid_index;
+   state-num_single_sids += 1;
+   }
+   state-domains_done += 1;
+   wb_lookupsids_next(req, state);
+   return;
+   }
+
+   /*
+* Look at the individual states in the translated names.
+*/
+
sid_copy(src_domain_sid, get_global_sam_sid());
src_domain.name.string = get_global_sam_name();
src_domain.sid = src_domain_sid;
@@ -595,6 +639,24 @@ NTSTATUS wb_lookupsids_recv(struct tevent_req *req, 
TALLOC_CTX *mem_ctx,
if 

[SCM] Samba Shared Repository - branch master updated

2011-06-16 Thread Andrew Tridgell
The branch, master has been updated
   via  0c3075c s4-pysamdb: fixed the normalisation of grouptype in group 
add
   via  a826979 samba-tool: report total error count and suggest --fix if 
needed
   via  08dc1aa samba-tool: added attribute normalisation checks
   via  4905725 s4-dsdb: if we don't have a remote schema, then use the 
local one
   via  665ef94 s4-pydsdb: added dsdb_normalise_attributes() call
  from  5961852 s3:wb_lookupsids: add some paranoia checks to 
wb_lookupsids_recv()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 0c3075cb57134f6171c332158c3052e05dace595
Author: Andrew Tridgell tri...@samba.org
Date:   Fri Jun 17 12:02:23 2011 +1000

s4-pysamdb: fixed the normalisation of grouptype in group add

ldap integers are signed

Autobuild-User: Andrew Tridgell tri...@samba.org
Autobuild-Date: Fri Jun 17 05:43:18 CEST 2011 on sn-devel-104

commit a8269792aa7c75b82b5ccab0e3b819601f7a4ef4
Author: Andrew Tridgell tri...@samba.org
Date:   Fri Jun 17 11:34:19 2011 +1000

samba-tool: report total error count and suggest --fix if needed

commit 08dc1aa4cc1a697dd72db6a09a32d1929421fc09
Author: Andrew Tridgell tri...@samba.org
Date:   Fri Jun 17 11:31:25 2011 +1000

samba-tool: added attribute normalisation checks

this checks that all attributes have the right normalisation, and
offers to fix the ones that don't

commit 49057255999fce2e4aa93de60dc80d40a655e61a
Author: Andrew Tridgell tri...@samba.org
Date:   Fri Jun 17 11:30:41 2011 +1000

s4-dsdb: if we don't have a remote schema, then use the local one

this allows the use of drsuapi_to_ldb() on all attributes for the
local database

commit 665ef94d3c15ba59811143bb3d3e395ffd306a58
Author: Andrew Tridgell tri...@samba.org
Date:   Fri Jun 17 11:29:44 2011 +1000

s4-pydsdb: added dsdb_normalise_attributes() call

this call converts a set of attributes to DRSUAPI format and back to
ldb format. This has the effect of normalising the attributes using
the schema syntax rules

---

Summary of changes:
 source4/dsdb/pydsdb.c|  104 ++
 source4/dsdb/schema/schema_syntax.c  |   10 ++-
 source4/scripting/python/samba/netcmd/dbcheck.py |   69 +--
 source4/scripting/python/samba/samdb.py  |   13 +++-
 4 files changed, 187 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index 895bd9a..62f33bb 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -423,6 +423,109 @@ static PyObject *py_dsdb_DsReplicaAttribute(PyObject 
*self, PyObject *args)
return ret;
 }
 
+
+/*
+  normalise a ldb attribute list
+ */
+static PyObject *py_dsdb_normalise_attributes(PyObject *self, PyObject *args)
+{
+   PyObject *py_ldb, *el_list, *ret;
+   struct ldb_context *ldb;
+   char *ldap_display_name;
+   const struct dsdb_attribute *a;
+   struct dsdb_schema *schema;
+   struct dsdb_syntax_ctx syntax_ctx;
+   struct ldb_message_element *el;
+   struct drsuapi_DsReplicaAttribute *attr;
+   TALLOC_CTX *tmp_ctx;
+   WERROR werr;
+   Py_ssize_t i;
+
+   if (!PyArg_ParseTuple(args, OsO, py_ldb, ldap_display_name, 
el_list)) {
+   return NULL;
+   }
+
+   PyErr_LDB_OR_RAISE(py_ldb, ldb);
+
+   if (!PyList_Check(el_list)) {
+   PyErr_Format(PyExc_TypeError, ldif_elements must be a list);
+   return NULL;
+   }
+
+   schema = dsdb_get_schema(ldb, NULL);
+   if (!schema) {
+   PyErr_SetString(PyExc_RuntimeError, Failed to find a schema 
from ldb);
+   return NULL;
+   }
+
+   a = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name);
+   if (a == NULL) {
+   PyErr_Format(PyExc_RuntimeError, Failed to find attribute 
'%s', ldap_display_name);
+   return NULL;
+   }
+
+   dsdb_syntax_ctx_init(syntax_ctx, ldb, schema);
+   syntax_ctx.is_schema_nc = false;
+
+   tmp_ctx = talloc_new(ldb);
+   if (tmp_ctx == NULL) {
+   PyErr_NoMemory();
+   return NULL;
+   }
+
+   el = talloc_zero(tmp_ctx, struct ldb_message_element);
+   if (el == NULL) {
+   PyErr_NoMemory();
+   talloc_free(tmp_ctx);
+   return NULL;
+   }
+
+   el-name = ldap_display_name;
+   el-num_values = PyList_Size(el_list);
+
+   el-values = talloc_array(el, struct ldb_val, el-num_values);
+   if (el-values == NULL) {
+   PyErr_NoMemory();
+   talloc_free(tmp_ctx);
+   return NULL;
+   }
+
+   for (i = 0; i  el-num_values; i++) {
+   PyObject *item =