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
41586f18
Commit
41586f18
authored
May 28, 2010
by
Cody Cutler
Browse files
Fix bugs in tmcd imagekey
Make queries work and actually write something back to the client :]
parent
439edcca
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/tmcd.c
View file @
41586f18
...
...
@@ -4793,7 +4793,8 @@ COMMAND_PROTOTYPE(doquoteprep)
/*
* Get the decryption key for the image a node is suposed to be loading
*/
COMMAND_PROTOTYPE(doimagekey) {
COMMAND_PROTOTYPE
(
doimagekey
)
{
char
buf
[
MYBUFSIZE
];
char
*
bufp
=
buf
;
char
*
bufe
=
&
buf
[
MYBUFSIZE
];
...
...
@@ -4813,7 +4814,7 @@ COMMAND_PROTOTYPE(doimagekey) {
* probably not a good idea, but the right way to get it isn't clear
*/
res
=
mydb_query
(
"select op_mode, eventstate from nodes where "
"node_id='%s'",
1
,reqp->nodeid);
"node_id='%s'"
,
2
,
reqp
->
nodeid
);
if
(
!
res
)
{
error
(
"IMAGEKEY: %s: DB Error getting event state
\n
"
,
...
...
@@ -4848,7 +4849,7 @@ COMMAND_PROTOTYPE(doimagekey) {
/*
* Grab and return the key itself
*/
res = mydb_query("select decryption_key from current_reloads as r "
res
=
mydb_query
(
"select
r.
decryption_key from current_reloads as r "
"left join images as i on i.imageid = r.image_id "
"where node_id='%s' order by r.idx"
,
1
,
reqp
->
nodeid
);
...
...
@@ -4883,6 +4884,8 @@ COMMAND_PROTOTYPE(doimagekey) {
bufp
+=
OUTPUT
(
bufp
,
bufe
-
bufp
,
"%s"
,
row
[
0
]);
}
bufp
+=
OUTPUT
(
bufp
,
bufe
-
bufp
,
"
\n
"
);
client_writeback
(
sock
,
buf
,
strlen
(
buf
),
tcp
);
mysql_free_result
(
res
);
return
0
;
}
...
...
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