_("Your account"))); dual_begin(array()); print("

" . _("Home") . " / " . _("Your account") . "

\n"); print("

" . _("You have not authenticated yourself to the system yet with your") . " " . _("username") . " " . _("and") . " " . _("password") . ". " . _("You will not be able to use this section of the website without authenticating yourself first. So, please continue and login using the form on the right hand side.") . "

\n"); dual_middle(array()); show_account_details(array()); dual_end(array()); generic_footer(array()); exit; } if (($HTTP_GET_VARS["sort"] == "gid") || ($HTTP_POST_VARS["sort"] == "gid")) $sortorder = "gid"; else if (($HTTP_GET_VARS["sort"] == "gname") || ($HTTP_POST_VARS["sort"] == "gname")) $sortorder = "gname"; else if (($HTTP_GET_VARS["sort"] == "gtype") || ($HTTP_POST_VARS["sort"] == "gtype")) $sortorder = "gtype"; else $sortorder = "none"; $share_type = ""; $share_description = ""; $share_count = 0; $share_accesspublic = 0; $share_smb_oplocks = 1; $share_smb_sharename = ""; $groups_access = array(); $groups_primary = 0; $networks_count = 0; $networks_network = array(); $networks_netmask = array(); $networks_access = array(); function network_startelement($parser, $name, $attrs) { global $networks_count, $networks_name, $networks_network, $networks_netmask, $networks_access; if ($name == "NETWORK") { $networks_name[$networks_count] = $attrs["NAME"]; $networks_network[$networks_count] = $attrs["NETWORK"]; $networks_netmask[$networks_count] = $attrs["NETMASK"]; $networks_access[$networks_count] = "n "; $networks_count++; } } function network_endelement($parser, $name) { } if (is_file("/opt/openfiler/etc/networks.xml")) { $network_parser = xml_parser_create(); xml_set_element_handler($network_parser, "network_startelement", "network_endelement"); $network_fp = fopen("/opt/openfiler/etc/networks.xml", "r"); while ($network_data = fread($network_fp, 4096)) xml_parse($network_parser, $network_data, feof($network_fp)); fclose($network_fp); xml_parser_free($network_parser); } $authp = popen("/usr/bin/sudo /usr/sbin/authconfig --openfiler --kickstart", "r"); $i = 0; while (!feof($authp)) $aresult[$i++] = trim(fgets($authp, 4096)); pclose($authp); function share_startelement($parser, $name, $attrs) { global $share_type, $share_description, $share_count, $share_accesspublic, $share_smb_oplocks, $share_smb_sharename, $groups_access, $groups_primary; global $networks_name, $networks_network, $networks_access; if ($name == "KEY") { if ($attrs["NAME"] == "dirtype") $share_type = $attrs["VALUE"]; else if ($attrs["NAME"] == "description") $share_description = $attrs["VALUE"]; else if ($attrs["NAME"] == "dircount") $share_count = $attrs["VALUE"]; } else if ($name == "GROUP") { $gid = $attrs["ID"]; $str = ""; if ($attrs["READ"] == "yes") $str .= "r"; else $str .= " "; if ($attrs["WRITE"] == "yes") $str .= "w"; else $str .= " "; if ($attrs["ACCESS"] == "yes") $str .= "a"; else $str .= " "; $groups_access[$gid] = $str; } else if ($name == "PRIMARY") { $groups_primary = $attrs["ID"]; } else if ($name == "ACCESS") { if ($attrs["PUBLIC"] != "yes") $share_accesspublic = 0; else $share_accesspublic = 1; } else if ($name == "SMB") { if ($attrs["OPLOCKS"] == "no") $share_smb_oplocks = 0; else $share_smb_oplocks = 1; $share_smb_sharename = $attrs["SHARENAME"]; } else if ($name == "NETWORK") { $str = ""; if ($attrs["ACCESS"] == "rw") $str .= "w"; else if ($attrs["ACCESS"] == "ro") $str .= "o"; else $str .= "n"; if ($attrs["SMB"] == "yes") $str .= "y"; else if ($attrs["SMB"] == "ro") $str .= "o"; else $str .= " "; if ($attrs["NFS"] == "yes") $str .= "y"; else $str .= " "; if ($attrs["AFP"] == "yes") $str .= "y"; else $str .= " "; if ($attrs["NOSQUASH"] == "yes") $str .= "y"; else $str .= " "; if ($attrs["HTTP"] == "yes") $str .= "y"; else if ($attrs["HTTP"] == "ro") $str .= "o"; else $str .= " "; if ($attrs["NFSACL"] == "yes") $str .= "y"; else $str .= " "; $str .= " "; // Old oplocks field if ($attrs["INSECURE"] == "yes") $str .= "y"; else $str .= " "; if ($attrs["FTP"] == "yes") $str .= "y"; else if ($attrs["FTP"] == "ro") $str .= "o"; else $str .= " "; for ($i = 0; $i < count($networks_network); $i++) { if ($networks_name[$i] == $attrs["NETWORK"]) $networks_access[$i] = $str; } } } function share_endelement($parser, $name) { } $share_parent = ""; $share_name = ""; for ($i = (strlen($sharepath) - 2); $i >= 0; $i--) if ($sharepath[$i] == '/') { $share_parent = substr($sharepath, 0, $i); $share_name = substr($sharepath, $i + 1, (strlen($sharepath) - $i - 2)); break; } if (is_file($share_parent . "/" . $share_name . ".info.xml")) { $share_parser = xml_parser_create(); xml_set_element_handler($share_parser, "share_startelement", "share_endelement"); $share_fp = fopen($share_parent . "/" . $share_name . ".info.xml", "r"); while ($share_data = fread($share_fp, 4096)) xml_parse($share_parser, $share_data, feof($share_fp)); fclose($share_fp); xml_parser_free($share_parser); } else { header("Location: ./shares.html"); exit; } $groups_gid = array(); $groups_name = array(); $groups_members = array(); $groups_properties = array(); endgrent(); while ($group_info = getgrent()) { if (($group_info["gr_gid"] >= 500)) { array_push($groups_gid, $group_info["gr_gid"]); array_push($groups_name, $group_info["gr_name"]); array_push($groups_members, $group_info["gr_mem"]); array_push($groups_properties, "Unknown"); } } endgrent(); if (strncasecmp($aresult[9], "YES", 3) == 0) { // add NIS groups $groupp = popen("/usr/bin/sudo /usr/bin/ypcat group", "r"); $i = 0; while (!feof($groupp)) { $gresult[$i] = explode(":", fgets($groupp, 4096)); foreach (($gresult[$i]) as $gresultitem) $gresultitem = trim($gresultitem); if ((strlen($gresult[$i][0]) > 0) && ($gresult[$i][2] >= 500)) { for ($j = 0; $j < count($groups_gid); $j++) if (($groups_gid[$j] == $gresult[$i][2]) && ($groups_name[$j] == $gresult[$i][0]) && ($groups_properties[$j] == "Unknown")) $groups_properties[$j] = "NIS"; } $i++; } pclose($groupp); } if (strncasecmp($aresult[5], "YES", 3) == 0) { // add LDAP groups } if (strncasecmp($aresult[2], "YES", 3) == 0) { // add Hesiod groups } // add local groups $groupp = popen("/usr/bin/sudo /bin/cat /etc/group", "r"); $i = 0; while (!feof($groupp)) { $gresult[$i] = explode(":", fgets($groupp, 4096)); foreach (($gresult[$i]) as $gresultitem) $gresultitem = trim($gresultitem); if ((strlen($gresult[$i][0]) > 0) && ($gresult[$i][2] >= 500)) { for ($j = 0; $j < count($groups_gid); $j++) if (($groups_gid[$j] == $gresult[$i][2]) && ($groups_name[$j] == $gresult[$i][0]) && ($groups_properties[$j] == "Unknown")) $groups_properties[$j] = "Local"; } $i++; } pclose($groupp); $users_uid = array(); $users_name = array(); $users_gid = array(); $users_gname = array(); $users_type = array(); endpwent(); while ($user_info = getpwent()) { if (($user_info["pw_uid"] >= 500)) { array_push($users_uid, $user_info["pw_uid"]); array_push($users_name, $user_info["pw_name"]); $ugid = $user_info["pw_gid"]; array_push($users_gid, $ugid); $found = 0; for ($i = 0; $i < count($groups_gid); $i++) if ($groups_gid[$i] == $ugid) { array_push($users_gname, $groups_name[$i]); $found = 1; break; } if ($found == 0) array_push($users_gname, "N/A"); array_push($users_type, "Unknown"); } } endpwent(); if (strncasecmp($aresult[9], "YES", 3) == 0) { // add NIS users $userp = popen("/usr/bin/sudo /usr/bin/ypcat passwd", "r"); $i = 0; while (!feof($userp)) { $uresult[$i] = explode(":", fgets($userp, 4096)); foreach (($uresult[$i]) as $uresultitem) $uresultitem = trim($uresultitem); if ((strlen($uresult[$i][0]) > 0) && ($uresult[$i][2] >= 500)) { for ($j = 0; $j < count($users_uid); $j++) if (($users_uid[$j] == $uresult[$i][2]) && ($users_name[$j] == $uresult[$i][0]) && ($users_type[$j] == "Unknown")) $users_type[$j] = "NIS"; } $i++; } pclose($userp); } if (strncasecmp($aresult[5], "YES", 3) == 0) { // add LDAP users } if (strncasecmp($aresult[2], "YES", 3) == 0) { // add Hesiod users } // add local users $userp = popen("/usr/bin/sudo /bin/cat /etc/passwd", "r"); $i = 0; while (!feof($userp)) { $uresult[$i] = explode(":", fgets($userp, 4096)); foreach (($uresult[$i]) as $uresultitem) $uresultitem = trim($uresultitem); if ((strlen($uresult[$i][0]) > 0) && ($uresult[$i][2] >= 500)) { for ($j = 0; $j < count($users_uid); $j++) if (($users_uid[$j] == $uresult[$i][2]) && ($users_name[$j] == $uresult[$i][0]) && ($users_type[$j] == "Unknown")) $users_type[$j] = "Local"; } $i++; } pclose($userp); if ($sortorder == "gname") array_multisort($groups_name, $groups_properties, $groups_gid); else if ($sortorder == "gid") array_multisort($groups_gid, $groups_name, $groups_properties); else if ($sortorder == "gtype") array_multisort($groups_properties, $groups_gid, $groups_name); if ($actionnewsharename == "Change") { if (is_dir($share_parent . "/" . $share_name) && is_file($share_parent . "/" . $share_name . ".info.xml") && (!strstr($newsharename, '/')) && (!(is_dir($share_parent . "/" . $newsharename)))) { exec("/usr/bin/sudo /bin/mv -f " . escapeshellarg($share_parent . "/" . $share_name) . " " . escapeshellarg($share_parent . "/" . $newsharename)); exec("/usr/bin/sudo /bin/rm -f " . escapeshellarg($share_parent . "/" . $share_name . ".info.xml")); $fp = popen("/usr/bin/sudo /usr/bin/tee " . escapeshellarg($share_parent . "/" . $newsharename . ".info.xml"), "w"); fputs($fp, "\n"); fputs($fp, "\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); reset($groups_access); while (list($g_id, $g_perms) = each($groups_access)) { $xstr = "\t\n"); if ($share_accesspublic == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); if ($share_smb_oplocks == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); for ($i = 0; $i < count($networks_network); $i++) { $xstr = "\t\n"); fputs($fp, "\n"); pclose($fp); apply_configuration(array("services" => "reload", "chmod" => "no", "chmod_path" => "")); header("Location: ./shares_edit.html?sort=" . $sortorder . "&sharepath=" . urlencode($share_parent . "/" . $newsharename . "/")); exit; } header("Location: ./shares_edit.html?sort=" . $sortorder . "&sharepath=" . urlencode($share_parent . "/" . $share_name . "/")); exit; } else if ($actionnewsharedescription == "Change") { if (is_dir($share_parent . "/" . $share_name) && is_file($share_parent . "/" . $share_name . ".info.xml")) { $fp = popen("/usr/bin/sudo /usr/bin/tee " . escapeshellarg($share_parent . "/" . $share_name . ".info.xml"), "w"); fputs($fp, "\n"); fputs($fp, "\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); reset($groups_access); while (list($g_id, $g_perms) = each($groups_access)) { $xstr = "\t\n"); if ($share_accesspublic == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); if ($share_smb_oplocks == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); for ($i = 0; $i < count($networks_network); $i++) { $xstr = "\t\n"); fputs($fp, "\n"); pclose($fp); apply_configuration(array("services" => "reload", "chmod" => "no", "chmod_path" => "")); } header("Location: ./shares_edit.html?sort=" . $sortorder . "&sharepath=" . urlencode($sharepath)); exit; } else if ($actionnewsmbsharename == "Change") { if (is_dir($share_parent . "/" . $share_name) && is_file($share_parent . "/" . $share_name . ".info.xml") && (strcasecmp($newsmbsharename, "global") != 0) && (strcasecmp($newsmbsharename, "homes") != 0) && (strcasecmp($newsmbsharename, "printers") != 0)) { $fp = popen("/usr/bin/sudo /usr/bin/tee " . escapeshellarg($share_parent . "/" . $share_name . ".info.xml"), "w"); fputs($fp, "\n"); fputs($fp, "\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); reset($groups_access); while (list($g_id, $g_perms) = each($groups_access)) { $xstr = "\t\n"); if ($share_accesspublic == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); if ($share_smb_oplocks == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); for ($i = 0; $i < count($networks_network); $i++) { $xstr = "\t\n"); fputs($fp, "\n"); pclose($fp); apply_configuration(array("services" => "reload", "chmod" => "no", "chmod_path" => "")); } header("Location: ./shares_edit.html?sort=" . $sortorder . "&sharepath=" . urlencode($sharepath)); exit; } else if ($action == "setfacl") { if (is_dir($share_parent . "/" . $share_name) && is_file($share_parent . "/" . $share_name . ".info.xml")) { $fp = popen("/usr/bin/sudo /usr/bin/tee " . escapeshellarg($share_parent . "/" . $share_name . ".info.xml"), "w"); fputs($fp, "\n"); fputs($fp, "\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); for ($i = 0; $i < count($groups_name); $i++) { $xstr = "\t\n"); if (isset($shareaccesspublic)) { if ($shareaccesspublic != "public") fputs($fp, "\t\n"); else fputs($fp, "\t\n"); } if ($share_smb_oplocks == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); for ($i = 0; $i < count($networks_network); $i++) { $xstr = "\t\n"); fputs($fp, "\n"); pclose($fp); apply_configuration(array("services" => "reload", "chmod" => "yes", "chmod_path" => ($share_parent . "/" . $share_name))); } header("Location: ./shares_edit.html?sort=" . $sortorder . "&sharepath=" . urlencode($sharepath)); exit; } else if ($action == "setnacl") { if (is_dir($share_parent . "/" . $share_name) && is_file($share_parent . "/" . $share_name . ".info.xml")) { $fp = popen("/usr/bin/sudo /usr/bin/tee " . escapeshellarg($share_parent . "/" . $share_name . ".info.xml"), "w"); fputs($fp, "\n"); fputs($fp, "\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); fputs($fp, "\t\n"); reset($groups_access); while (list($g_id, $g_perms) = each($groups_access)) { $xstr = "\t\n"); if ($share_accesspublic == 0) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); if ((isset($smboplocks)) && ($smboplocks == "on")) fputs($fp, "\t\n"); else fputs($fp, "\t\n"); for ($i = 0; $i < count($networks_network); $i++) { $xstr = "\t\n"); fputs($fp, "\n"); pclose($fp); if ($smbrestart == "on") apply_configuration(array("services" => "restart", "chmod" => "no", "chmod_path" => "")); else apply_configuration(array("services" => "reload", "chmod" => "no", "chmod_path" => "")); } header("Location: ./shares_edit.html?sort=" . $sortorder . "&sharepath=" . urlencode($sharepath)); exit; } generic_header(array("title" => _("Administration Section"))); single_begin(array()); print("

" . _("Home") . " / " . _("Administration Section") . "

\n"); ?>

Welcome Administrator. The following are various system information and preferences, arranged into tabs. Please click on a tab to open up that category.

Edit share " . htmlentities($sharepath) . "\n"); print("

Please use unique SMB share name overrides as duplicates
automatically have a suffix attached to them.
Existing shares with duplicate names can have their suffix changed
every time more duplicates are created.

\n"); print("
\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); print("
Share name
Share description
Override SMB share name
\n"); print("
\n"); print("

 

\n"); print("

Back to shares list ]

