From f2d36cf4f5da8bc2dbe7a81daa7780ad0e5fda45 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Nov 2010 20:23:34 +0000 Subject: [PATCH] add username-slash and username-equals config options, allow uumlauts etc. in svc_acct.finger like ut_name, RT#10452, RT#10454 --- FS/FS/Conf.pm | 14 ++++++++++++++ FS/FS/svc_acct.pm | 13 +++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 28e96e7a4..542dcc9e7 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1626,6 +1626,20 @@ and customer address. Include units.', 'type' => 'checkbox', }, + { + 'key' => 'username-slash', + 'section' => 'username', + 'description' => 'Allow the slash character (/) in usernames.', + 'type' => 'checkbox', + }, + + { + 'key' => 'username-equals', + 'section' => 'username', + 'description' => 'Allow the equal sign character (=) in usernames.', + 'type' => 'checkbox', + }, + { 'key' => 'safe-part_bill_event', 'section' => 'UI', diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index d401e1dee..43ff2a5fa 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -9,6 +9,7 @@ use vars qw( $DEBUG $me $conf $skip_fuzzyfiles $username_ampersand $username_letter $username_letterfirst $username_noperiod $username_nounderscore $username_nodash $username_uppercase $username_percent $username_colon + $username_slash $username_equals $password_noampersand $password_noexclamation $warning_template $warning_from $warning_subject $warning_mimetype $warning_cc @@ -74,6 +75,8 @@ FS::UID->install_callback( sub { $username_ampersand = $conf->exists('username-ampersand'); $username_percent = $conf->exists('username-percent'); $username_colon = $conf->exists('username-colon'); + $username_slash = $conf->exists('username-slash'); + $username_equals = $conf->exists('username-equals'); $password_noampersand = $conf->exists('password-noexclamation'); $password_noexclamation = $conf->exists('password-noexclamation'); $dirhash = $conf->config('dirhash') || 0; @@ -1241,7 +1244,7 @@ sub check { my $ulen = $usernamemax || $self->dbdef_table->column('username')->length; if ( $username_uppercase ) { - $recref->{username} =~ /^([a-z0-9_\-\.\&\%\:]{$usernamemin,$ulen})$/i + $recref->{username} =~ /^([a-z0-9_\-\.\&\%\:\/\=]{$usernamemin,$ulen})$/i or return gettext('illegal_username'). " ($usernamemin-$ulen): ". $recref->{username}; $recref->{username} = $1; } else { @@ -1273,6 +1276,12 @@ sub check { unless ( $username_colon ) { $recref->{username} =~ /\:/ and return gettext('illegal_username'); } + unless ( $username_slash ) { + $recref->{username} =~ /\// and return gettext('illegal_username'); + } + unless ( $username_equals ) { + $recref->{username} =~ /\=/ and return gettext('illegal_username'); + } $recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum}; $recref->{popnum} = $1; @@ -1352,7 +1361,7 @@ sub check { } } $self->getfield('finger') =~ - /^([\w \t\!\@\#\$\%\&\(\)\-\+\;\'\"\,\.\?\/\*\<\>]*)$/ + /^([µ_0123456789aAáÁàÀâÂåÅäÄãêæÆbBcCçÇdDðÐeEéÉèÈêÊëËfFgGhHiIíÍìÌîÎïÏjJkKlLmMnNñÑoOóÓòÒôÔöÖõÕøغpPqQrRsSßtTuUúÚùÙûÛüÜvVwWxXyYýÝÿzZþÞ \t\!\@\#\$\%\&\(\)\-\+\;\'\"\,\.\?\/\*\<\>]*)$/ or return "Illegal finger: ". $self->getfield('finger'); $self->setfield('finger', $1); -- 2.11.0