summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-15 10:15:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:44:46 -0500
commitc3c26c90088141272affb591702f3c2124eec89f (patch)
tree8bca1ba93e5f244425b23fc0eeee677b1484efce /source4/scripting
parentdab2b6858315909cd26fa5ce5aba84b6b4c3e62e (diff)
downloadsamba-c3c26c90088141272affb591702f3c2124eec89f.tar.gz
samba-c3c26c90088141272affb591702f3c2124eec89f.tar.bz2
samba-c3c26c90088141272affb591702f3c2124eec89f.zip
r11087: - add type,name,scope as attributes to winsRecords,
so you can use them in search filters, only for administration not used inside the winserver code - fix the samba3 ugrade scripts to create a correct samba4 wins.ldb metze (This used to be commit 9f3b6746d86583c48097da48c28f50f075bbd3e3)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/libjs/upgrade.js65
1 files changed, 58 insertions, 7 deletions
diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js
index 6109371338..60a9725b43 100644
--- a/source4/scripting/libjs/upgrade.js
+++ b/source4/scripting/libjs/upgrade.js
@@ -228,22 +228,73 @@ unixID: %d", m.sid, domaindn, m.sid, m.type, m.unix_id);
function upgrade_wins(samba3)
{
var ldif = "";
+ var version_id = 0;
+
for (i in samba3.winsentries) {
+ var rType;
+ var rState;
+ var nType;
+ var numIPs = 0;
var e = samba3.winsentries[i];
-
+ var now = sys.nttime();
+ var ttl = sys.unix2nttime(e.ttl);
+
+ version_id++;
+
+ for (var i in e.ips) {
+ numIPs++;
+ }
+
+ if (e.type == 0x1C) {
+ rType = 0x2;
+ } else if (sys.bitAND(e.type, 0x80)) {
+ if (numIPs > 1) {
+ rType = 0x2;
+ } else {
+ rType = 0x1;
+ }
+ } else {
+ if (numIPs > 1) {
+ rType = 0x3;
+ } else {
+ rType = 0x0;
+ }
+ }
+
+ if (ttl > now) {
+ rState = 0x0;/* active */
+ } else {
+ rState = 0x1;/* released */
+ }
+
+ nType = (sys.bitAND(e.nb_flags,0x60)>>5);
+
ldif = ldif + sprintf("
-dn: type=%d,name=%s
+dn: name:%s,type=0x%02X
+type: 0x%02X
name: %s
-objectClass: wins
-nbFlags: %x
-expires: %s
-", e.type, e.name, e.name, e.type, e.nb_flags, sys.ldaptime(e.ttl));
+objectClass: winsRecord
+recordType: %u
+recordState: %u
+nodeType: %u
+isStatic: 0
+expireTime: %s
+versionID: %llu
+", e.name, e.type, e.type, e.name,
+ rType, rState, nType,
+ sys.ldaptime(ttl), version_id);
for (var i in e.ips) {
ldif = ldif + sprintf("address: %s\n", e.ips[i]);
}
}
+ ldif = ldif + sprintf("
+dn: CN=VERSION
+objectClass: winsMaxVersion
+maxVersion: %llu
+", version_id);
+
return ldif;
}
@@ -569,7 +620,7 @@ data: %d
dn: @MODULES
changetype: modify
replace: @LIST
-@LIST: samldb,timestamps,objectguid,rdn_name,samba3sam
+@LIST: samldb,operational,objectguid,rdn_name,samba3sam
");
if (!ok) {
message("Error enabling samba3sam module: " + samdb.errstring() + "\n");