\n"); print("

 

\n"); print("
\n"); print("

Group access configuration

\n"); if (($groups_primary == 0) && ($share_accesspublic == 0)) print("

A primary group has not been set yet.
This share will not be enabled until a primary group is set first
or the share has been made a guest share.

\n"); print("

If you want to see groups from network directory servers
here, please configure them in the authentication section.

\n"); print("
\n"); print("\n"); print("\n"); print("\n"); ?>
/> Public guest access
/> Controlled access
\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); } ?>
">GID ">Group Name ">Type ">PG ">NO ">RO ">RW
"); print($groups_gid[$i]); print(""); ?> "); print($groups_name[$i]); print(""); print(""); print($groups_properties[$i]); print(""); print(""); print(""); print(""); print(""); print(""); print(""); print(""); print("

\n"); print("
\n"); print("

 

\n"); print("
\n"); print("

Host access configuration

\n"); if (count($networks_network) > 0) { print("
\n"); print("\n"); print("\n"); print("\n"); // print("
\n"); print("\n"); ?> \n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); } print("
">Name ">SMB/CIFS ">NFS ">HTTP(S) / WebDAV ">FTP
"> 0) ? "checked=\"checked\"" : ""); ?> /> Enable oplocks
"> Restart services
">None ">RO ">RW ">None ">RO ">RW ">Root Access ">Export ACLs ">Run Insecure ">None ">RO ">RW ">None ">RO ">RW
" . htmlentities($networks_name[$i]) . "
\n"); // print("
\n"); print("

\n"); print("
\n"); } else print("

A list of networks have not been created yet.
You cannot configure network access control unless
you create a list of networks in the Local Networks section.
Until that time, this share will be unavailable.

\n"); print("
\n"); print("
\n"); print("

Are you sure you want to delete
this share?

\n"); print("

Yes / NO DON'T DELETE ]

\n"); print("
\n"); print("

Delete this share ]

\n"); nested_tab_end(); single_end(array()); generic_footer(array()); ?>