function administrator_update(){ $samba=new samba(); $admin_password=$samba->GetAdminPassword("administrator"); if($admin_password==null){echo "No password set\n";return;} $samba->EditAdministrator("administrator",$admin_password); echo "updating administrator done...\n"; }
function GROUP_SAMBA_IDENTITY() { $page = CurrentPageName(); $tpl = new templates(); $group = new groups($_GET["gpid"]); if ($group->sambaSID == null) { echo $tpl->_ENGINE_parse_body("<div class=text-info>{not_group_samba}</div>"); return; } $samba = new samba(); $master_password = $samba->GetAdminPassword("administrator"); $sock = new sockets(); $password = urlencode(base64_encode($master_password)); $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?pdbedit-group={$group->groupName}&password={$password}"))); $html = "\n\t\t<div style='width:98%' class=form>\t\n\t\t<table>\n\t<tr>\n\t\t<td class=legend>{name}:</span></td>\n\t\t<td><strong style='font-size:12px'>{$group->groupName}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>ID:</td>\n\t\t<td><strong style='font-size:12px'>{$group->group_id}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{sambaSID}:</span></td>\n\t\t<td><strong style='font-size:12px'>{$group->sambaSID}</td>\n\t</tr>\t\n\t</table></div>\n\t<p> </p>\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{members}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; while (list($num, $ligne) = each($datas["MEMBERS"])) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t<td width=100% style='font-size:14px' nowrap>{$ligne}</a></td>\n\t\t</tr>"; } $html = $html . "</table>"; echo $tpl->_ENGINE_parse_body($html); }
function DomainAdmin_index() { $samba = new samba(); $password = $samba->GetAdminPassword("administrator"); $html = "\n\t<div class=explain>{domain_admin_text}</div>\n\t\n\t<strong style='font-size:14px'>«{$samba->main_array["global"]["workgroup"]}\\administrator» {password}</strong>\n\t<div id='DomainAdminSave'>\n\t\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password('password1', $password, "font-size:13px;padding:3px;width:120px", null, null, null, false, "DomainAdminSaveKey(event)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{confirm}:</td>\n\t\t<td>" . Field_password('password2', $password, "font-size:13px;padding:3px;width:120px", null, null, null, false, "DomainAdminSaveKey(event)") . "</td>\n\t</tr>\t\n\t<tr>\n\t<td colspan=2 align='right'>\n\t<hr>\n\t" . button("{apply}", "DomainAdminSave()") . "\n\t\n\t</tr>\n\t</table>\n\t</div>\n\t</div>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function main_pdc_root() { $samba = new samba(); $password = $samba->GetAdminPassword('administrator'); $html = "\n<table style='width:100%'>\n<tr>\n<td valign='top'><img src='img/48-samba-pdc.png'></td>\n<td valign='top' width=99%>\n\t<H5>{root_password}</H5>\n\t<p class=caption>{root_password_text}</p>\n\t\n\t<H3>{$samba->main_array["global"]["workgroup"]}\\administrator account</H3>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td align='right' nowrap><strong>{root_password_field}:</strong></td>\n\t\t<td align='left' nowrap>" . Field_password('root_password', $password, 'width:130px') . "</strong></td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><strong>{root_password_field2}:</strong></td>\n\t\t<td align='left' nowrap>" . Field_password('root_password2', $password, 'width:130px') . "</strong></td>\n\t</tr>\t\n\t<td colspan=2 align='right'><input type='button' value='{next}»' OnClick=\"javascript:samba_pdc_step3();\"></td>\n\t</tr>\n\t</table>\n</td>\n</tr>\n</table>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function cups_add_printer_share() { $driver = $_GET["driver"]; $printer = $_GET["printer"]; $samba = new samba(); $password = $samba->GetAdminPassword("administrator"); $sock = new sockets(); $response = $sock->getfile("InstallPrinterShare:{$printer};{$driver};{$password}"); }
die; } if ($argv[1] == '--groups') { SMBGROUPS(); die; } exec('/usr/share/artica-postfix/bin/artica-install --samba-reconfigure 2>&1', $reconfigure); $ldap = new clladp(); $samba = new samba(); $sid = $ldap->LOCAL_SID(); $samba->ChangeSID($sid); SMBCHANGECOMPUTERS(); SMBGROUPS(); SMBCHANGEUSERS(); SMBRESTART(); $unix = new unix(); $net = $unix->find_program("net"); $adminpass = $samba->GetAdminPassword("administrator"); $adminpass = $unix->shellEscapeChars($adminpass); $logs = @implode("\n", $GLOBALS["MEMORY_LOGS"]); exec('/ect/init.d/artica-postfix restart samba 2>&1', $restart); $text = "\nSamba was resetted with a new sid : {$sid}\nComputers and users was rebuilded with this new SID and samba was restarted. \n\nReconfigure :\n------------------------------\n" . @implode("\n", $reconfigure) . "\n\nRestart :\n------------------------------\n" . @implode("\n", $restart) . "\n\nUsers/groups synchronize details:\n-------------------------------\n{$logs}\n"; if ($GLOBALS["OUTPUT"]) { echo "\n\n\nSamba was synchronized with new sid {$sid}\n{$text}\n"; } $unix = new unix(); $unix->send_email_events("Samba was synchronized with new sid {$sid}", $text, "samba"); shell_exec("{$net} groupmap add ntgroup=\"Domain Admins\" unixgroup=root rid=512 type=d -U administrator%{$adminpass} &"); shell_exec("{$net} groupmap add ntgroup=\"Domain Users\" unixgroup=users rid=513\t type=d -U administrator%{$adminpass} &"); shell_exec("{$net} groupmap add ntgroup=\"Domain Guests\" unixgroup=users rid=514 type=d -U administrator%{$adminpass} &"); die;
function reconfigure() { $unix = new unix(); $sock = new sockets(); $EnableSambaActiveDirectory = $sock->GET_INFO("EnableSambaActiveDirectory"); if ($EnableSambaActiveDirectory == 1) { activedirectory(); } CheckExistentDirectories(); $samba = new samba(); @file_put_contents("/etc/samba/smb.conf", $samba->BuildConfig()); if (!is_file("/var/lib/samba/usershares/data")) { @mkdir("/var/lib/samba/usershares", null, true); @file_put_contents("/var/lib/samba/usershares/data", "#"); } SambaAudit(); ParseHomeDirectories(); $samba = new samba(); $net = $unix->find_program("net"); $master_password = $samba->GetAdminPassword("administrator"); $SambaEnableEditPosixExtension = $sock->GET_INFO("SambaEnableEditPosixExtension"); if ($SambaEnableEditPosixExtension == 1) { $cmd = "{$net} idmap secret {$samba->main_array["global"]["workgroup"]} {$master_password} >/dev/null 2>&1 &"; shell_exec($cmd); $cmd = "{$net} idmap secret alloc {$master_password} >/dev/null 2>&1 &"; } if ($EnableSambaActiveDirectory == 1) { kinit(); } shell_exec("/usr/share/artica-postfix/bin/artica-install --samba-reconfigure >/dev/null 2>&1"); }