1 <% page_header("columns", "Upgrade", "install");
3 /* frontend to Samba3 upgrade.
5 (C) Jelmer Vernooij 2005
6 Published under the GNU GPL
9 include("/scripting/forms.js");
10 libinclude("base.js");
11 libinclude("provision.js");
12 libinclude("upgrade.js");
15 <h1>Import from Samba3</h1>
18 if ((session.authinfo.user_class == "ADMINISTRATOR")
19 || (session.authinfo.user_class == "SYSTEM")) {
21 if (form['submit'] == "Cancel") {
25 function confirm_form()
27 var samba3 = samba3_read(form['LIBDIR'], form['SMBCONF']);
29 var subobj = upgrade_provision(samba3);
30 var f = FormObj("Import from Samba3", 0, 2);
31 subobj.ADMINPASS = "";
33 f.add("REALM", "Realm");
34 f.add("DOMAIN", "Domain Name");
35 f.add("HOSTNAME", "Hostname");
36 f.add("ADMINPASS", "Administrator Password", "password");
37 f.add("CONFIRM", "Confirm Password", "password");
38 f.add("DOMAINSID", "Domain SID");
39 f.add("HOSTGUID", "Host GUID");
40 f.add("HOSTIP", "Host IP");
41 f.add("DEFAULTSITE", "Default Site");
43 for (i=0;i<f.element.length;i++) {
44 f.element[i].value = subobj[f.element[i].name];
47 f.add("SMBCONF", "", "hidden", form['SMBCONF']);
48 f.add("LIBDIR", "", "hidden", form['LIBDIR']);
50 f.submit[0] = "Continue";
51 f.submit[1] = "Cancel";
55 if (form['submit'] == "Import") {
57 } else if (form['submit'] == "Continue") {
58 var samba3 = samba3_read(form['LIBDIR'], form['SMBCONF']);
59 assert(samba3 != undefined);
60 var subobj = upgrade_provision(samba3);
65 var goodpass = (subobj.CONFIRM == subobj.ADMINPASS);
68 write("<h3>Passwords don't match. Please try again.</h3>");
70 } else if (subobj.ADMINPASS == "") {
71 write("<h3>You must choose an administrator password. Please try again.</h3>");
74 var paths = provision_default_paths(subobj);
75 if (!provision(subobj, writefln, true, paths,
76 session.authinfo.session_info, session.authinfo.credentials)) {
77 writefln("Provision failed!");
79 var ret = upgrade(subobj,samba3,message,paths,
80 session.authinfo.session_info, session.authinfo.credentials);
82 writefln("Failed to import %d entries\n", ret);
84 if (!provision_dns(subobj, writefln, paths,
85 session.authinfo.session_info, session.authinfo.credentials)) {
86 writefln("DNS Provision failed!");
88 writefln("Reloading smb.conf\n");
89 var lp = loadparm_init();
91 writefln("Upgrade Complete!");
97 var f = FormObj("Import from Samba3", 0, 2);
99 f.add("SMBCONF", "smb.conf file", "text", "/etc/samba/smb.conf");
100 f.add("LIBDIR", "Lib directory", "text", "/var/lib/samba");
101 f.submit[0] = "Import";
102 f.submit[1] = "Cancel";
104 write('<p>Warning: This will erase your current configuration!</p>');