summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-08-11 16:19:24 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-13 12:30:49 +1000
commit93e8d3b38185538e3549aee0ee4c1134118626c9 (patch)
tree04ffd897680bcf1317cfc67fbf31775d8a4b8c39
parent00364e4e0d3d091e1b8cc9dd2b1b30eb84f2f085 (diff)
downloadsamba-93e8d3b38185538e3549aee0ee4c1134118626c9.tar.gz
samba-93e8d3b38185538e3549aee0ee4c1134118626c9.tar.bz2
samba-93e8d3b38185538e3549aee0ee4c1134118626c9.zip
s4-scripting Rename passdb upgrade routine to avoid conflict with upgradeprovision
-rw-r--r--source3/passdb/pdb_samba4.c21
-rw-r--r--source4/scripting/python/samba/upgrade.py4
-rwxr-xr-xsource4/setup/upgrade_from_s38
3 files changed, 13 insertions, 20 deletions
diff --git a/source3/passdb/pdb_samba4.c b/source3/passdb/pdb_samba4.c
index 35316d71d4..df51dc1660 100644
--- a/source3/passdb/pdb_samba4.c
+++ b/source3/passdb/pdb_samba4.c
@@ -33,6 +33,7 @@
#include "source4/auth/session.h"
#include "source4/auth/system_session_proto.h"
#include "source4/param/param.h"
+#include "source4/dsdb/common/util.h"
struct pdb_samba4_state {
struct tevent_context *ev;
@@ -338,7 +339,7 @@ static int pdb_samba4_replace_by_sam(struct pdb_samba4_state *state,
const char *pw;
struct ldb_message *msg;
struct ldb_request *req;
- unsigned int j;
+ uint32_t dsdb_flags = 0;
/* TODO: All fields :-) */
msg = ldb_msg_new(talloc_tos());
@@ -350,7 +351,8 @@ static int pdb_samba4_replace_by_sam(struct pdb_samba4_state *state,
/* build modify request */
ret = ldb_build_mod_req(&req, state->ldb, talloc_tos(), msg, NULL, NULL,
- NULL, NULL);
+ ldb_op_default_callback,
+ NULL);
if (ret != LDB_SUCCESS) {
talloc_free(msg);
return ret;
@@ -455,9 +457,8 @@ static int pdb_samba4_replace_by_sam(struct pdb_samba4_state *state,
changed_history = true;
}
if (changed_lm_pw || changed_nt_pw || changed_history) {
- ret |= ldb_request_add_control(req,
- DSDB_CONTROL_BYPASS_PASSWORD_HASH_OID,
- true, NULL);
+ /* These attributes can only be modified directly by using a special control */
+ dsdb_flags = DSDB_BYPASS_PASSWORD_HASH;
}
}
@@ -577,15 +578,7 @@ static int pdb_samba4_replace_by_sam(struct pdb_samba4_state *state,
return LDB_SUCCESS;
}
- /* mark everything here as a replace */
- for (j=0;j<msg->num_elements;j++) {
- msg->elements[j].flags = LDB_FLAG_MOD_REPLACE;
- }
-
- ret = ldb_request(state->ldb, req);
- if (ret == LDB_SUCCESS) {
- ret = ldb_wait(req->handle, LDB_WAIT_ALL);
- }
+ ret = dsdb_replace(state->ldb, msg, dsdb_flags);
if (ret != LDB_SUCCESS) {
DEBUG(0,("Failed to modify account record %s to set user attributes: %s\n",
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 0f7511aa17..1002af53ef 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -375,8 +375,8 @@ def import_registry(samba4_registry, samba3_regdb):
key_handle.set_value(value_name, value_type, value_data)
-def upgrade_provision(samba3, logger, credentials, session_info,
- smbconf, targetdir):
+def upgrade_from_passdb(samba3, logger, credentials, session_info,
+ smbconf, targetdir):
oldconf = samba3.get_conf()
if oldconf.get("domain logons") == "True":
diff --git a/source4/setup/upgrade_from_s3 b/source4/setup/upgrade_from_s3
index e0d4604b6e..e3af2019e6 100755
--- a/source4/setup/upgrade_from_s3
+++ b/source4/setup/upgrade_from_s3
@@ -26,7 +26,7 @@ sys.path.insert(0, "bin/python")
import samba
import samba.getopt as options
from samba.auth import system_session
-from samba.upgrade import upgrade_provision
+from samba.upgrade import upgrade_from_passdb
from samba.samba3 import Samba3
parser = optparse.OptionParser("upgrade_from_s3 [options] <libdir> <smbconf>")
sambaopts = options.SambaOptions(parser)
@@ -73,6 +73,6 @@ lp = sambaopts.get_loadparm()
smbconf = lp.configfile
creds = credopts.get_credentials(lp)
-upgrade_provision(samba3, logger, credentials=creds,
- session_info=system_session(), smbconf=smbconf,
- targetdir=opts.targetdir)
+upgrade_from_passdb(samba3, logger, credentials=creds,
+ session_info=system_session(), smbconf=smbconf,
+ targetdir=opts.targetdir)