Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
tud-zih-energy
Slurm
Commits
a98f7c11
Commit
a98f7c11
authored
22 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Authenticate stdin/err stream headers.
parent
6133829e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/srun/io.c
+31
-0
31 additions, 0 deletions
src/srun/io.c
with
31 additions
and
0 deletions
src/srun/io.c
+
31
−
0
View file @
a98f7c11
...
...
@@ -68,6 +68,7 @@ static void _bcast_stdin(int fd, job_t *job);
static
ssize_t
_readx
(
int
fd
,
char
*
buf
,
size_t
maxbytes
);
static
ssize_t
_readn
(
int
fd
,
void
*
buf
,
size_t
nbytes
);
static
char
*
_next_line
(
char
**
str
);
static
int
_validate_header
(
slurm_io_stream_header_t
*
hdr
,
job_t
*
job
);
#define _poll_set_rd(_pfd, _fd) do { \
(_pfd).fd = _fd; \
...
...
@@ -271,6 +272,9 @@ _accept_io_stream(job_t *job, int i)
return
;
}
free_buf
(
buffer
);
/* NOTE: this frees msgbuf */
if
(
_validate_header
(
&
hdr
,
job
))
return
;
/* Assign new fds arbitrarily for now, until slurmd
* sends along some control information
...
...
@@ -437,3 +441,30 @@ _bcast_stdin(int fd, job_t *job)
return
;
}
static
int
_validate_header
(
slurm_io_stream_header_t
*
hdr
,
job_t
*
job
)
{
if
(
hdr
->
version
!=
SLURM_PROTOCOL_VERSION
)
{
error
(
"Invalid header version, notify administrators"
);
return
SLURM_ERROR
;
}
if
((
hdr
->
task_id
<
0
)
&&
(
hdr
->
task_id
>=
opt
.
nprocs
))
{
error
(
"Invalid header client task_id, notify administrators"
);
return
SLURM_ERROR
;
}
if
((
hdr
->
type
!=
SLURM_IO_STREAM_INOUT
)
&&
(
hdr
->
type
!=
SLURM_IO_STREAM_SIGERR
))
{
error
(
"Invalid header client type, notify administrators"
);
return
SLURM_ERROR
;
}
if
(
memcmp
((
void
*
)
job
->
cred
->
signature
,
(
void
*
)
hdr
->
key
,
SLURM_SSL_SIGNATURE_LENGTH
))
{
debug
(
"Invalid header signature, notify administrators"
);
return
SLURM_SUCCESS
;
/* FIXME */
return
SLURM_ERROR
;
}
return
SLURM_SUCCESS
;
}
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