Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
b8a33eb3
Commit
b8a33eb3
authored
Jul 21, 2005
by
lpsolit%gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 301453: Move CheckEmailSyntax out of CGI.pl - Patch by Frédéric Buclin…
Bug 301453: Move CheckEmailSyntax out of CGI.pl - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
parent
deaa3dcc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
16 deletions
+18
-16
User.pm
Bugzilla/User.pm
+1
-1
Util.pm
Bugzilla/Util.pm
+9
-1
CGI.pl
CGI.pl
+0
-8
createaccount.cgi
createaccount.cgi
+2
-1
editflagtypes.cgi
editflagtypes.cgi
+2
-1
editusers.cgi
editusers.cgi
+2
-2
token.cgi
token.cgi
+1
-1
userprefs.cgi
userprefs.cgi
+1
-1
No files found.
Bugzilla/User.pm
View file @
b8a33eb3
...
@@ -1138,7 +1138,7 @@ sub insert_new_user ($$;$$) {
...
@@ -1138,7 +1138,7 @@ sub insert_new_user ($$;$$) {
$password
||=
&::
GenerateRandomPassword
();
$password
||=
&::
GenerateRandomPassword
();
my
$cryptpassword
=
bz_crypt
(
$password
);
my
$cryptpassword
=
bz_crypt
(
$password
);
# XXX - These should be moved into
ValidateNewUser or CheckEmailS
yntax
# XXX - These should be moved into
is_available_username or check_email_s
yntax
# At the least, they shouldn't be here. They're safe for now, though.
# At the least, they shouldn't be here. They're safe for now, though.
trick_taint
(
$username
);
trick_taint
(
$username
);
trick_taint
(
$realname
);
trick_taint
(
$realname
);
...
...
Bugzilla/Util.pm
View file @
b8a33eb3
...
@@ -39,7 +39,7 @@ use base qw(Exporter);
...
@@ -39,7 +39,7 @@ use base qw(Exporter);
trim wrap_comment find_wrap_point
trim wrap_comment find_wrap_point
format_time format_time_decimal
format_time format_time_decimal
file_mod_time
file_mod_time
bz_crypt)
;
bz_crypt
check_email_syntax
)
;
use
Bugzilla::
Config
;
use
Bugzilla::
Config
;
use
Bugzilla::
Error
;
use
Bugzilla::
Error
;
...
@@ -342,6 +342,14 @@ sub bz_crypt ($) {
...
@@ -342,6 +342,14 @@ sub bz_crypt ($) {
return
$cryptedpassword
;
return
$cryptedpassword
;
}
}
sub
check_email_syntax
{
my
(
$addr
)
=
(
@_
);
my
$match
=
Param
(
'emailregexp'
);
if
(
$addr
!~
/$match/
||
$addr
=~
/[\\\(\)<>&,;:"\[\] \t\r\n]/
)
{
ThrowUserError
(
"illegal_email_address"
,
{
addr
=>
$addr
});
}
}
sub
ValidateDate
{
sub
ValidateDate
{
my
(
$date
,
$format
)
=
@_
;
my
(
$date
,
$format
)
=
@_
;
my
$date2
;
my
$date2
;
...
...
CGI.pl
View file @
b8a33eb3
...
@@ -103,14 +103,6 @@ sub CheckFormFieldDefined ($$) {
...
@@ -103,14 +103,6 @@ sub CheckFormFieldDefined ($$) {
}
}
}
}
sub
CheckEmailSyntax
{
my
(
$addr
)
=
(
@_
);
my
$match
=
Param
(
'emailregexp'
);
if
(
$addr
!~
/$match/
||
$addr
=~
/[\\\(\)<>&,;:"\[\] \t\r\n]/
)
{
ThrowUserError
(
"illegal_email_address"
,
{
addr
=>
$addr
});
}
}
sub
PutHeader
{
sub
PutHeader
{
(
$vars
->
{
'title'
},
$vars
->
{
'h1'
},
$vars
->
{
'h2'
})
=
(
@_
);
(
$vars
->
{
'title'
},
$vars
->
{
'h1'
},
$vars
->
{
'h2'
})
=
(
@_
);
...
...
createaccount.cgi
View file @
b8a33eb3
...
@@ -33,6 +33,7 @@ require "CGI.pl";
...
@@ -33,6 +33,7 @@ require "CGI.pl";
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
User
;
use
Bugzilla::
User
;
use
Bugzilla::
BugMail
;
use
Bugzilla::
BugMail
;
use
Bugzilla::
Util
;
# Shut up misguided -w warnings about "used only once":
# Shut up misguided -w warnings about "used only once":
use
vars
qw(
use
vars
qw(
...
@@ -63,7 +64,7 @@ my $login = $cgi->param('login');
...
@@ -63,7 +64,7 @@ my $login = $cgi->param('login');
if
(
defined
(
$login
))
{
if
(
defined
(
$login
))
{
# We've been asked to create an account.
# We've been asked to create an account.
my
$realname
=
trim
(
$cgi
->
param
(
'realname'
));
my
$realname
=
trim
(
$cgi
->
param
(
'realname'
));
CheckEmailS
yntax
(
$login
);
check_email_s
yntax
(
$login
);
$vars
->
{
'login'
}
=
$login
;
$vars
->
{
'login'
}
=
$login
;
if
(
!
is_available_username
(
$login
))
{
if
(
!
is_available_username
(
$login
))
{
...
...
editflagtypes.cgi
View file @
b8a33eb3
...
@@ -37,6 +37,7 @@ use Bugzilla::Constants;
...
@@ -37,6 +37,7 @@ use Bugzilla::Constants;
use
Bugzilla::
Flag
;
use
Bugzilla::
Flag
;
use
Bugzilla::
FlagType
;
use
Bugzilla::
FlagType
;
use
Bugzilla::
User
;
use
Bugzilla::
User
;
use
Bugzilla::
Util
;
use
vars
qw( $template $vars )
;
use
vars
qw( $template $vars )
;
...
@@ -488,7 +489,7 @@ sub validateCCList {
...
@@ -488,7 +489,7 @@ sub validateCCList {
{
cc_list
=>
$cgi
->
param
(
'cc_list'
)
});
{
cc_list
=>
$cgi
->
param
(
'cc_list'
)
});
my
@addresses
=
split
(
/[, ]+/
,
$cgi
->
param
(
'cc_list'
));
my
@addresses
=
split
(
/[, ]+/
,
$cgi
->
param
(
'cc_list'
));
foreach
my
$address
(
@addresses
)
{
CheckEmailS
yntax
(
$address
)
}
foreach
my
$address
(
@addresses
)
{
check_email_s
yntax
(
$address
)
}
}
}
sub
validateProduct
{
sub
validateProduct
{
...
...
editusers.cgi
View file @
b8a33eb3
...
@@ -170,7 +170,7 @@ if ($action eq 'search') {
...
@@ -170,7 +170,7 @@ if ($action eq 'search') {
# Validity checks
# Validity checks
$login
||
ThrowUserError
(
'user_login_required'
);
$login
||
ThrowUserError
(
'user_login_required'
);
CheckEmailS
yntax
(
$login
);
check_email_s
yntax
(
$login
);
is_available_username
(
$login
)
||
ThrowUserError
(
'account_exists'
,
is_available_username
(
$login
)
||
ThrowUserError
(
'account_exists'
,
{
'email'
=>
$login
});
{
'email'
=>
$login
});
ValidatePassword
(
$password
);
ValidatePassword
(
$password
);
...
@@ -246,7 +246,7 @@ if ($action eq 'search') {
...
@@ -246,7 +246,7 @@ if ($action eq 'search') {
if
(
$login
ne
$loginold
)
{
if
(
$login
ne
$loginold
)
{
# Validate, then trick_taint.
# Validate, then trick_taint.
$login
||
ThrowUserError
(
'user_login_required'
);
$login
||
ThrowUserError
(
'user_login_required'
);
CheckEmailS
yntax
(
$login
);
check_email_s
yntax
(
$login
);
is_available_username
(
$login
)
||
ThrowUserError
(
'account_exists'
,
is_available_username
(
$login
)
||
ThrowUserError
(
'account_exists'
,
{
'email'
=>
$login
});
{
'email'
=>
$login
});
trick_taint
(
$login
);
trick_taint
(
$login
);
...
...
token.cgi
View file @
b8a33eb3
...
@@ -112,7 +112,7 @@ if ( $::action eq 'reqpw' ) {
...
@@ -112,7 +112,7 @@ if ( $::action eq 'reqpw' ) {
# Make sure the login name looks like an email address. This function
# Make sure the login name looks like an email address. This function
# displays its own error and stops execution if the login name looks wrong.
# displays its own error and stops execution if the login name looks wrong.
CheckEmailS
yntax
(
$cgi
->
param
(
'loginname'
));
check_email_s
yntax
(
$cgi
->
param
(
'loginname'
));
my
$quotedloginname
=
SqlQuote
(
$cgi
->
param
(
'loginname'
));
my
$quotedloginname
=
SqlQuote
(
$cgi
->
param
(
'loginname'
));
SendSQL
(
"SELECT userid FROM profiles WHERE "
.
SendSQL
(
"SELECT userid FROM profiles WHERE "
.
...
...
userprefs.cgi
View file @
b8a33eb3
...
@@ -118,7 +118,7 @@ sub SaveAccount {
...
@@ -118,7 +118,7 @@ sub SaveAccount {
}
}
# Before changing an email address, confirm one does not exist.
# Before changing an email address, confirm one does not exist.
CheckEmailS
yntax
(
$new_login_name
);
check_email_s
yntax
(
$new_login_name
);
trick_taint
(
$new_login_name
);
trick_taint
(
$new_login_name
);
is_available_username
(
$new_login_name
)
is_available_username
(
$new_login_name
)
||
ThrowUserError
(
"account_exists"
,
{
email
=>
$new_login_name
});
||
ThrowUserError
(
"account_exists"
,
{
email
=>
$new_login_name
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment