Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
b5757b74
Commit
b5757b74
authored
Apr 06, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GitlabShell doesn't need to set GL_ID at all.
parent
e8403e8b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
bin/gitlab-shell
bin/gitlab-shell
+4
-1
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+4
-5
No files found.
bin/gitlab-shell
View file @
b5757b74
...
@@ -5,6 +5,9 @@ unless ENV['SSH_CONNECTION']
...
@@ -5,6 +5,9 @@ unless ENV['SSH_CONNECTION']
exit
exit
end
end
key_id
=
/key-[0-9]+/
.
match
(
ARGV
.
join
).
to_s
original_cmd
=
ENV
[
'SSH_ORIGINAL_COMMAND'
]
require_relative
'../lib/gitlab_init'
require_relative
'../lib/gitlab_init'
#
#
...
@@ -14,7 +17,7 @@ require_relative '../lib/gitlab_init'
...
@@ -14,7 +17,7 @@ require_relative '../lib/gitlab_init'
#
#
require
File
.
join
(
ROOT_PATH
,
'lib'
,
'gitlab_shell'
)
require
File
.
join
(
ROOT_PATH
,
'lib'
,
'gitlab_shell'
)
if
GitlabShell
.
new
.
exec
if
GitlabShell
.
new
(
key_id
,
original_cmd
)
.
exec
exit
0
exit
0
else
else
exit
1
exit
1
...
...
lib/gitlab_shell.rb
View file @
b5757b74
...
@@ -9,9 +9,9 @@ class GitlabShell
...
@@ -9,9 +9,9 @@ class GitlabShell
attr_accessor
:key_id
,
:repo_name
,
:git_cmd
,
:repos_path
,
:repo_name
attr_accessor
:key_id
,
:repo_name
,
:git_cmd
,
:repos_path
,
:repo_name
def
initialize
def
initialize
(
key_id
,
origin_cmd
)
@key_id
=
/key-[0-9]+/
.
match
(
ARGV
.
join
).
to_s
@key_id
=
key_id
@origin_cmd
=
ENV
[
'SSH_ORIGINAL_COMMAND'
]
@origin_cmd
=
origin_cmd
@config
=
GitlabConfig
.
new
@config
=
GitlabConfig
.
new
@repos_path
=
@config
.
repos_path
@repos_path
=
@config
.
repos_path
end
end
...
@@ -26,7 +26,6 @@ class GitlabShell
...
@@ -26,7 +26,6 @@ class GitlabShell
raise
DisallowedCommandError
unless
git_cmds
.
include?
(
@git_cmd
)
raise
DisallowedCommandError
unless
git_cmds
.
include?
(
@git_cmd
)
ENV
[
'GL_ID'
]
=
@key_id
status
=
api
.
check_access
(
@git_cmd
,
@repo_name
,
@key_id
,
'_any'
)
status
=
api
.
check_access
(
@git_cmd
,
@repo_name
,
@key_id
,
'_any'
)
raise
AccessDeniedError
,
status
.
message
unless
status
.
allowed?
raise
AccessDeniedError
,
status
.
message
unless
status
.
allowed?
...
@@ -105,7 +104,7 @@ class GitlabShell
...
@@ -105,7 +104,7 @@ class GitlabShell
# This method is not covered by Rspec because it ends the current Ruby process.
# This method is not covered by Rspec because it ends the current Ruby process.
def
exec_cmd
(
*
args
)
def
exec_cmd
(
*
args
)
Kernel
::
exec
({
'PATH'
=>
ENV
[
'PATH'
],
'LD_LIBRARY_PATH'
=>
ENV
[
'LD_LIBRARY_PATH'
],
'GL_ID'
=>
ENV
[
'GL_ID'
]
},
*
args
,
unsetenv_others:
true
)
Kernel
::
exec
({
'PATH'
=>
ENV
[
'PATH'
],
'LD_LIBRARY_PATH'
=>
ENV
[
'LD_LIBRARY_PATH'
],
'GL_ID'
=>
@key_id
},
*
args
,
unsetenv_others:
true
)
end
end
def
api
def
api
...
...
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