Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
3bb0aac7
Commit
3bb0aac7
authored
May 12, 2010
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back in the Prefix lookup, which was dropped in previous release.
parent
a5d87811
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
protogeni/lib/GeniAuthority.pm.in
protogeni/lib/GeniAuthority.pm.in
+39
-0
No files found.
protogeni/lib/GeniAuthority.pm.in
View file @
3bb0aac7
...
...
@@ -64,6 +64,11 @@ sub Lookup($$)
elsif
($
token
=~
/^\
w
+\-\
w
+\-\
w
+\-\
w
+\-\
w
+$/)
{
$
uuid
=
$
token
;
}
elsif
($
token
=~
/^
P
([\
w
]+)$/)
{
#
Only
SAs
are
looked
up
this
way
.
#
This
will
be
flushed
after
URNs
are
fully
pushed
out
.
return
GeniAuthority
->
LookupByPrefix
($
1
);
}
elsif
($
token
=~
/^[\
w
\.]*$/)
{
$
query_result
=
DBQueryWarn
(
"select uuid from geni_authorities "
.
...
...
@@ -372,6 +377,40 @@ sub ListAll($$)
return
0
;
}
#
#
Find
an
authority
by
looking
for
the
prefix
.
This
will
eventually
go
#
away
when
we
fully
switch
to
URNs
#
#
Note
tha
only
SAs
are
looked
up
this
way
.
#
sub
LookupByPrefix
($$)
{
my
($
class
,
$
uuid
)
=
@
_
;
my
$
prefix
;
if
($
uuid
=~
/^\
w
+\-\
w
+\-\
w
+\-\
w
+\-(\
w
+)$/)
{
$
prefix
=
$
1
;
}
elsif
($
uuid
=~
/^(\
w
+)$/)
{
$
prefix
=
$
1
;
}
else
{
print
STDERR
"Could not parse uuid for prefix
\n
"
;
return
undef
;
}
my
$
query_result
=
DBQueryWarn
(
"select uuid from geni_authorities "
.
"where uuid_prefix='$prefix' and type='sa'"
);
return
undef
if
(
! $query_result || !$query_result->numrows);
($
uuid
)
=
$
query_result
->
fetchrow_array
();
return
GeniAuthority
->
Lookup
($
uuid
);
}
#
_Always_
make
sure
that
this
1
is
at
the
end
of
the
file
...
1
;
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