Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
8cb05e32
Commit
8cb05e32
authored
Aug 19, 2014
by
Leigh B Stoller
Browse files
Add option to create a speaksfor credential, where the speaker
is the SA instead of another user.
parent
ae3ea197
Changes
1
Hide whitespace changes
Inline
Side-by-side
protogeni/scripts/genspeaksfor.in
View file @
8cb05e32
#!/usr/bin/perl -w
#!/usr/bin/perl -w
#
#
# Copyright (c) 2008-201
3
University of Utah and the Flux Group.
# Copyright (c) 2008-201
4
University of Utah and the Flux Group.
#
#
# {{{GENIPUBLIC-LICENSE
# {{{GENIPUBLIC-LICENSE
#
#
...
@@ -38,7 +38,7 @@ use Data::Dumper;
...
@@ -38,7 +38,7 @@ use Data::Dumper;
#
#
sub
usage
()
sub
usage
()
{
{
print
STDERR
"
Usage: $0 [-a] <user-urn> <speaker-urn>
";
print
STDERR
"
Usage: $0 [-a] <user-urn>
[
<speaker-urn>
]
\n
";
exit
(
1
);
exit
(
1
);
}
}
my
$optlist
=
"
a
";
my
$optlist
=
"
a
";
...
@@ -46,6 +46,7 @@ my $doabac = 0;
...
@@ -46,6 +46,7 @@ my $doabac = 0;
# Configure ...
# Configure ...
my
$TB
=
"
@prefix
@
";
my
$TB
=
"
@prefix
@
";
my
$SACERT
=
"
$TB
/etc/genisa.pem
";
# Do this early so that we talk to the right DB.
# Do this early so that we talk to the right DB.
use
vars
qw($GENI_DBNAME)
;
use
vars
qw($GENI_DBNAME)
;
...
@@ -80,9 +81,28 @@ if (defined($options{"a"})) {
...
@@ -80,9 +81,28 @@ if (defined($options{"a"})) {
$doabac
=
1
;
$doabac
=
1
;
}
}
usage
()
usage
()
if
(
@ARGV
<
2
);
if
(
@ARGV
<
1
);
my
$user_urn
=
shift
();
my
$user_urn
=
shift
();
my
$speaker_urn
=
shift
();
my
$speaker
;
if
(
@ARGV
)
{
my
$speaker_urn
=
shift
();
if
(
!
(
GeniHRN::
IsValid
(
$speaker_urn
)))
{
fatal
("
Malformed speaker urn
");
}
$speaker
=
GeniUser
->
Lookup
(
$speaker_urn
,
1
);
if
(
!
defined
(
$speaker
))
{
fatal
("
No such speaker in the DB
");
}
}
else
{
$speaker
=
GeniCertificate
->
LoadFromFile
(
$SACERT
);
if
(
!
defined
(
$speaker
))
{
fatal
("
Could not load certificate from
$SACERT
\n
");
}
$speaker
->
LoadKeyFromFile
(
$SACERT
);
}
#
#
# Must be an emulab user.
# Must be an emulab user.
...
@@ -94,13 +114,6 @@ my $geniuser = GeniUser->Lookup($user_urn, 1);
...
@@ -94,13 +114,6 @@ my $geniuser = GeniUser->Lookup($user_urn, 1);
if
(
!
defined
(
$geniuser
))
{
if
(
!
defined
(
$geniuser
))
{
fatal
("
No such user in the DB
");
fatal
("
No such user in the DB
");
}
}
if
(
!
(
GeniHRN::
IsValid
(
$speaker_urn
)))
{
fatal
("
Malformed speaker urn
");
}
my
$speaker
=
GeniUser
->
Lookup
(
$speaker_urn
,
1
);
if
(
!
defined
(
$speaker
))
{
fatal
("
No such speaker in the DB
");
}
if
(
$doabac
)
{
if
(
$doabac
)
{
require
ABAC
;
require
ABAC
;
...
@@ -141,7 +154,7 @@ if ($doabac) {
...
@@ -141,7 +154,7 @@ if ($doabac) {
print
$xml
;
print
$xml
;
}
}
}
}
e
lse
{
E
lse
{
my
$credential
=
GeniCredential
->
Create
(
$geniuser
,
$speaker
);
my
$credential
=
GeniCredential
->
Create
(
$geniuser
,
$speaker
);
fatal
("
Could not create credential
")
fatal
("
Could not create credential
")
if
(
!
defined
(
$credential
));
if
(
!
defined
(
$credential
));
...
...
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