projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updates.
[silc.git]
/
lib
/
silccore
/
silcauth.c
diff --git
a/lib/silccore/silcauth.c
b/lib/silccore/silcauth.c
index a06246fdc201716608f190afcd3daa055d9f4506..7ac372d360238a57017c15427504d25b398f8126 100644
(file)
--- a/
lib/silccore/silcauth.c
+++ b/
lib/silccore/silcauth.c
@@
-43,20
+43,18
@@
struct SilcAuthPayloadStruct {
SilcAuthPayload silc_auth_payload_parse(unsigned char *data,
uint32 data_len)
{
SilcAuthPayload silc_auth_payload_parse(unsigned char *data,
uint32 data_len)
{
- SilcBuffer buffer;
+ SilcBuffer
Struct
buffer;
SilcAuthPayload new;
int ret;
SILC_LOG_DEBUG(("Parsing Authentication Payload"));
SilcAuthPayload new;
int ret;
SILC_LOG_DEBUG(("Parsing Authentication Payload"));
- buffer = silc_buffer_alloc(data_len);
- silc_buffer_pull_tail(buffer, SILC_BUFFER_END(buffer));
- silc_buffer_put(buffer, data, data_len);
+ silc_buffer_set(&buffer, data, data_len);
new = silc_calloc(1, sizeof(*new));
/* Parse the payload */
new = silc_calloc(1, sizeof(*new));
/* Parse the payload */
- ret = silc_buffer_unformat(buffer,
+ ret = silc_buffer_unformat(
&
buffer,
SILC_STR_UI_SHORT(&new->len),
SILC_STR_UI_SHORT(&new->auth_method),
SILC_STR_UI16_NSTRING_ALLOC(&new->random_data,
SILC_STR_UI_SHORT(&new->len),
SILC_STR_UI_SHORT(&new->auth_method),
SILC_STR_UI16_NSTRING_ALLOC(&new->random_data,
@@
-66,18
+64,14
@@
SilcAuthPayload silc_auth_payload_parse(unsigned char *data,
SILC_STR_END);
if (ret == -1) {
silc_free(new);
SILC_STR_END);
if (ret == -1) {
silc_free(new);
- silc_buffer_free(buffer);
return NULL;
}
return NULL;
}
- if (new->len != buffer
->
len) {
+ if (new->len != buffer
.
len) {
silc_auth_payload_free(new);
silc_auth_payload_free(new);
- silc_buffer_free(buffer);
return NULL;
}
return NULL;
}
- silc_buffer_free(buffer);
-
/* If password authentication, random data must not be set */
if (new->auth_method == SILC_AUTH_PASSWORD && new->random_len) {
silc_auth_payload_free(new);
/* If password authentication, random data must not be set */
if (new->auth_method == SILC_AUTH_PASSWORD && new->random_len) {
silc_auth_payload_free(new);