Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
2b1e9606
Commit
2b1e9606
authored
11 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Change email en/decryption to use crypto class
Drop old mcrypt class
parent
8354062f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/class.email.php
+4
-4
4 additions, 4 deletions
include/class.email.php
include/class.mcrypt.php
+0
-48
0 additions, 48 deletions
include/class.mcrypt.php
main.inc.php
+1
-1
1 addition, 1 deletion
main.inc.php
setup/inc/install-prereq.inc.php
+0
-1
0 additions, 1 deletion
setup/inc/install-prereq.inc.php
with
5 additions
and
54 deletions
include/class.email.php
+
4
−
4
View file @
2b1e9606
...
...
@@ -87,7 +87,7 @@ class Email {
}
function
getPasswd
()
{
return
$this
->
ht
[
'userpass'
]
?
Mc
rypt
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
)
:
''
;
return
$this
->
ht
[
'userpass'
]
?
C
rypt
o
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
,
$this
->
ht
[
'userid'
]
)
:
''
;
}
function
getHashtable
()
{
...
...
@@ -108,7 +108,7 @@ class Email {
'protocol'
=>
$this
->
ht
[
'mail_protocol'
],
'encryption'
=>
$this
->
ht
[
'mail_encryption'
],
'username'
=>
$this
->
ht
[
'userid'
],
'password'
=>
Mc
rypt
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
),
'password'
=>
C
rypt
o
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
,
$this
->
ht
[
'userid'
]
),
//osTicket specific
'email_id'
=>
$this
->
getId
(),
//Required for email routing to work.
'max_fetch'
=>
$this
->
ht
[
'mail_fetchmax'
],
...
...
@@ -134,7 +134,7 @@ class Email {
'port'
=>
$this
->
ht
[
'smtp_port'
],
'auth'
=>
(
bool
)
$this
->
ht
[
'smtp_auth'
],
'username'
=>
$this
->
ht
[
'userid'
],
'password'
=>
Mc
rypt
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
)
'password'
=>
C
rypt
o
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
,
$this
->
ht
[
'userid'
]
)
);
return
$info
;
...
...
@@ -367,7 +367,7 @@ class Email {
$sql
.
=
',mail_delete=0,mail_archivefolder=NULL'
;
if
(
$vars
[
'passwd'
])
//New password - encrypt.
$sql
.
=
',userpass='
.
db_input
(
Mc
rypt
::
encrypt
(
$vars
[
'passwd'
],
SECRET_SALT
));
$sql
.
=
',userpass='
.
db_input
(
C
rypt
o
::
encrypt
(
$vars
[
'passwd'
],
SECRET_SALT
,
$vars
[
'userid'
]
));
if
(
$id
)
{
//update
$sql
=
'UPDATE '
.
EMAIL_TABLE
.
' SET '
.
$sql
.
' WHERE email_id='
.
db_input
(
$id
);
...
...
This diff is collapsed.
Click to expand it.
include/class.mcrypt.php
deleted
100644 → 0
+
0
−
48
View file @
8354062f
<?php
/*********************************************************************
class.mcrypt.php
Mcrypt wrapper.... nothing special at all.
Peter Rotich <peter@osticket.com>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
class
Mcrypt
{
function
encrypt
(
$text
,
$salt
)
{
global
$ost
;
//if mcrypt extension is not installed--simply return unencryted text and log a warning (if enabled).
if
(
!
function_exists
(
'mcrypt_encrypt'
)
||
!
function_exists
(
'mcrypt_decrypt'
))
{
if
(
$ost
)
{
$msg
=
'Cryptography extension mcrypt is not enabled or installed. Important text/data is being stored as plain text in database.'
;
$ost
->
logWarning
(
'mcrypt module missing'
,
$msg
);
}
return
$text
;
}
return
trim
(
base64_encode
(
mcrypt_encrypt
(
MCRYPT_RIJNDAEL_256
,
$salt
,
$text
,
MCRYPT_MODE_ECB
,
mcrypt_create_iv
(
mcrypt_get_iv_size
(
MCRYPT_RIJNDAEL_256
,
MCRYPT_MODE_ECB
),
MCRYPT_RAND
))));
}
function
decrypt
(
$text
,
$salt
)
{
if
(
!
function_exists
(
'mcrypt_encrypt'
)
||
!
function_exists
(
'mcrypt_decrypt'
))
return
$text
;
return
trim
(
mcrypt_decrypt
(
MCRYPT_RIJNDAEL_256
,
$salt
,
base64_decode
(
$text
),
MCRYPT_MODE_ECB
,
mcrypt_create_iv
(
mcrypt_get_iv_size
(
MCRYPT_RIJNDAEL_256
,
MCRYPT_MODE_ECB
),
MCRYPT_RAND
)));
}
function
exists
(){
return
(
function_exists
(
'mcrypt_encrypt'
)
&&
function_exists
(
'mcrypt_decrypt'
));
}
}
?>
This diff is collapsed.
Click to expand it.
main.inc.php
+
1
−
1
View file @
2b1e9606
...
...
@@ -113,7 +113,7 @@
require
(
INCLUDE_DIR
.
'class.usersession.php'
);
require
(
INCLUDE_DIR
.
'class.pagenate.php'
);
//Pagenate helper!
require
(
INCLUDE_DIR
.
'class.log.php'
);
require
(
INCLUDE_DIR
.
'class.
m
crypt.php'
);
require
(
INCLUDE_DIR
.
'class.crypt
o
.php'
);
require
(
INCLUDE_DIR
.
'class.misc.php'
);
require
(
INCLUDE_DIR
.
'class.timezone.php'
);
require
(
INCLUDE_DIR
.
'class.http.php'
);
...
...
This diff is collapsed.
Click to expand it.
setup/inc/install-prereq.inc.php
+
0
−
1
View file @
2b1e9606
...
...
@@ -22,7 +22,6 @@ if(!defined('SETUPINC')) die('Kwaheri!');
<h3>
Recommended:
</h3>
You can use osTicket without these, but you may not be able to use all features.
<ul
class=
"progress"
>
<li
class=
"
<?php
echo
extension_loaded
(
'mcrypt'
)
?
'yes'
:
'no'
;
?>
"
>
Mcrypt extension
</li>
<li
class=
"
<?php
echo
extension_loaded
(
'gd'
)
?
'yes'
:
'no'
;
?>
"
>
Gdlib extension
</li>
<li
class=
"
<?php
echo
extension_loaded
(
'imap'
)
?
'yes'
:
'no'
;
?>
"
>
PHP IMAP extension
</li>
</ul>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment