summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 593ea76)
raw | patch | inline | side by side (parent: 593ea76)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 8 Apr 2010 19:36:06 +0000 (21:36 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 8 Apr 2010 19:36:06 +0000 (21:36 +0200) |
src/network.c | patch | blob | history |
diff --git a/src/network.c b/src/network.c
index 74325a29483af445415cf89256f7be664721c559..5ebde771a602361ff5d008e759b98892d935073e 100644 (file)
--- a/src/network.c
+++ b/src/network.c
return (!received);
} /* }}} _Bool check_send_okay */
-static int network_dispatch_values (value_list_t *vl) /* {{{ */
+static int network_dispatch_values (value_list_t *vl, /* {{{ */
+ const char *username)
{
int status;
return (status);
}
+ if (username != NULL)
+ {
+ status = meta_data_add_string (vl->meta, "network:username", username);
+ if (status != 0)
+ {
+ ERROR ("network plugin: meta_data_add_string failed.");
+ meta_data_destroy (vl->meta);
+ vl->meta = NULL;
+ return (status);
+ }
+ }
+
plugin_dispatch_values (vl);
stats_values_dispatched++;
#define PP_SIGNED 0x01
#define PP_ENCRYPTED 0x02
static int parse_packet (sockent_t *se,
- void *buffer, size_t buffer_size, int flags);
+ void *buffer, size_t buffer_size, int flags,
+ const char *username);
#define BUFFER_READ(p,s) do { \
memcpy ((p), buffer + buffer_offset, (s)); \
{
ERROR ("network plugin: gcry_md_setkey failed: %s", gcry_strerror (err));
gcry_md_close (hd);
+ sfree (secret);
+ sfree (pss.username);
return (-1);
}
gcry_md_close (hd);
hd = NULL;
- sfree (secret);
- sfree (pss.username);
-
if (memcmp (pss.hash, hash, sizeof (pss.hash)) != 0)
{
WARNING ("network plugin: Verifying HMAC-SHA-256 signature failed: "
else
{
parse_packet (se, buffer + buffer_offset, buffer_len - buffer_offset,
- flags | PP_SIGNED);
+ flags | PP_SIGNED, pss.username);
}
+ sfree (secret);
+ sfree (pss.username);
+
*ret_buffer = buffer + buffer_len;
*ret_buffer_len = 0;
warning_has_been_printed = 1;
}
- parse_packet (se, buffer + part_len, buffer_size - part_len, flags);
+ parse_packet (se, buffer + part_len, buffer_size - part_len, flags,
+ /* username = */ NULL);
*ret_buffer = buffer + buffer_size;
*ret_buffer_size = 0;
}
parse_packet (se, buffer + buffer_offset, payload_len,
- flags | PP_ENCRYPTED);
+ flags | PP_ENCRYPTED, pea.username);
+
+ /* XXX: Free pea.username?!? */
/* Update return values */
*ret_buffer = buffer + part_size;
#undef BUFFER_READ
static int parse_packet (sockent_t *se, /* {{{ */
- void *buffer, size_t buffer_size, int flags)
+ void *buffer, size_t buffer_size, int flags,
+ const char *username)
{
int status;
if (status != 0)
break;
- network_dispatch_values (&vl);
+ network_dispatch_values (&vl, username);
sfree (vl.values);
}
continue;
}
- parse_packet (se, ent->data, ent->data_len, /* flags = */ 0);
+ parse_packet (se, ent->data, ent->data_len, /* flags = */ 0,
+ /* username = */ NULL);
sfree (ent->data);
sfree (ent);
} /* while (42) */