summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2005-02-15 19:49:28 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2005-02-15 19:49:28 +0000
commit6058eb889d4a8fafb0dbecf8a0fc9a21991bbbd1 (patch)
tree53f1cdebf5e5a2e36b4eeadccc6b6147b9a892d2 /perl-install
parentc8884e569881c14d820ae85274fb290ae9e6b874 (diff)
downloaddrakx-6058eb889d4a8fafb0dbecf8a0fc9a21991bbbd1.tar
drakx-6058eb889d4a8fafb0dbecf8a0fc9a21991bbbd1.tar.gz
drakx-6058eb889d4a8fafb0dbecf8a0fc9a21991bbbd1.tar.bz2
drakx-6058eb889d4a8fafb0dbecf8a0fc9a21991bbbd1.tar.xz
drakx-6058eb889d4a8fafb0dbecf8a0fc9a21991bbbd1.zip
Force only ASCII letters, numbers, and underscores being used in print queue names.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer/printerdrake.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index a35293840..3e8ab3eda 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -901,7 +901,7 @@ sub generate_queuename {
my $queue;
if ($printer->{currentqueue}{model}) {
if ($printer->{currentqueue}{model} eq N("Unknown model")) {
- $queue = N("Printer");
+ $queue = "P";
} else {
$queue = $printer->{currentqueue}{make} . '|' .
$printer->{currentqueue}{model};
@@ -916,6 +916,10 @@ sub generate_queuename {
my $make = $printer->{currentqueue}{make};
my $model = $printer->{currentqueue}{model};
$queue =~ s/$make$make/$make/gi;
+ # Remove weird characters
+ $queue =~ s/[^A-Za-z0-9_]//g;
+ $make =~ s/[^A-Za-z0-9_]//g;
+ $model =~ s/[^A-Za-z0-9_]//g;
# Do not use a queue name longer than 12 characters, as otherwise
# Windows clients will not be able to access the printer
my $ml = 12;
@@ -2655,7 +2659,7 @@ sub choose_printer_name {
{ title => N("Enter Printer Name and Comments"),
#cancel => !$printer->{configured}{$queue} ? '' : N("Remove queue"),
callbacks => { complete => sub {
- unless ($printer->{currentqueue}{queue} =~ /^\w+$/) {
+ unless ($printer->{currentqueue}{queue} =~ /^[A-Za-z0-9_]+$/) {
$in->ask_warn(N("Error"), N("Name of printer should contain only letters, numbers and the underscore"));
return 1, 0;
}