Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
d0204b9f
Commit
d0204b9f
authored
May 07, 2012
by
Richard Mansfield
Committed by
Gerrit Code Review
May 07, 2012
Browse files
Merge "Fix problem with '/' in email addresses (bug #994370)"
parents
f422f658
0d0d3f70
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/user.php
View file @
d0204b9f
...
@@ -579,7 +579,9 @@ function generate_email_processing_address($userid, $userto, $type='B') {
...
@@ -579,7 +579,9 @@ function generate_email_processing_address($userid, $userto, $type='B') {
$mailprefix
=
get_config
(
'bounceprefix'
);
$mailprefix
=
get_config
(
'bounceprefix'
);
$maildomain
=
get_config
(
'bouncedomain'
);
$maildomain
=
get_config
(
'bouncedomain'
);
$installation_key
=
get_config
(
'installation_key'
);
$installation_key
=
get_config
(
'installation_key'
);
$args
=
$type
.
base64_encode
(
pack
(
'V'
,
$userid
))
.
substr
(
md5
(
$userto
->
email
),
0
,
16
);
// Postfix and other smtp servers don't like the use of / in the extension part of an email
// Replace it with another valid email character that isn't in base64, like '-'
$args
=
$type
.
preg_replace
(
'/\//'
,
'-'
,
base64_encode
(
pack
(
'V'
,
$userid
)))
.
substr
(
md5
(
$userto
->
email
),
0
,
16
);
return
$mailprefix
.
$args
.
substr
(
md5
(
$mailprefix
.
$userto
->
email
.
$installation_key
),
0
,
16
)
.
'@'
.
$maildomain
;
return
$mailprefix
.
$args
.
substr
(
md5
(
$mailprefix
.
$userto
->
email
.
$installation_key
),
0
,
16
)
.
'@'
.
$maildomain
;
}
}
...
@@ -698,7 +700,10 @@ function process_email($address) {
...
@@ -698,7 +700,10 @@ function process_email($address) {
// The type of message received is a one letter code
// The type of message received is a one letter code
$email
->
type
=
substr
(
$email
->
localpart
,
4
,
1
);
$email
->
type
=
substr
(
$email
->
localpart
,
4
,
1
);
// The userid should be available immediately afterwards
// The userid should be available immediately afterwards
list
(,
$email
->
userid
)
=
unpack
(
'V'
,
base64_decode
(
substr
(
$email
->
localpart
,
5
,
8
)));
// Postfix and other smtp servers don't like the use of / in the extension part of an email
// We may of replaced it with another valid email character which isn't in base64, namely '-'
// If we didn't, then the preg_replace won't do anything
list
(,
$email
->
userid
)
=
unpack
(
'V'
,
base64_decode
(
preg_replace
(
'/-/'
,
'/'
,
substr
(
$email
->
localpart
,
5
,
8
))));
// Any additional arguments
// Any additional arguments
$email
->
args
=
substr
(
$email
->
localpart
,
13
,
-
16
);
$email
->
args
=
substr
(
$email
->
localpart
,
13
,
-
16
);
// And a hash of the intended recipient for authentication
// And a hash of the intended recipient for authentication
...
...
Write
Preview
Supports
Markdown
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