The branch, master has been updated
       via  525a4fb... util: on FreeBSD true is in /usr/bin. Use execvp to find 
it
       via  fae84f9... libutil: moved the networking defines to util_net.h
       via  c81d2ae... libreplace: strerror_r() is needed by heimdal on solaris8
       via  af80775... s4-drs: replmd_delete with the 3 stage deletion recycle 
bin
       via  63fc397... tsocket: not all systems have IPV6_V6ONLY
      from  92332fb... Second part of bug #7288 - SMB job IDs in CUPS job names 
wrong.

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


- Log -----------------------------------------------------------------
commit 525a4fb2c423dbbeeb1e6da3254f334044b7bd7f
Author: Andrew Tridgell <[email protected]>
Date:   Fri Mar 26 19:03:22 2010 +1100

    util: on FreeBSD true is in /usr/bin. Use execvp to find it

commit fae84f98e37e99e41b23739305e7331b3a34ae48
Author: Andrew Tridgell <[email protected]>
Date:   Fri Mar 26 17:36:02 2010 +1100

    libutil: moved the networking defines to util_net.h
    
    These were causing thousands of warnings on solaris8

commit c81d2ae3c9a4f9b5d2291563f141bb10d64cd650
Author: Andrew Tridgell <[email protected]>
Date:   Fri Mar 26 16:50:24 2010 +1100

    libreplace: strerror_r() is needed by heimdal on solaris8

commit af807758e8d98ea53f58b2bae8f00b83074cfdec
Author: Eduardo Lima <[email protected]>
Date:   Wed Mar 24 16:21:15 2010 -0300

    s4-drs: replmd_delete with the 3 stage deletion recycle bin

commit 63fc3978089df403d7e63462593784ff3d05e6e7
Author: Andrew Tridgell <[email protected]>
Date:   Thu Mar 25 16:42:19 2010 +1100

    tsocket: not all systems have IPV6_V6ONLY

-----------------------------------------------------------------------

Summary of changes:
 lib/replace/libreplace.m4                       |    2 +-
 lib/replace/replace.c                           |    8 +
 lib/replace/replace.h                           |    5 +
 lib/tsocket/tsocket_bsd.c                       |    4 +-
 lib/util/util.h                                 |   27 ---
 lib/util/util_net.c                             |    1 +
 lib/util/util_net.h                             |   28 +++
 lib/util/util_runcmd.c                          |    2 +-
 libcli/nbt/nbtname.c                            |    1 +
 librpc/ndr/ndr_basic.c                          |    1 +
 librpc/rpc/binding.c                            |    1 +
 nsswitch/libwbclient/tests/wbclient.c           |    1 +
 selftest/target/Samba4.pm                       |    2 +-
 source4/auth/gensec/gensec_gssapi.c             |    1 +
 source4/auth/gensec/gensec_krb5.c               |    1 +
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c |  283 ++++++++++++++---------
 source4/dsdb/samdb/ldb_modules/util.c           |   26 ++-
 source4/lib/socket/access.c                     |    1 +
 source4/lib/socket/interface.c                  |    1 +
 source4/lib/socket/socket_ip.c                  |    1 +
 source4/libcli/resolve/resolve.c                |    1 +
 source4/libcli/resolve/testsuite.c              |    1 +
 source4/libcli/smb_composite/connect.c          |    1 +
 source4/librpc/tests/binding_string.c           |    1 +
 source4/nbt_server/interfaces.c                 |    1 +
 source4/nbt_server/wins/winsserver.c            |    1 +
 26 files changed, 266 insertions(+), 137 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 8b7a56e..6da209d 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -104,7 +104,7 @@ AC_CHECK_HEADERS(sys/mount.h mntent.h)
 AC_CHECK_HEADERS(stropts.h)
 AC_CHECK_HEADERS(unix.h)
 
-AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
+AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror 
strerror_r)
 AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
 AC_CHECK_FUNCS(waitpid wait4 strlcpy strlcat initgroups memmove strdup)
 AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2 dprintf 
vdprintf)
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index e4b97a8..6a32540 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -747,3 +747,11 @@ char *rep_get_current_dir_name(void)
        return strdup(p);
 }
 #endif
+
+#ifndef HAVE_STRERROR_R
+char *rep_strerror_r(int errnum, char *buf, size_t buflen)
+{
+       strncpy(buf, strerror(errnum), buflen);
+       return buf;
+}
+#endif
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index cd73e65..9eb6604 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -512,6 +512,11 @@ ssize_t rep_pwrite(int __fd, const void *__buf, size_t 
__nbytes, off_t __offset)
 char *rep_get_current_dir_name(void);
 #endif
 
+#ifndef HAVE_STRERROR_R
+#define strerror_r rep_strerror_r
+char *rep_strerror_r(int errnum, char *buf, size_t buflen);
+#endif
+
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index c44ba4e..1a7a4ee 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -1248,7 +1248,7 @@ static int tdgram_bsd_dgram_socket(const struct 
tsocket_address *local,
        bsds->fd = fd;
        talloc_set_destructor(bsds, tdgram_bsd_destructor);
 
-#ifdef HAVE_IPV6
+#if defined(HAVE_IPV6) && defined(IPV6_V6ONLY)
        if (do_ipv6only) {
                int val = 1;
 
@@ -2089,7 +2089,7 @@ static struct tevent_req * 
tstream_bsd_connect_send(TALLOC_CTX *mem_ctx,
                goto post;
        }
 
-#ifdef HAVE_IPV6
+#if defined(HAVE_IPV6) && defined(IPV6_V6ONLY)
        if (do_ipv6only) {
                int val = 1;
 
diff --git a/lib/util/util.h b/lib/util/util.h
index 2d4a025..b89a7d6 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -663,33 +663,6 @@ _PUBLIC_ void msleep(unsigned int t);
 _PUBLIC_ char* get_myname(TALLOC_CTX *mem_ctx);
 
 /**
- Return true if a string could be a pure IP address.
-**/
-_PUBLIC_ bool is_ipaddress(const char *str);
-
-/**
- Interpret an internet address or name into an IP address in 4 byte form.
-**/
-_PUBLIC_ uint32_t interpret_addr(const char *str);
-
-/**
- A convenient addition to interpret_addr().
-**/
-_PUBLIC_ struct in_addr interpret_addr2(const char *str);
-
-/**
- Check if an IP is the 0.0.0.0.
-**/
-_PUBLIC_ bool is_zero_ip_v4(struct in_addr ip);
-
-/**
- Are two IPs on the same subnet?
-**/
-_PUBLIC_ bool same_net_v4(struct in_addr ip1,struct in_addr ip2,struct in_addr 
mask);
-
-_PUBLIC_ bool is_ipaddress_v4(const char *str);
-
-/**
  Check if a process exists. Does this work on all unixes?
 **/
 _PUBLIC_ bool process_exists_by_pid(pid_t pid);
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index 9e47f51..00a5ee4 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -27,6 +27,7 @@
 #include "system/network.h"
 #include "system/locale.h"
 #include "system/filesys.h"
+#include "lib/util/util_net.h"
 #undef strcasecmp
 
 /*******************************************************************
diff --git a/lib/util/util_net.h b/lib/util/util_net.h
index 5dc4df5..530311e 100644
--- a/lib/util/util_net.h
+++ b/lib/util/util_net.h
@@ -45,4 +45,32 @@ bool interpret_string_addr_prefer_ipv4(struct 
sockaddr_storage *pss,
 
 void set_sockaddr_port(struct sockaddr *psa, uint16_t port);
 
+/**
+ Check if an IP is the 0.0.0.0.
+**/
+_PUBLIC_ bool is_zero_ip_v4(struct in_addr ip);
+
+/**
+ Are two IPs on the same subnet?
+**/
+_PUBLIC_ bool same_net_v4(struct in_addr ip1,struct in_addr ip2,struct in_addr 
mask);
+
+/**
+ Return true if a string could be a pure IP address.
+**/
+_PUBLIC_ bool is_ipaddress(const char *str);
+
+/**
+ Interpret an internet address or name into an IP address in 4 byte form.
+**/
+_PUBLIC_ uint32_t interpret_addr(const char *str);
+
+/**
+ A convenient addition to interpret_addr().
+**/
+_PUBLIC_ struct in_addr interpret_addr2(const char *str);
+
+_PUBLIC_ bool is_ipaddress_v4(const char *str);
+
+
 #endif /* _SAMBA_UTIL_NET_H_ */
diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c
index ef897d4..54643d3 100644
--- a/lib/util/util_runcmd.c
+++ b/lib/util/util_runcmd.c
@@ -183,7 +183,7 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
        }
        va_end(ap);
 
-       ret = execv(state->arg0, argv);
+       ret = execvp(state->arg0, argv);
        fprintf(stderr, "Failed to exec child - %s\n", strerror(errno));
        _exit(255);
        return NULL;
diff --git a/libcli/nbt/nbtname.c b/libcli/nbt/nbtname.c
index f890b91..385905a 100644
--- a/libcli/nbt/nbtname.c
+++ b/libcli/nbt/nbtname.c
@@ -27,6 +27,7 @@
 #include "librpc/gen_ndr/ndr_nbt.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "system/locale.h"
+#include "lib/util/util_net.h"
 
 /* don't allow an unlimited number of name components */
 #define MAX_COMPONENTS 10
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 1fd6fde..f7d6ee0 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "system/network.h"
 #include "librpc/ndr/libndr.h"
+#include "lib/util/util_net.h"
 
 #define NDR_SVAL(ndr, ofs) 
(NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
 #define NDR_IVAL(ndr, ofs) 
(NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs))
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index 3f15eef..e3edc67 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -23,6 +23,7 @@
 */
 
 #include "includes.h"
+#include "../../lib/util/util_net.h"
 #include "librpc/gen_ndr/ndr_epmapper.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "librpc/rpc/dcerpc.h"
diff --git a/nsswitch/libwbclient/tests/wbclient.c 
b/nsswitch/libwbclient/tests/wbclient.c
index 6d4ea86..0074040 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -22,6 +22,7 @@
 #include "nsswitch/libwbclient/wbc_async.h"
 #include "torture/smbtorture.h"
 #include "torture/winbind/proto.h"
+#include "lib/util/util_net.h"
 
 #define WBC_ERROR_EQUAL(x,y) (x == y)
 
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 9370a17..06a5326 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -584,7 +584,7 @@ sub provision_raw_step1($$)
        gensec:require_pac = true
        log level = $ctx->{server_loglevel}
        lanman auth = Yes
-       rndc command = /bin/true
+       rndc command = true
         dns update command = $ENV{SRCDIR_ABS}/scripting/bin/samba_dnsupdate -s 
$ctx->{smb_conf} --all-interfaces --use-file=$ctx->{dns_host_file}
         resolv:host file = $ctx->{dns_host_file}
 ";
diff --git a/source4/auth/gensec/gensec_gssapi.c 
b/source4/auth/gensec/gensec_gssapi.c
index a50190f..6d59bbe 100644
--- a/source4/auth/gensec/gensec_gssapi.c
+++ b/source4/auth/gensec/gensec_gssapi.c
@@ -40,6 +40,7 @@
 #include <gssapi/gssapi_krb5.h>
 #include <gssapi/gssapi_spnego.h>
 #include "auth/gensec/gensec_gssapi.h"
+#include "lib/util/util_net.h"
 
 static size_t gensec_gssapi_max_input_size(struct gensec_security 
*gensec_security);
 static size_t gensec_gssapi_max_wrapped_size(struct gensec_security 
*gensec_security);
diff --git a/source4/auth/gensec/gensec_krb5.c 
b/source4/auth/gensec/gensec_krb5.c
index e8beb4c..9a96e5e 100644
--- a/source4/auth/gensec/gensec_krb5.c
+++ b/source4/auth/gensec/gensec_krb5.c
@@ -35,6 +35,7 @@
 #include "auth/gensec/gensec_proto.h"
 #include "param/param.h"
 #include "auth/auth_sam_reply.h"
+#include "lib/util/util_net.h"
 
 enum GENSEC_KRB5_STATE {
        GENSEC_KRB5_SERVER_START,
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c 
b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 8b4e012..75aed6a 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -2338,6 +2338,10 @@ static int replmd_delete(struct ldb_module *module, 
struct ldb_request *req)
                "trustType", "trustAttributes", "userAccountControl", 
"uSNChanged", "uSNCreated", "whenCreated",
                "whenChanged", NULL};
        unsigned int i, el_count = 0;
+       enum deletion_state { OBJECT_NOT_DELETED=1, OBJECT_DELETED=2, 
OBJECT_RECYCLED=3,
+                                               OBJECT_TOMBSTONE=4, 
OBJECT_REMOVED=5 };
+       enum deletion_state deletion_state, next_deletion_state;
+       bool enabled;
 
        if (ldb_dn_is_special(req->op.del.dn)) {
                return ldb_next_request(module, req);
@@ -2368,12 +2372,39 @@ static int replmd_delete(struct ldb_module *module, 
struct ldb_request *req)
        }
        old_msg = res->msgs[0];
 
+
+       ret = dsdb_recyclebin_enabled(module, &enabled);
+       if (ret != LDB_SUCCESS) {
+               talloc_free(tmp_ctx);
+               return ret;
+       }
+
        if (ldb_msg_check_string_attribute(old_msg, "isDeleted", "TRUE")) {
+               if (!enabled) {
+                       deletion_state = OBJECT_TOMBSTONE;
+                       next_deletion_state = OBJECT_REMOVED;
+               } else if (ldb_msg_check_string_attribute(old_msg, 
"isRecycled", "TRUE")) {
+                       deletion_state = OBJECT_RECYCLED;
+                       next_deletion_state = OBJECT_REMOVED;
+               } else {
+                       deletion_state = OBJECT_DELETED;
+                       next_deletion_state = OBJECT_RECYCLED;
+               }
+       } else {
+               deletion_state = OBJECT_NOT_DELETED;
+               if (enabled) {
+                       next_deletion_state = OBJECT_DELETED;
+               } else {
+                       next_deletion_state = OBJECT_TOMBSTONE;
+               }
+       }
+
+       if (next_deletion_state == OBJECT_REMOVED) {
                struct auth_session_info *session_info =
-                       (struct auth_session_info *)ldb_get_opaque(ldb, 
"sessionInfo");
+                               (struct auth_session_info *)ldb_get_opaque(ldb, 
"sessionInfo");
                if (security_session_user_level(session_info) != 
SECURITY_SYSTEM) {
                        ldb_asprintf_errstring(ldb, "Refusing to delete deleted 
object %s",
-                                              
ldb_dn_get_linearized(old_msg->dn));
+                                       ldb_dn_get_linearized(old_msg->dn));
                        return LDB_ERR_UNWILLING_TO_PERFORM;
                }
 
@@ -2382,36 +2413,56 @@ static int replmd_delete(struct ldb_module *module, 
struct ldb_request *req)
                return ldb_next_request(module, req);
        }
 
-       /* work out where we will be renaming this object to */
-       ret = dsdb_get_deleted_objects_dn(ldb, tmp_ctx, old_dn, &new_dn);
-       if (ret != LDB_SUCCESS) {
-               /* this is probably an attempted delete on a partition
-                * that doesn't allow delete operations, such as the
-                * schema partition */
-               ldb_asprintf_errstring(ldb, "No Deleted Objects container for 
DN %s",
-                                      ldb_dn_get_linearized(old_dn));
-               talloc_free(tmp_ctx);
-               return LDB_ERR_UNWILLING_TO_PERFORM;
-       }
-
        rdn_name = ldb_dn_get_rdn_name(old_dn);
        rdn_value = ldb_dn_get_rdn_val(old_dn);
 
-       /* get the objects GUID from the search we just did */
-       guid = samdb_result_guid(old_msg, "objectGUID");
-
-       /* Add a formatted child */
-       retb = ldb_dn_add_child_fmt(new_dn, "%s=%s\\0ADEL:%s",
-                                   rdn_name,
-                                   rdn_value->data,
-                                   GUID_string(tmp_ctx, &guid));
-       if (!retb) {
-               DEBUG(0,(__location__ ": Unable to add a formatted child to dn: 
%s",
-                               ldb_dn_get_linearized(new_dn)));
+       msg = ldb_msg_new(tmp_ctx);
+       if (msg == NULL) {
+               ldb_module_oom(module);
                talloc_free(tmp_ctx);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
+       msg->dn = old_dn;
+
+       if (deletion_state == OBJECT_NOT_DELETED){
+               /* work out where we will be renaming this object to */
+               ret = dsdb_get_deleted_objects_dn(ldb, tmp_ctx, old_dn, 
&new_dn);
+               if (ret != LDB_SUCCESS) {
+                       /* this is probably an attempted delete on a partition
+                        * that doesn't allow delete operations, such as the
+                        * schema partition */
+                       ldb_asprintf_errstring(ldb, "No Deleted Objects 
container for DN %s",
+                                                  
ldb_dn_get_linearized(old_dn));
+                       talloc_free(tmp_ctx);
+                       return LDB_ERR_UNWILLING_TO_PERFORM;
+               }
+
+               /* get the objects GUID from the search we just did */
+               guid = samdb_result_guid(old_msg, "objectGUID");
+
+               /* Add a formatted child */
+               retb = ldb_dn_add_child_fmt(new_dn, "%s=%s\\0ADEL:%s",
+                                               rdn_name,
+                                               rdn_value->data,
+                                               GUID_string(tmp_ctx, &guid));
+               if (!retb) {
+                       DEBUG(0,(__location__ ": Unable to add a formatted 
child to dn: %s",
+                                       ldb_dn_get_linearized(new_dn)));
+                       talloc_free(tmp_ctx);
+                       return LDB_ERR_OPERATIONS_ERROR;
+               }
+
+               ret = ldb_msg_add_string(msg, "isDeleted", "TRUE");
+               if (ret != LDB_SUCCESS) {
+                       DEBUG(0,(__location__ ": Failed to add isDeleted string 
to the msg\n"));
+                       ldb_module_oom(module);
+                       talloc_free(tmp_ctx);
+                       return ret;
+               }
+               msg->elements[el_count++].flags = LDB_FLAG_MOD_ADD;
+       }
+
        /*
          now we need to modify the object in the following ways:
 
@@ -2429,30 +2480,22 @@ static int replmd_delete(struct ldb_module *module, 
struct ldb_request *req)
          see MS-ADTS "Tombstone Requirements" section 3.1.1.5.5.1.1
         */
 
-       msg = ldb_msg_new(tmp_ctx);
-       if (msg == NULL) {
-               ldb_module_oom(module);
-               talloc_free(tmp_ctx);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-
-       msg->dn = old_dn;
-
-       ret = ldb_msg_add_string(msg, "isDeleted", "TRUE");
+       /* we need the storage form of the parent GUID */
+       ret = dsdb_module_search_dn(module, tmp_ctx, &parent_res,
+                                   ldb_dn_get_parent(tmp_ctx, old_dn), NULL,
+                                   DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT |
+                                   DSDB_SEARCH_REVEAL_INTERNALS|
+                                   DSDB_SEARCH_SHOW_DELETED);
        if (ret != LDB_SUCCESS) {
-               DEBUG(0,(__location__ ": Failed to add isDeleted string to the 
msg\n"));
-               ldb_module_oom(module);
                talloc_free(tmp_ctx);
                return ret;
        }
-       msg->elements[el_count++].flags = LDB_FLAG_MOD_ADD;
 
-       /* we also mark it as recycled, meaning this object can't be
-          recovered (we are stripping its attributes) */
-       if (dsdb_functional_level(ldb) >= DS_DOMAIN_FUNCTION_2008_R2) {
-               ret = ldb_msg_add_string(msg, "isRecycled", "TRUE");
+       if (deletion_state == OBJECT_NOT_DELETED){
+               ret = ldb_msg_add_steal_string(msg, "lastKnownParent",
+                                                  
ldb_dn_get_extended_linearized(tmp_ctx, parent_res->msgs[0]->dn, 1));
                if (ret != LDB_SUCCESS) {
-                       DEBUG(0,(__location__ ": Failed to add isRecycled 
string to the msg\n"));
+                       DEBUG(0,(__location__ ": Failed to add lastKnownParent 
string to the msg\n"));
                        ldb_module_oom(module);
                        talloc_free(tmp_ctx);
                        return ret;
@@ -2460,79 +2503,109 @@ static int replmd_delete(struct ldb_module *module, 
struct ldb_request *req)
                msg->elements[el_count++].flags = LDB_FLAG_MOD_ADD;
        }
 
-       /* we need the storage form of the parent GUID */
-       ret = dsdb_module_search_dn(module, tmp_ctx, &parent_res,
-                                   ldb_dn_get_parent(tmp_ctx, old_dn), NULL,
-                                   DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT |
-                                   DSDB_SEARCH_REVEAL_INTERNALS);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(tmp_ctx);
-               return ret;
-       }
+       switch (next_deletion_state){
 
-       ret = ldb_msg_add_steal_string(msg, "lastKnownParent",
-                                      ldb_dn_get_extended_linearized(tmp_ctx, 
parent_res->msgs[0]->dn, 1));
-       if (ret != LDB_SUCCESS) {
-               DEBUG(0,(__location__ ": Failed to add lastKnownParent string 
to the msg\n"));
-               ldb_module_oom(module);
-               talloc_free(tmp_ctx);
-               return ret;
-       }
-       msg->elements[el_count++].flags = LDB_FLAG_MOD_ADD;
+       case OBJECT_DELETED:
 
-       /* work out which of the old attributes we will be removing */
-       for (i=0; i<old_msg->num_elements; i++) {
-               const struct dsdb_attribute *sa;
-               el = &old_msg->elements[i];
-               sa = dsdb_attribute_by_lDAPDisplayName(schema, el->name);
-               if (!sa) {
+               ret = ldb_msg_add_value(msg, "msDS-LastKnownRDN", rdn_value, 
NULL);
+               if (ret != LDB_SUCCESS) {
+                       DEBUG(0,(__location__ ": Failed to add 
msDS-LastKnownRDN string to the msg\n"));
+                       ldb_module_oom(module);
                        talloc_free(tmp_ctx);
-                       return LDB_ERR_OPERATIONS_ERROR;
+                       return ret;
                }
-               if (ldb_attr_cmp(el->name, rdn_name) == 0) {
-                       /* don't remove the rDN */
-                       continue;
+               msg->elements[el_count++].flags = LDB_FLAG_MOD_ADD;
+
+               ret = ldb_msg_add_empty(msg, "objectCategory", 
LDB_FLAG_MOD_DELETE, NULL);
+               if (ret != LDB_SUCCESS) {
+                       talloc_free(tmp_ctx);
+                       ldb_module_oom(module);
+                       return ret;
                }
 
-               if (sa->linkID && sa->linkID & 1) {
-                       ret = replmd_delete_remove_link(module, schema, old_dn, 
el, sa);
+               ret = ldb_msg_add_empty(msg, "sAMAccountType", 
LDB_FLAG_MOD_DELETE, NULL);
+               if (ret != LDB_SUCCESS) {
+                       talloc_free(tmp_ctx);
+                       ldb_module_oom(module);
+                       return ret;
+               }
+
+               break;
+
+       case OBJECT_RECYCLED:
+       case OBJECT_TOMBSTONE:
+
+               /* we also mark it as recycled, meaning this object can't be
+                  recovered (we are stripping its attributes) */
+               if (dsdb_functional_level(ldb) >= DS_DOMAIN_FUNCTION_2008_R2) {
+                       ret = ldb_msg_add_string(msg, "isRecycled", "TRUE");


-- 
Samba Shared Repository

Reply via email to