Changeset 257

Show
Ignore:
Timestamp:
06/26/07 15:50:37 (1 year ago)
Author:
ludo
Message:

allow spaces in group and profile (from r4527)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/webmin/lbs/bootmenu.cgi

    r219 r257  
    141141 
    142142        # load the needed header.lst.$WOL_EXTENSION (schedule mode), create it if needed (should'nt append here) 
    143         system("cp -a $cfgfile $cfgfile.$WOL_EXTENSION") unless -f "$cfgfile.$WOL_EXTENSION"; 
     143        system("cp -a \"$cfgfile\" \"$cfgfile.$WOL_EXTENSION\"") unless -f "$cfgfile.$WOL_EXTENSION"; 
    144144        hdrLoad( "$cfgfile.$WOL_EXTENSION", \%schedhdr ) or error( lbsGetError() ); 
    145145        # and parse it 
     
    201201                        my $origpath = "$lbs_home/imgprofiles/$in{'profile'}/$in{'group'}"; 
    202202                        if (opendir ORIGPATH, $origpath) { 
    203                                 my $cmd = "cp -a " . join " ", map "$origpath/$_", grep { -l "$origpath/$_" or $_ eq "header.lst" or $_ eq "header.lst.$WOL_EXTENSION" } readdir(ORIGPATH); 
     203                                my $cmd = "cp -a " . join " ", map "\"$origpath/$_\"", grep { -l "$origpath/$_" or $_ eq "header.lst" or $_ eq "header.lst.$WOL_EXTENSION" } readdir(ORIGPATH); 
    204204                                closedir CFGPATH; 
    205205                                $cmd .= " $cfgpath"; 
     
    364364 
    365365        # load the needed header.lst.$WOL_EXTENSION (schedule mode), create it if needed 
    366         $cfgfile =~ s/[^a-z0-9\.\/_-]//gi; 
    367         system("cp -a $cfgfile $cfgfile.$WOL_EXTENSION") unless -f "$cfgfile.$WOL_EXTENSION"; 
     366        system("cp -a \"$cfgfile\" \"$cfgfile.$WOL_EXTENSION\"") unless -f "$cfgfile.$WOL_EXTENSION"; 
    368367        hdrLoad( "$cfgfile.$WOL_EXTENSION", \%schedhdr ) or error( lbsGetError() ); 
    369368        # and parse it 
     
    419418        lbs_common::print_html_tabs(['system_backup', 'boot_menu']); 
    420419        lbs_common::checkforspace(); 
     420         
    421421        # boot menu, FIXME i18n 
    422422        if (($mode eq "MONO")) {          # only one client selected 
  • trunk/webmin/lbs/bootoptions.cgi

    r170 r257  
    194194                        $cfgfile = "$lbs_home/images/$macfile/header.lst"; 
    195195                } else { 
    196                         $cfgpath="$lbs_home/imgprofiles/$in{'profile'}/$in{'group'}"; 
     196                        $cfgpath = "$lbs_home/imgprofiles/$in{'profile'}/$in{'group'}"; 
    197197                        $cfgfile = "$cfgpath/header.lst"; 
    198198                } 
    199199 
    200200                save_bootmenu_options($cfgfile, %einfo); 
    201  
    202201                if ($mode eq "MULTI") { # in multi mode we have to to the while thing once again for every client TODO: subfunction for this ? 
    203202                        # to do this, we need the entire mac list to be loaded 
     
    208207                        my $group = $in{'group'} or ""; 
    209208 
     209                        if ($profile eq "all") {$profile = "";} 
     210                         
    210211                        lbs_common::etherLoad("$home/etc/ether", \%ether); 
    211                         lbs_common::filter_machines_names($oprofile, $in{'group'}, \%ether); 
     212                        lbs_common::filter_machines_names($profile, $group, \%ether); 
    212213 
    213214                        foreach my $name (etherGetNames(\%ether)) { 
     
    221222                                my $origpath = "$lbs_home/imgprofiles/$in{'profile'}/$in{'group'}"; 
    222223                                if (opendir ORIGPATH, $origpath) { 
    223                                         my $cmd = "cp -a " . join " ", map "$origpath/$_", grep { -l "$origpath/$_" or $_ eq "header.lst" } readdir(ORIGPATH); 
     224                                        my $cmd = "cp -a " . join " ", map "\"$origpath/$_\"", grep { -l "$origpath/$_" or $_ eq "header.lst" } readdir(ORIGPATH); 
    224225                                        closedir CFGPATH; 
    225226                                        $cmd .= " $cfgpath"; 
  • trunk/webmin/lbs/lbs.pl

    r206 r257  
    137137                if ( ($siz =~ m/\d+k/i) || ($siz =~ m/\d+o/i)) {        # images below 1 MB aren't shown 
    138138                        push @burn, "<center>&nbsp;</center>"; 
    139                         push @details, "<center>&nbsp;</center>";            
    140139                } else { 
    141140                        push @burn, "<center><a href='/lbs-cd/?dir=".urlize($lbs_home."/imgbase/$k/")."'><img border=1 src='images/burn.gif'></a></center>"; 
    142                         push @details, "<center><a href='details.cgi?conf=".urlize("/imgbase/$k/")."&mac=".urlize($in{'mac'})."'><img border=1 src='images/detail.gif'></a></center>";       
     141                } 
     142 
     143                if ( (($siz =~ m/\d+k/i) || ($siz =~ m/\d+o/i)) && !($k =~ m/Base-/i)) { # images below 1 MB aren't shown 
     144                        push @details, "<center>&nbsp;</center>"; 
     145                } else { 
     146                        push @details, "<center><a href='details.cgi?conf=".urlize("/imgbase/$k/")."&mac=".urlize($in{'mac'})."'><img border=1 src='images/detail.gif'></a></center>"; 
    143147                } 
    144148 
     
    12261230        my $lbs_home  = $lbs_common::lbsconf{'basedir'}; 
    12271231         
    1228         $cfgpath =~ s/[^a-z0-9\/_-]//gi; 
     1232        $cfgpath =~ s/[^a-z0-9\/_ -]//gi; 
    12291233         
    12301234        my $cfgfile="$cfgpath/header.lst"; 
    12311235         
    12321236        if (not -e $cfgfile) { 
    1233                 `mkdir -p $cfgpath`; 
    1234                 `cp -a $lbs_home/imgskel/header.lst $cfgpath`; 
    1235                 `cp -a $lbs_home/imgskel/COPYNUM $cfgpath`; 
    1236                 `cp -a $lbs_home/imgskel/symlinks $cfgpath`; 
    1237                 `cat $lbs_home/imgskel/symlinks | sed "s/\\.\\.\\/\\.\\./\\/tftpboot\\/revoboot/" > $cfgpath/symlinks`; 
    1238                 `cd $cfgpath && ./symlinks`; 
     1237                `mkdir -p "$cfgpath"`; 
     1238                `cp -a $lbs_home/imgskel/header.lst "$cfgpath"`; 
     1239                `cp -a $lbs_home/imgskel/COPYNUM "$cfgpath"`; 
     1240                `cp -a $lbs_home/imgskel/symlinks "$cfgpath"`; 
     1241                `cat $lbs_home/imgskel/symlinks | sed "s/\\.\\.\\/\\.\\./\\/tftpboot\\/revoboot/" > "$cfgpath/symlinks"`; 
     1242                `cd "$cfgpath" && ./symlinks`; 
    12391243        } 
    12401244         
  • trunk/webmin/lbs/move.cgi

    r219 r257  
    9393        $cfgfile = "$cfgpath/header.lst"; 
    9494} elsif ($mode eq "MULTI") { 
    95         $cfgpath="$lbs_home/imgprofiles/$in{'profile'}/$in{'group'}"; 
     95        $cfgpath = "$lbs_home/imgprofiles/$in{'profile'}/$in{'group'}"; 
    9696        $cfgfile = "$cfgpath/header.lst"; 
    9797        create_group_dir($cfgpath); 
  • trunk/webmin/lbs/rename.cgi

    r235 r257  
    9191        $g =~ s|^/+(.*)$|$1|;           # remove leading "/" 
    9292        $g =~ s|^(.*)/$|$1|gi;          # remove trailing "/" 
    93         $g =~ s|[^a-z0-9\.\-/\+]|_|gi;  # translate unauthorized characters into underscores 
     93        $g =~ s|[^a-z0-9\.\-/\+ ]|_|gi;  # translate unauthorized characters into underscores 
    9494 
    9595        # profile parsing: 
     
    9797        $p =~ s|^/+(.*)$|$1|;           # remove leading "/" 
    9898        $p =~ s|^(.*)/$|$1|gi;          # remove trailing "/" 
    99         $p =~ s|[^a-z0-9\.\-/\:\+]|_|gi;# translate unauthorized characters into underscores 
     99        $p =~ s|[^a-z0-9\.\-/\:\+ ]|_|gi;# translate unauthorized characters into underscores 
    100100 
    101101        $t = "$p:$g/$t";