summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/ejs/smbcalls_ldb.c6
-rw-r--r--source4/scripting/ejs/smbcalls_samba3.c18
-rw-r--r--source4/scripting/libjs/provision.js3
-rw-r--r--source4/scripting/libjs/upgrade.js14
4 files changed, 28 insertions, 13 deletions
diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c
index 662da0d971..aabd43d1ac 100644
--- a/source4/scripting/ejs/smbcalls_ldb.c
+++ b/source4/scripting/ejs/smbcalls_ldb.c
@@ -264,6 +264,7 @@ static int ejs_base64encode(MprVarHandle eid, int argc, struct MprVar **argv)
}
blob = mprToDataBlob(argv[0]);
+ mprAssert(blob);
ret = ldb_base64_encode(mprMemCtx(), (char *)blob->data, blob->length);
if (!ret) {
@@ -297,7 +298,10 @@ static int ejs_base64decode(MprVarHandle eid, int argc, struct MprVar **argv)
if (ret == -1) {
mpr_Return(eid, mprCreateUndefinedVar());
} else {
- mpr_Return(eid, mprData((uint8_t *)tmp, ret));
+ DATA_BLOB blob;
+ blob.data = (uint8_t *)tmp;
+ blob.length = ret;
+ mpr_Return(eid, mprDataBlob(blob));
}
talloc_free(tmp);
diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c
index eb37168bc8..936426c2da 100644
--- a/source4/scripting/ejs/smbcalls_samba3.c
+++ b/source4/scripting/ejs/smbcalls_samba3.c
@@ -165,6 +165,7 @@ static struct MprVar mprDomainSecrets(struct samba3_domainsecrets *ds)
{
struct MprVar v, e = mprObject("domainsecrets");
char *tmp;
+ DATA_BLOB blob;
mprSetVar(&e, "name", mprString(ds->name));
@@ -183,7 +184,9 @@ static struct MprVar mprDomainSecrets(struct samba3_domainsecrets *ds)
v = mprObject("hash_pw");
- mprSetVar(&v, "hash", mprData(ds->hash_pw.hash, 16));
+ blob.data = ds->hash_pw.hash;
+ blob.length = 16;
+ mprSetVar(&v, "hash", mprDataBlob(blob));
mprSetVar(&v, "mod_time", mprCreateIntegerVar(ds->hash_pw.mod_time));
@@ -259,9 +262,12 @@ static struct MprVar mprSecrets(struct samba3_secrets *sec)
for (j = 0; j < 8; j++) {
struct MprVar k = mprObject("entry");
+ DATA_BLOB blob;
mprSetVar(&k, "kvno", mprCreateIntegerVar(sec->afs_keyfiles[i].entry[j].kvno));
- mprSetVar(&k, "key", mprData((uint8_t*)sec->afs_keyfiles[i].entry[j].key, 8));
+ blob.data = (uint8_t*)sec->afs_keyfiles[i].entry[j].key;
+ blob.length = 8;
+ mprSetVar(&k, "key", mprDataBlob(blob));
mprAddArray(&ks, j, k);
}
@@ -316,6 +322,7 @@ static struct MprVar mprSamAccounts(struct samba3 *samba3)
for (i = 0; i < samba3->samaccount_count; i++) {
struct samba3_samaccount *a = &samba3->samaccounts[i];
+ DATA_BLOB blob;
m = mprObject("samba3_samaccount");
@@ -343,8 +350,11 @@ static struct MprVar mprSamAccounts(struct samba3 *samba3)
mprSetVar(&m, "profile_path", mprString(a->profile_path));
mprSetVar(&m, "acct_desc", mprString(a->acct_desc));
mprSetVar(&m, "workstations", mprString(a->workstations));
- mprSetVar(&m, "lm_pw", mprData(a->lm_pw.hash, 16));
- mprSetVar(&m, "nt_pw", mprData(a->nt_pw.hash, 16));
+ blob.length = 16;
+ blob.data = a->lm_pw.hash;
+ mprSetVar(&m, "lm_pw", mprDataBlob(blob));
+ blob.data = a->nt_pw.hash;
+ mprSetVar(&m, "nt_pw", mprDataBlob(blob));
mprAddArray(&mpv, i, m);
}
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js
index b43d435ca9..9607d6f274 100644
--- a/source4/scripting/libjs/provision.js
+++ b/source4/scripting/libjs/provision.js
@@ -164,14 +164,13 @@ function setup_ldb(ldif, dbname, subobj)
erase = arguments[4];
}
- var dbfile = dbname;
var src = lp.get("setup directory") + "/" + ldif;
var data = sys.file_load(src);
data = data + extra;
data = substitute_var(data, subobj);
- var ok = ldb.connect(dbfile);
+ var ok = ldb.connect(dbname);
assert(ok);
if (erase) {
diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js
index dbf1c0f2c3..c78afd6a91 100644
--- a/source4/scripting/libjs/upgrade.js
+++ b/source4/scripting/libjs/upgrade.js
@@ -116,8 +116,6 @@ description: %s
primaryGroupID: %d
badPwdcount: %d
logonCount: %d
-ntPwdHash:: %s
-lmPwdHash:: %s
samba3Domain: %s
samba3DirDrive: %s
samba3MungedDial: %s
@@ -131,6 +129,8 @@ samba3PassLastSetTime: %d
samba3PassCanChangeTime: %d
samba3PassMustChangeTime: %d
samba3Rid: %d
+ntPwdHash:: %s
+lmPwdHash:: %s
", acc.fullname, domaindn, acc.logon_time, acc.logoff_time, acc.username, acc.nt_username,
acc.fullname, acc.acct_desc, acc.group_rid, acc.bad_password_count, acc.logon_count,
@@ -422,18 +422,20 @@ dn: @MAP=samba3sam
message("Importing users\n");
for (var i in samba3.samaccounts) {
- message("... " + samba3.samaccounts[i].username + "\n");
+ message("... " + samba3.samaccounts[i].username);
var ldif = upgrade_sam_account(samba3.samaccounts[i],subobj.BASEDN);
ok = samdb.add(ldif);
- assert(ok);
+ if (!ok) { message("... error!"); }
+ message("\n");
}
message("Importing groups\n");
for (var i in samba3.groupmappings) {
- message("... " + samba3.groupmappings[i].nt_name + "\n");
+ message("... " + samba3.groupmappings[i].nt_name);
var ldif = upgrade_sam_group(samba3.groupmappings[i],subobj.BASEDN);
ok = samdb.add(ldif);
- assert(ok);
+ if (!ok) { message("... error!"); }
+ message("\n");
}
message("Importing registry data\n");