Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
0a906243
Commit
0a906243
authored
Jan 06, 2019
by
Christophe Maudoux
🐛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve code
parent
879a7693
Pipeline
#3863
passed with stages
in 12 minutes and 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GPG.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GPG.pm
+15
-17
No files found.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GPG.pm
View file @
0a906243
...
@@ -5,12 +5,12 @@ use File::Temp 'tempdir';
...
@@ -5,12 +5,12 @@ use File::Temp 'tempdir';
use
IPC::
Run
;
use
IPC::
Run
;
use
Mouse
;
use
Mouse
;
use
Lemonldap::NG::Portal::Main::
Constants
qw(
use
Lemonldap::NG::Portal::Main::
Constants
qw(
PE_BADCREDENTIALS
PE_BADCREDENTIALS
PE_ERROR
PE_ERROR
PE_FIRSTACCESS
PE_FIRSTACCESS
PE_FORMEMPTY
PE_FORMEMPTY
PE_NOTOKEN
PE_NOTOKEN
PE_OK
PE_OK
)
;
)
;
our
$VERSION
=
'
2.0.1
';
our
$VERSION
=
'
2.0.1
';
...
@@ -68,16 +68,16 @@ sub extractFormInfo {
...
@@ -68,16 +68,16 @@ sub extractFormInfo {
}
}
my
(
$out
,
$err
);
my
(
$out
,
$err
);
$self
->
logger
->
debug
(
$self
->
logger
->
debug
(
"
Launching:
\n
gpgv --homedir /dev/null --keyring
$self
->{db} <<EOF
\n
$signed
\n
EOF
"
"
Launching:
\n
gpgv --homedir /dev/null --keyring
$self
->{db} <<EOF
\n
$signed
\n
EOF
"
);
);
my
$lang
=
$ENV
{
LANG
};
my
(
$lang
,
$language
)
=
(
$ENV
{
LANG
},
$ENV
{
LANGUAGE
}
);
my
$language
=
$ENV
{
LANGUAGE
};
$ENV
{
LANG
}
=
$ENV
{
LANGUAGE
}
=
'
C
';
$ENV
{
LANG
}
=
'
C
';
IPC::Run::
run
(
$ENV
{
LANGUAGE
}
=
'
C
';
[
'
gpgv
',
'
--homedir
',
'
/dev/null
',
'
--keyring
',
$self
->
db
],
IPC::Run::
run
(
[
'
gpgv
',
'
--homedir
',
'
/dev/null
',
'
--keyring
',
$self
->
db
],
\
$signed
,
\
$out
,
\
$err
,
IPC::Run::
timeout
(
10
)
);
\
$signed
,
\
$out
,
\
$err
,
IPC::Run::
timeout
(
10
)
);
if
(
$?
>>
8
!=
0
)
{
if
(
$?
>>
8
!=
0
)
{
$self
->
userLogger
->
error
("
GPG verification fails:
\n
$out
\n
# # #
\n
$err
");
$self
->
userLogger
->
error
(
"
GPG verification fails:
\n
$out
\n
# # #
\n
$err
");
$self
->
setSecurity
(
$req
);
$self
->
setSecurity
(
$req
);
return
PE_BADCREDENTIALS
;
return
PE_BADCREDENTIALS
;
}
}
...
@@ -93,8 +93,7 @@ sub extractFormInfo {
...
@@ -93,8 +93,7 @@ sub extractFormInfo {
$self
->
logger
->
debug
("
GPG full sign key:
$key
");
$self
->
logger
->
debug
("
GPG full sign key:
$key
");
my
$in
;
my
$in
;
IPC::Run::
run
(
IPC::Run::
run
(
[
[
'
gpg
',
'
--homedir
',
$self
->
tmp
,
'
--keyring
',
'
gpg
',
'
--homedir
',
$self
->
tmp
,
'
--keyring
',
$self
->
db
,
'
--list-key
',
$key
$self
->
db
,
'
--list-key
',
$key
],
],
\
$in
,
\
$in
,
...
@@ -102,8 +101,7 @@ sub extractFormInfo {
...
@@ -102,8 +101,7 @@ sub extractFormInfo {
\
$err
,
\
$err
,
IPC::Run::
timeout
(
10
)
IPC::Run::
timeout
(
10
)
);
);
$ENV
{
LANG
}
=
$lang
;
(
$ENV
{
LANG
},
$ENV
{
LANGUAGE
}
)
=
(
$lang
,
$language
);
$ENV
{
LANGUAGE
}
=
$language
;
if
(
$?
>>
8
!=
0
)
{
if
(
$?
>>
8
!=
0
)
{
$self
->
logger
->
error
("
gpg --list-key return an error:
\n
$err
");
$self
->
logger
->
error
("
gpg --list-key return an error:
\n
$err
");
return
PE_ERROR
;
return
PE_ERROR
;
...
...
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