projects
/
routeros-api.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fbcc292
)
Login handlers: Check status code of replies.
author
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Thu, 19 Nov 2009 11:51:20 +0000
(12:51 +0100)
committer
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Thu, 19 Nov 2009 11:51:20 +0000
(12:51 +0100)
src/main.c
patch
|
blob
|
history
diff --git
a/src/main.c
b/src/main.c
index
4ad7e8f
..
1c9fefe
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-638,6
+638,12
@@
static int login2_handler (mt_connection_t *c, const mt_reply_t *r, /* {{{ */
printf ("login2_handler has been called.\n");
reply_dump (r);
printf ("login2_handler has been called.\n");
reply_dump (r);
+ if (strcmp (r->status, "done") != 0)
+ {
+ mt_debug ("login2_handler: Unexpected status: %s.\n", r->status);
+ return (EPROTO);
+ }
+
return (0);
} /* }}} int login2_handler */
return (0);
} /* }}} int login2_handler */
@@
-709,9
+715,22
@@
static int login_handler (mt_connection_t *c, const mt_reply_t *r, /* {{{ */
if (r == NULL)
return (EINVAL);
if (r == NULL)
return (EINVAL);
+ /* The expected result looks like this:
+ * -- 8< --
+ * !done
+ * =ret=ebddd18303a54111e2dea05a92ab46b4
+ * -- >8 --
+ */
+
printf ("login_handler has been called.\n");
reply_dump (r);
printf ("login_handler has been called.\n");
reply_dump (r);
+ if (strcmp (r->status, "done") != 0)
+ {
+ mt_debug ("login_handler: Unexpected status: %s.\n", r->status);
+ return (EPROTO);
+ }
+
login_data = user_data;
if (login_data == NULL)
return (EINVAL);
login_data = user_data;
if (login_data == NULL)
return (EINVAL);