mprAddArray(&ks, i, k);
}
+ if (i == 0) {
+ mprSetVar(&ks, "length", mprCreateIntegerVar(i));
+ }
+
mprSetVar(&mpv, "keys", ks);
return mpv;
mprAddArray(&mps, i, mp);
}
+ if (i == 0) {
+ mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
+ }
+
+
mprSetVar(&mpv, "mappings", mps);
return mpv;
mprAddArray(&mpv, i, g);
}
+ if (i == 0) {
+ mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
+ }
+
+
return mpv;
}
mprSetVar(&a, "members", am);
}
+ if (i == 0) {
+ mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
+ }
+
return mpv;
}
{
struct MprVar v, e = mprObject("domainsecrets");
char *tmp;
+ DATA_BLOB blob;
mprSetVar(&e, "name", mprString(ds->name));
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));
mprAddArray(&es, i, mprDomainSecrets(&sec->domains[i]));
}
+ if (i == 0) {
+ mprSetVar(&es, "length", mprCreateIntegerVar(i));
+ }
+
mprSetVar(&mpv, "domains", es);
es = mprObject("trusted_domains");
mprAddArray(&es, i, e);
}
+ if (i == 0) {
+ mprSetVar(&es, "length", mprCreateIntegerVar(i));
+ }
+
mprSetVar(&mpv, "trusted_domains", es);
es = mprObject("array");
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);
}
mprAddArray(&es, i, e);
}
+ if (i == 0) {
+ mprSetVar(&es, "length", mprCreateIntegerVar(i));
+ }
+
mprSetVar(&mpv, "afs_keyfiles", es);
mprSetVar(&mpv, "ipc_cred", mprCredentials(sec->ipc_cred));
static struct MprVar mprShares(struct samba3 *samba3)
{
- struct MprVar mpv = mprObject("array"), s, ps, p;
- int i, j;
+ struct MprVar mpv = mprObject("array"), s;
+ int i;
for (i = 0; i < samba3->share_count; i++) {
s = mprObject("share");
/* FIXME: secdesc */
- ps = mprObject("array");
-
- for (j = 0; j < samba3->shares[i].parameter_count; j++) {
- p = mprObject("parameter");
-
- mprSetVar(&p, "name", mprString(samba3->shares[i].parameters[j].name));
- mprSetVar(&p, "value", mprString(samba3->shares[i].parameters[j].value));
-
- mprAddArray(&ps, j, p);
- }
+ mprAddArray(&mpv, i, s);
+ }
- mprSetVar(&s, "parameters", ps);
+ if (i == 0) {
+ mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
}
return mpv;
for (i = 0; i < samba3->samaccount_count; i++) {
struct samba3_samaccount *a = &samba3->samaccounts[i];
+ DATA_BLOB blob;
m = mprObject("samba3_samaccount");
mprSetVar(&m, "profile_path", mprString(a->profile_path));
mprSetVar(&m, "acct_desc", mprString(a->acct_desc));
mprSetVar(&m, "workstations", mprString(a->workstations));
-
- /* FIXME: lm_pw_ptr, nt_pw_ptr */
+ 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);
}
+ if (i == 0) {
+ mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
+ }
+
return mpv;
}
mprAddArray(&mpv, i, w);
}
- return mpv;
-}
-
-static int ejs_get_param(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- struct samba3 *samba3;
- const char *tmp;
-
- if (argc < 2) {
- ejsSetErrorMsg(eid, "get_param invalid arguments");
- return -1;
+ if (i == 0) {
+ mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
}
- samba3 = mprGetThisPtr(eid, "samba3");
- mprAssert(samba3);
- tmp = samba3_get_param(samba3, mprToString(argv[0]), mprToString(argv[1]));
-
- if (tmp == NULL) {
- mpr_Return(eid, mprCreateUndefinedVar());
- } else {
- mpr_Return(eid, mprString(tmp));
- }
-
- return 0;
+ return mpv;
}
static int ejs_find_domainsecrets(MprVarHandle eid, int argc, struct MprVar **argv)
return 0;
}
-
-
/*
initialise samba3 ejs subsystem
+
+ samba3 = samba3_read(libdir,smbconf)
*/
static int ejs_samba3_read(MprVarHandle eid, int argc, struct MprVar **argv)
{
return -1;
}
- status = samba3_read(mprToString(argv[0]), mprToString(argv[0]), mprMemCtx(), &samba3);
+ status = samba3_read(mprToString(argv[0]), mprToString(argv[1]), mprMemCtx(), &samba3);
if (NT_STATUS_IS_ERR(status)) {
ejsSetErrorMsg(eid, "samba3_read: error");
mprSetVar(&mpv, "idmapdb", mprIdmapDb(&samba3->idmap));
mprSetVar(&mpv, "policy", mprPolicy(&samba3->policy));
mprSetVar(&mpv, "registry", mprRegistry(&samba3->registry));
- mprSetCFunction(&mpv, "get_param", ejs_get_param);
+ mprSetVar(&mpv, "configuration", mprParam(samba3->configuration));
mprSetCFunction(&mpv, "find_domainsecrets", ejs_find_domainsecrets);
mpr_Return(eid, mpv);