diff options
-rw-r--r-- | source4/scripting/bin/samba3dump | 58 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_samba3.c | 2 |
2 files changed, 40 insertions, 20 deletions
diff --git a/source4/scripting/bin/samba3dump b/source4/scripting/bin/samba3dump index 059af26e7e..3960962f8b 100644 --- a/source4/scripting/bin/samba3dump +++ b/source4/scripting/bin/samba3dump @@ -57,20 +57,25 @@ function print_samba3_policy(pol) function print_samba3_sam(samba3) { + var i; print_header("SAM Database"); - for (a in samba3.samaccounts) { + for (i in samba3.samaccounts) { + var a = samba3.samaccounts[i]; printf("%d: %s\n", a.user_rid, a.username); } } function print_samba3_shares(samba3) { + var i, j; print_header("Configured shares"); - for (s in samba3.shares) { + for (i in samba3.shares) { + var s = samba3.shares[i]; printf("--- %s ---\n", s.name); - for (p in s.parameters) { + for (j in s.parameters) { + var p = s.parameters[j]; printf("\t%s = %s\n", p.name, p.value); } @@ -80,6 +85,7 @@ function print_samba3_shares(samba3) function print_samba3_secrets(secrets) { + var i; print_header("Secrets"); println("IPC Credentials:"); @@ -92,13 +98,15 @@ function print_samba3_secrets(secrets) printf(" Domain: %s\n\n", secrets.ipc_cred.get_domain); println("LDAP passwords:"); - for (pw in secrets.ldappws) { + for (i in secrets.ldappws) { + var pw = secrets.ldappws[i]; printf("\t%s -> %s\n", pw.dn, pw.password); } println(""); println("Domains:"); - for (d in secrets.domains) { + for (i in secrets.domains) { + var d = secrets.domains[i]; printf("\t--- %s ---\n", d.name); printf("\tSID: %s\n", d.sid); printf("\tGUID: %s\n", d.guid); @@ -108,7 +116,8 @@ function print_samba3_secrets(secrets) } println("Trusted domains:"); - for (td in secrets.trusted_domains) { + for (i in secrets.trusted_domains) { + var td = secrets.trusted_domains[i]; for (j = 0; j < td.uni_name_len; j++) { printf("\t--- %s ---\n", td.uni_name[j]); } @@ -120,11 +129,14 @@ function print_samba3_secrets(secrets) function print_samba3_regdb(regdb) { + var i, j; print_header("Registry"); - for (k in regdb.keys) { + for (i in regdb.keys) { + var k = regdb.keys[i]; printf("%s\n", k.name); - for (v in k.values) { + for (j in k.values) { + var v = k.values[j]; printf("\t%s: type %d, length %d\n", v.name, v.type, v.data.length); } } @@ -132,19 +144,22 @@ function print_samba3_regdb(regdb) function print_samba3_winsdb(samba3) { + var i; print_header("WINS Database"); - for (e in samba3.winsentries) { - printf("%s, nb_flags: %x, type: %d, ttl: %lu, %d ips\n", e.name, e.nb_flags, e.type, e.ttl, e.ip_count); + for (i in samba3.winsentries) { + var e = samba3.winsentries[i]; + printf("%s, nb_flags: %x, type: %d, ttl: %lu, %d ips, fst: %s\n", e.name, e.nb_flags, e.type, e.ttl, e.ips.length, e.ips[0]); } } function print_samba3_groupmappings(groupdb) { - int i; + var i; print_header("Group Mappings"); - for (g in groupdb.groupmappings) { + for (i in groupdb.groupmappings) { + var g = groupdb.groupmappings[i]; printf("\t--- Group: %s ---\n", g.nt_name); printf("\tComment: %s\n", g.comment); printf("\tGID: %d\n", g.gid); @@ -155,10 +170,11 @@ function print_samba3_groupmappings(groupdb) function print_samba3_aliases(groupdb) { - for (a in groupdb.aliases) { - int j; + var i, j; + for (i in groupdb.aliases) { + var a = groupdb.aliases[i]; printf("\t--- Alias: %s ---\n", a.sid); - for (j = 0; j < a.member_count; j++) { + for (j in a.members) { printf("\t%s\n", a.members[j]); } } @@ -166,18 +182,20 @@ function print_samba3_aliases(groupdb) function print_samba3_idmapdb(idmapdb) { + var i; print_header("Winbindd SID<->GID/UID mappings"); printf("User High Water Mark: %d\n", idmapdb.user_hwm); printf("Group High Water Mark: %d\n\n", idmapdb.group_hwm); - for (e in idmapdb.mappings) { + for (i in idmapdb.mappings) { + var e = idmapdb.mappings[i]; printf("%s -> ", e.sid); - if (e.type == IDMAP_GROUP) { - printf("GID %d", e.unix_id); + if (e.type == e.IDMAP_GROUP) { + printf("GID %d\n", e.unix_id); } else { - printf("UID %d", e.unix_id); + printf("UID %d\n", e.unix_id); } } } @@ -192,7 +210,7 @@ function print_samba3(samba3) print_samba3_secrets(samba3.secrets); print_samba3_groupmappings(samba3); print_samba3_aliases(samba3); - print_samba3_idmapdb(samba3.idmap); + print_samba3_idmapdb(samba3.idmapdb); } function print_samba3_summary(samba3) diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c index 7a7175fe5c..bad8a7e58e 100644 --- a/source4/scripting/ejs/smbcalls_samba3.c +++ b/source4/scripting/ejs/smbcalls_samba3.c @@ -100,6 +100,8 @@ static struct MprVar mprIdmapDb(struct samba3_idmapdb *db) char *tmp; mp = mprObject("idmap"); + mprSetVar(&mp, "IDMAP_GROUP", mprCreateIntegerVar(IDMAP_GROUP)); + mprSetVar(&mp, "IDMAP_USER", mprCreateIntegerVar(IDMAP_USER)); mprSetVar(&mp, "type", mprCreateIntegerVar(db->mappings[i].type)); mprSetVar(&mp, "unix_id", mprCreateIntegerVar(db->mappings[i].unix_id)); |