Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
23ff9700
authored
Jul 03, 2014
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make django-sshkey-lookup handle all lookup cases
parent
9630800e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
6 deletions
+62
-6
django-sshkey-lookup
+62
-6
No files found.
django-sshkey-lookup
View file @
23ff9700
...
...
@@ -27,14 +27,70 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
usage
()
{
echo
"Usage:
$0
-a URL"
echo
"
$0
-u URL USERNAME"
echo
"
$0
-f URL FINGERPRINT"
echo
"
$0
URL [USERNAME]"
}
mode
=
x
while
getopts
':hafu'
opt
;
do
case
$opt
in
h
)
usage
exit
0
;;
a
)
mode
=
a
;;
f
)
mode
=
f
;;
u
)
mode
=
u
;;
[
?]
)
exec
1>&2
echo
"Invalid option: -
$OPTARG
"
usage
exit
1
;;
esac
done
shift
$((
$OPTIND
-
1
))
if
[
$#
-eq
0
]
;
then
echo
"Usage:
$0
URL [USERNAME]"
>
&2
usage
>
&2
exit
1
fi
SSHKEY_LOOKUP_URL
=
"
$1
"
export
SSHKEY_LOOKUP_URL
if
[
$#
-eq
1
]
;
then
exec
`
dirname
$0
`
/django-sshkey-lookup-by-fingerprint
url
=
"
$1
"
case
$mode
in
a
)
query
=
;;
f
)
if
[
$#
-lt
2
]
;
then
usage
>
&2
exit
1
fi
query
=
"fingerprint=
$2
"
;;
u
)
if
[
$#
-lt
2
]
;
then
usage
>
&2
exit
1
fi
query
=
"username=
$2
"
;;
x
)
if
[
$#
-eq
1
]
;
then
SSHKEY_LOOKUP_URL
=
"
${
url
}
"
export
SSHKEY_LOOKUP_URL
exec
`
dirname
$0
`
/django-sshkey-lookup-by-fingerprint
else
query
=
"username=
$2
"
fi
;;
esac
if
type
curl
>
/dev/null 2>&1
;
then
exec
curl
-s
-G
"
${
url
}
"
--data-urlencode
"
${
query
}
"
else
exec
`
dirname
$0
`
/django-sshkey-lookup-by-username
"
$2
"
exec
wget
-q
-O
-
"
${
url
}
?
${
query
}
"
fi
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