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
6aa00ffc
Commit
6aa00ffc
authored
21 years ago
by
Mark Grondona
Browse files
Options
Downloads
Patches
Plain Diff
o Print credential info on failure.
parent
3a9bf3ed
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/auth/auth_munge.c
+89
-5
89 additions, 5 deletions
src/plugins/auth/auth_munge.c
with
89 additions
and
5 deletions
src/plugins/auth/auth_munge.c
+
89
−
5
View file @
6aa00ffc
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#else
/* ! HAVE_CONFIG_H */
#else
/* ! HAVE_CONFIG_H */
# include <sys/types.h>
# include <sys/types.h>
# include <unistd.h>
# include <unistd.h>
# include <time.h>
# include <stdint.h>
# include <stdint.h>
# include <string.h>
# include <string.h>
#endif
/* HAVE_CONFIG_H */
#endif
/* HAVE_CONFIG_H */
...
@@ -93,6 +94,83 @@ typedef struct _slurm_auth_credential {
...
@@ -93,6 +94,83 @@ typedef struct _slurm_auth_credential {
int
cr_errno
;
int
cr_errno
;
}
slurm_auth_credential_t
;
}
slurm_auth_credential_t
;
typedef
struct
{
time_t
encoded
;
time_t
decoded
;
munge_cipher_t
cipher
;
munge_mac_t
mac
;
munge_zip_t
zip
;
}
munge_info_t
;
static
munge_info_t
*
cred_info_alloc
(
void
)
{
munge_info_t
*
mi
=
xmalloc
(
sizeof
(
*
mi
));
memset
(
mi
,
0
,
sizeof
(
*
mi
));
return
mi
;
}
static
void
cred_info_destroy
(
munge_info_t
*
mi
)
{
xfree
(
mi
);
}
static
munge_info_t
*
cred_info_create
(
munge_ctx_t
ctx
)
{
munge_err_t
e
;
munge_info_t
*
mi
=
cred_info_alloc
();
e
=
munge_ctx_get
(
ctx
,
MUNGE_OPT_ENCODE_TIME
,
&
mi
->
encoded
);
if
(
e
!=
EMUNGE_SUCCESS
)
error
(
"auth_munge: Unable to retrieve encode time: %s"
,
munge_ctx_strerror
(
ctx
));
e
=
munge_ctx_get
(
ctx
,
MUNGE_OPT_DECODE_TIME
,
&
mi
->
decoded
);
if
(
e
!=
EMUNGE_SUCCESS
)
error
(
"auth_munge: Unable to retrieve decode time: %s"
,
munge_ctx_strerror
(
ctx
));
e
=
munge_ctx_get
(
ctx
,
MUNGE_OPT_CIPHER_TYPE
,
&
mi
->
cipher
);
if
(
e
!=
EMUNGE_SUCCESS
)
error
(
"auth_munge: Unable to retrieve cipher type: %s"
,
munge_ctx_strerror
(
ctx
));
e
=
munge_ctx_get
(
ctx
,
MUNGE_OPT_MAC_TYPE
,
&
mi
->
mac
);
if
(
e
!=
EMUNGE_SUCCESS
)
error
(
"auth_munge: Unable to retrieve mac type: %s"
,
munge_ctx_strerror
(
ctx
));
e
=
munge_ctx_get
(
ctx
,
MUNGE_OPT_ZIP_TYPE
,
&
mi
->
zip
);
if
(
e
!=
EMUNGE_SUCCESS
)
error
(
"auth_munge: Unable to retrieve mac type: %s"
,
munge_ctx_strerror
(
ctx
));
return
mi
;
}
static
void
_print_cred_info
(
munge_info_t
*
mi
)
{
char
buf
[
256
];
info
(
"ENCODED: %s"
,
ctime_r
(
&
mi
->
encoded
,
buf
));
info
(
"DECODED: %s"
,
ctime_r
(
&
mi
->
decoded
,
buf
));
info
(
"CIPHER: %s"
,
munge_cipher_strings
[
mi
->
cipher
]);
info
(
"MAC: %s"
,
munge_mac_strings
[
mi
->
mac
]);
info
(
"ZIP: %s"
,
munge_zip_strings
[
mi
->
zip
]);
}
static
void
_print_cred
(
munge_ctx_t
ctx
)
{
munge_info_t
*
mi
=
cred_info_create
(
ctx
);
_print_cred_info
(
mi
);
cred_info_destroy
(
mi
);
}
/*
/*
* Decode the munge encoded credential `m' placing results, if validated,
* Decode the munge encoded credential `m' placing results, if validated,
* into slurm credential `c'
* into slurm credential `c'
...
@@ -101,7 +179,7 @@ static int
...
@@ -101,7 +179,7 @@ static int
_decode_cred
(
char
*
m
,
slurm_auth_credential_t
*
c
)
_decode_cred
(
char
*
m
,
slurm_auth_credential_t
*
c
)
{
{
munge_err_t
e
;
munge_err_t
e
;
munge_ctx_t
ctx
=
NULL
;
munge_ctx_t
ctx
=
munge_ctx_create
()
;
if
((
c
==
NULL
)
||
(
m
==
NULL
))
if
((
c
==
NULL
)
||
(
m
==
NULL
))
return
SLURM_ERROR
;
return
SLURM_ERROR
;
...
@@ -113,19 +191,25 @@ _decode_cred(char *m, slurm_auth_credential_t *c)
...
@@ -113,19 +191,25 @@ _decode_cred(char *m, slurm_auth_credential_t *c)
if
((
e
=
munge_decode
(
m
,
ctx
,
&
c
->
buf
,
&
c
->
len
,
&
c
->
uid
,
&
c
->
gid
)))
{
if
((
e
=
munge_decode
(
m
,
ctx
,
&
c
->
buf
,
&
c
->
len
,
&
c
->
uid
,
&
c
->
gid
)))
{
error
(
"Invalid Munge credential: %s"
,
munge_strerror
(
e
));
error
(
"Invalid Munge credential: %s"
,
munge_strerror
(
e
));
return
SLURM_ERROR
;
_print_cred
(
ctx
);
goto
done
;
}
}
c
->
verified
=
true
;
c
->
verified
=
true
;
done:
munge_ctx_destroy
(
ctx
);
return
SLURM_SUCCESS
;
return
SLURM_SUCCESS
;
}
}
int
init
(
void
)
int
init
(
void
)
{
{
host_list_idx
=
arg_idx_by_name
(
slurm_auth_get_arg_desc
(),
host_list_idx
=
arg_idx_by_name
(
slurm_auth_get_arg_desc
(),
ARG_HOST_LIST
);
ARG_HOST_LIST
);
if
(
host_list_idx
==
-
1
)
return
SLURM_ERROR
;
if
(
host_list_idx
==
-
1
)
return
SLURM_ERROR
;
return
SLURM_SUCCESS
;
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