rem: "nbt port", "dgram port", "cldap port", "krb5 port", "web port", "tls enabled", "tls keyfile", "tls certfile", "tls cafile", "tls crlfile", "swat directory", 
context: function upgrade_sam_account(acc,domaindn){	var ldif = sprintf("dn: cn=%s,%sobjectClass: topobjectClass: personobjectClass: userlastLogon: %dlastLogoff: %dunixName: %sname: %scn: %sdescription: %sprimaryGroupID: %dbadPwdcount: %dlogonCount: %dsamba3Domain: %ssamba3DirDrive: %ssamba3MungedDial: %ssamba3Homedir: %ssamba3LogonScript: %ssamba3ProfilePath: %ssamba3Workstations: %ssamba3KickOffTime: %dsamba3BadPwdTime: %dsamba3PassLastSetTime: %dsamba3PassCanChangeTime: %dsamba3PassMustChangeTime: %dsamba3Rid: %d", 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,acc.domain, acc.dir_drive, acc.munged_dial, acc.homedir, acc.logon_script, acc.profile_path, acc.workstations, acc.kickoff_time, acc.bad_password_time, acc.pass_last_set_time, acc.pass_can_change_time, acc.pass_must_change_time, acc.user_rid); 		/* FIXME: Passwords */	return ldif;}function upgrade_sam_group(grp,domaindn){	var ldif = sprintf("dn: cn=%s,%sobjectClass: topobjectClass: groupdescription: %scn: %sobjectSid: %sunixName: FIXMEsamba3SidNameUse: %d", grp.nt_name, domaindn, grp.comment, grp.nt_name, grp.sid, grp.sid_name_use);	return ldif;}function upgrade_winbind(samba3,domaindn){	var ldif = sprintf("		dn: dc=noneuserHwm: %dgroupHwm: %d", samba3.idmap.user_hwm, samba3.idmap.group_hwm);	for (var i in samba3.idmap.mappings) {		var m = samba3.idmap.mappings[i];		ldif = ldif + sprintf("dn: SID=%s,%sSID: %stype: %dunixID: %d", m.sid, domaindn, m.sid, m.type, m.unix_id);	}		return ldif;}*/function upgrade_wins(samba3){	var ldif = "";	for (i in samba3.winsentries) {		var e = samba3.winsentries[i];				ldif = ldif + sprintf("dn: type=%d,name=%sname: %sobjectClass: winsnbFlags: %xexpires: %s", e.type, e.name, e.name, e.type, e.nb_flags, sys.ldaptime(e.ttl));		for (var i in e.ips) {			ldif = ldif + sprintf("address: %s\n", e.ips[i]);		}	}	return ldif;}function upgrade_provision(samba3){	var subobj = new Object();	var nss = nss_init();	var lp = loadparm_init();	var rdn_list;	var domainname = samba3.get_param("global", "workgroup");	if (domainname == undefined) {		domainname = samba3.secrets.domains[0].name;		println("No domain specified in smb.conf file, assuming '" + domainname + "'");	}		var domsec = samba3.find_domainsecrets(domainname);	var hostsec = samba3.find_domainsecrets(hostname());	var realm = samba3.get_param("global", "realm");	if (realm == undefined) {		realm = domainname;		println("No realm specified in smb.conf file, assuming '" + realm + "'");	}	random_init(local);	subobj.REALM        = realm;	subobj.DOMAIN       = domainname;	subobj.HOSTNAME     = hostname();	assert(subobj.REALM);	assert(subobj.DOMAIN);	assert(subobj.HOSTNAME);	subobj.HOSTIP       = hostip();	if (domsec != undefined) {		subobj.DOMAINGUID   = domsec.guid;		subobj.DOMAINSID    = domsec.sid;	} else {		println("Can't find domain secrets for '" + domainname + "'; using random SID and GUID");		subobj.DOMAINGUID = randguid();		subobj.DOMAINSID = randsid();	}		if (hostsec) {		subobj.HOSTGUID     = hostsec.guid;	} else {		subobj.HOSTGUID = randguid();	}	subobj.INVOCATIONID = randguid();	subobj.KRBTGTPASS   = randpass(12);	subobj.MACHINEPASS  = randpass(12);	subobj.ADMINPASS    = randpass(12);	subobj.DEFAULTSITE  = "Default-First-Site-Name";	subobj.NEWGUID      = randguid;	subobj.NTTIME       = nttime;	subobj.LDAPTIME     = ldaptime;	subobj.DATESTRING   = datestring;	subobj.USN          = nextusn;	subobj.ROOT         = findnss(nss.getpwnam, "root");	subobj.NOBODY       = findnss(nss.getpwnam, "nobody");	subobj.NOGROUP      = findnss(nss.getgrnam, "nogroup", "nobody");	subobj.WHEEL        = findnss(nss.getgrnam, "wheel", "root");	subobj.USERS        = findnss(nss.getgrnam, "users", "guest", "other");	subobj.DNSDOMAIN    = strlower(subobj.REALM);	subobj.DNSNAME      = sprintf("%s.%s", 				      strlower(subobj.HOSTNAME), 				      subobj.DNSDOMAIN);	subobj.BASEDN       = "DC=" + join(",DC=", split(".", subobj.REALM));	rdn_list = split(".", subobj.REALM);	return subobj;}var keep = new Array(	"dos charset", 	"unix charset",	"display charset",	"comment",	"path",	"directory",	"workgroup",	"realm",	"netbios name",	"netbios aliases",	"netbios scope",	"server string",	"interfaces",	"bind interfaces only",	"security",	"auth methods",	"encrypt passwords",	"null passwords",	"obey pam restrictions",	"password server",	"smb passwd file",	"sam database",	"spoolss database",	"wins database",	"private dir",	"passwd chat",	"password level",	"lanman auth",	"ntlm auth",	"client NTLMv2 auth",	"client lanman auth",	"client plaintext auth",	"read only",	"hosts allow",	"hosts deny",	"log level",	"debuglevel",	"log file",	"smb ports",	"nbt port",	"dgram port",	"cldap port",	"krb5 port",	"web port",	"tls enabled",	"tls keyfile",	"tls certfile",	"tls cafile",	"tls crlfile",	"swat directory",	"large readwrite",	"max protocol",	"min protocol",	"unicode",	"read raw",	"write raw",	"disable netbios",	"nt status support",	"announce version",	"announce as",	"max mux",	"max xmit",	"name resolve order",	"max wins ttl",	"min wins ttl",	"time server",	"unix extensions",	"use spnego",	"server signing",	"client signing",	"rpc big endian",	"max connections",	"paranoid server security",	"socket options",	"strict sync",	"case insensitive filesystem",	"max print jobs",	"printable",	"print ok",	"printer name",	"printer",	"map system",	"map hidden",	"map archive",	"domain logons",	"preferred master",	"prefered master",	"local master",	"domain master",	"browseable",	"browsable",	"wins server",	"wins support",	"csc policy",	"strict locking",	"config file",	"preload",	"auto services",	"lock dir",	"lock directory",	"pid directory",	"js include",	"setup directory",	"socket address",	"-valid",	"copy",	"include",	"available",	"volume",	"fstype",	"panic action",	"msdfs root",	"host msdfs",	"winbind separator");function upgrade_smbconf(samba3){	//FIXME}function upgrade(subobj, samba3, message){	var samdb = ldb_init();	var ok = samdb.connect("sam.ldb");	assert(ok);	message("Importing account policies\n");	var ldif = upgrade_sam_policy(samba3,subobj.BASEDN);	ok = samdb.modify(ldif);	assert(ok);	// FIXME: Enable samba3sam module if original passdb backend was ldap	message("Importing users\n");	for (var i in samba3.samaccounts) {		message("... " + samba3.samaccounts[i].username + "\n");		var ldif = upgrade_sam_account(samba3.samaccounts[i],subobj.BASEDN);		ok = samdb.add(ldif);		assert(ok);	}	message("Importing groups\n");	for (var i in samba3.groupmappings) {		message("... " + samba3.groupmappings[i].nt_name + "\n");		var ldif = upgrade_sam_group(samba3.groupmappings[i],subobj.BASEDN);		ok = samdb.add(ldif);		assert(ok);	}	message("Importing registry data\n");	var hives = new Array("hkcr","hkcu","hklm","hkpd","hku","hkpt"); 	for (var i in hives) {		message("... " + hives[i] + "\n");		var regdb = ldb_init();		ok = regdb.connect(hives[i] + ".ldb");		assert(ok);		var ldif = upgrade_registry(samba3.registry, hives[i]);		ok = regdb.add(ldif);		assert(ok);	}	message("Importing WINS data\n");	var winsdb = ldb_init();	ok = winsdb.connect("wins.ldb");	assert(ok);	var ldif = upgrade_wins(samba3);	ok = winsdb.add(ldif);	assert(ok);	return ok;}
meta: 1914	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/1914/ec934124db8a5234d8c83799a23c7bdced5dd95a/upgrade.js/buggy/source4/scripting/libjs/upgrade.js