s4-samr: Fix Bug #5946. userparameters handling in samr server.
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 9 Dec 2008 22:31:15 +0000 (23:31 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 9 Dec 2008 23:07:25 +0000 (00:07 +0100)
Signed-off-by: Günther Deschner <gd@samba.org>
source4/rpc_server/samr/dcesrv_samr.c

index 680fb77..df23e11 100644 (file)
 
 #define SET_PARAMETERS(msg, field, attr) do {                          \
        struct ldb_message_element *set_el;                             \
-       if (samdb_msg_add_parameters(sam_ctx, mem_ctx, msg, attr, &r->in.info->field) != 0) { \
-               return NT_STATUS_NO_MEMORY;                             \
+       if (r->in.info->field.length != 0) {                            \
+               if (samdb_msg_add_parameters(sam_ctx, mem_ctx, msg, attr, &r->in.info->field) != 0) { \
+                       return NT_STATUS_NO_MEMORY;                     \
+               }                                                       \
+               set_el = ldb_msg_find_element(msg, attr);               \
+               set_el->flags = LDB_FLAG_MOD_REPLACE;                   \
        }                                                               \
-       set_el = ldb_msg_find_element(msg, attr);                       \
-       set_el->flags = LDB_FLAG_MOD_REPLACE;                           \
 } while (0)