1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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 9f3b6746d8)
This commit is contained in:
Stefan Metzmacher 2005-10-15 10:15:42 +00:00 committed by Gerald (Jerry) Carter
parent dab2b68583
commit c3c26c9008
3 changed files with 66 additions and 8 deletions

View File

@ -513,6 +513,13 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb,
msg->dn = winsdb_dn(msg, rec->name);
if (msg->dn == NULL) goto failed;
ret |= ldb_msg_add_fmt(msg, "type", "0x%02X", rec->name->type);
if (rec->name->name) {
ret |= ldb_msg_add_string(msg, "name", rec->name->name);
}
if (rec->name->scope) {
ret |= ldb_msg_add_string(msg, "scope", rec->name->scope);
}
ret |= ldb_msg_add_fmt(msg, "objectClass", "winsRecord");
ret |= ldb_msg_add_fmt(msg, "recordType", "%u", rec->type);
ret |= ldb_msg_add_fmt(msg, "recordState", "%u", rec->state);

View File

@ -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");

View File

@ -75,7 +75,7 @@ var paths;
if (options.targetdir != undefined) {
paths = new Object();
paths.smbconf = sprintf("%s/smb.conf", options.targetdir);
var ldbs = new Array("hklm","hkcr","hku","hkcu","hkpd","hkpt","samdb","rootdse","secrets","winsdb");
var ldbs = new Array("hklm","hkcr","hku","hkcu","hkpd","hkpt","samdb","rootdse","secrets","wins");
for (var i in ldbs) {
var n = ldbs[i];
paths[n] = sprintf("tdb://%s/%s.ldb", options.targetdir, n);