index e89bab3ea9e939c26340ba83a4a0a27a576fb302..9f6a3e93d211a23bd1d48f815c3ec16ea6a064fc 100644 (file)
class servnfs extends plugin
{
class servnfs extends plugin
{
- /* CLI vars */
- var $cli_summary = "Manage server objects";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
/* attribute list for save action */
var $ignore_account = TRUE;
var $attributes = array("description","type","charset","path","option", "volume");
/* attribute list for save action */
var $ignore_account = TRUE;
var $attributes = array("description","type","charset","path","option", "volume");
{
plugin::plugin ($config, $dn);
{
plugin::plugin ($config, $dn);
- $this->types = array("NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
+ $this->types = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
if($dn){
$this->host = substr($dn, 3, strpos($dn, ',')-3);
}
if($dn){
$this->host = substr($dn, 3, strpos($dn, ',')-3);
}
$this->charsets = array();
$this->charsets = array();
- if(!file_exists("/etc/gosa/encodings")){
- print_red(_("The file '/etc/gosa/encodings' does not exist, can't get supported charsets."));
+ if(!file_exists(CONFIG_DIR."/encodings")){
+ print_red(sprintf(_("The file '%s/encodings' does not exist, can't get supported charsets."),CONFIG_DIR));
}else{
}else{
- if(!is_readable("/etc/gosa/encodings")){
- print_red(_("Can't read '/etc/gosa/encodings', please check permissions."));
+ if(!is_readable(CONFIG_DIR."/encodings")){
+ print_red(sprintf(_("Can't read '%s/encodings', please check permissions."),CONFIG_DIR));
}else{
}else{
- $fp = fopen("/etc/gosa/encodings","r");
+ $fp = fopen(CONFIG_DIR."/encodings","r");
$i = 100;
while(!feof($fp)&&$i){
$i -- ;
$i = 100;
while(!feof($fp)&&$i){
$i -- ;
list($this->name, $this->description, $this->type, $this->charset,
$this->path, $this->option, $this->volume)= split("\|",$entry."|");
$this->is_edit = true;
list($this->name, $this->description, $this->type, $this->charset,
$this->path, $this->option, $this->volume)= split("\|",$entry."|");
$this->is_edit = true;
-
+
}else{
$this->attributes[] = "name";
}
}else{
$this->attributes[] = "name";
}
+
$this->create_mount_init = $mount;
}
$this->create_mount_init = $mount;
}
$message[]=_("Please specify a valid path for your setup.");
}
$message[]=_("Please specify a valid path for your setup.");
}
- // only 0-9a-z
+ // Skip if there are diallowed characters
if(!$this->is_edit){
if(!$this->is_edit){
- if(preg_match("/[^a-z0-9\.\-_]/i",$this->name)){
+ if(!preg_match("/^[a-z0-9\.\-_]+$/i",$this->name)){
$message[]=_("Please specify a valid name for your share.");
}
if(empty($this->name)){
$message[]=_("Please specify a valid name for your share.");
}
if(empty($this->name)){
}
}
}
}
- if(preg_match("/\|/",$this->description)){
+ if(preg_match("/[^a-z0-9\._+ -]+/i",$this->description)){
$message[]=_("Description contains invalid characters.");
}
$message[]=_("Description contains invalid characters.");
}
- if(preg_match("/\|/",$this->volume)){
+ if(preg_match("/[^a-z0-9\._+ -]/i",$this->volume)){
$message[]=_("Volume contains invalid characters.");
}
$message[]=_("Volume contains invalid characters.");
}
$message[]=_("Path contains invalid characters.");
}
$message[]=_("Path contains invalid characters.");
}
- if(preg_match("/\|/",$this->option)){
+ if(preg_match("/[^a-z0-9\._,=+ -]/i",$this->option)){
$message[]=_("Option contains invalid characters.");
}
$message[]=_("Option contains invalid characters.");
}