From: Alan T. DeKok Date: Thu, 30 Jul 2015 18:29:16 +0000 (+0200) Subject: Added packet / original for encode / decode attrs X-Git-Tag: release_3_0_10~274 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e616839a74b503f9edde3fd9b9e4d0eb64cce580;p=thirdparty%2Ffreeradius-server.git Added packet / original for encode / decode attrs --- diff --git a/src/main/radattr.c b/src/main/radattr.c index 8f76de12a80..e2fe0489ae5 100644 --- a/src/main/radattr.c +++ b/src/main/radattr.c @@ -63,6 +63,24 @@ static ssize_t xlat_test(UNUSED void *instance, UNUSED REQUEST *request, return 0; } +static RADIUS_PACKET my_original = { + .sockfd = -1, + .id = 0, + .code = PW_CODE_ACCESS_REQUEST, + .vector = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, +}; + + +static RADIUS_PACKET my_packet = { + .sockfd = -1, + .id = 0, + .code = PW_CODE_ACCESS_ACCEPT, + .vector = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, +}; + + +static char *my_secret = "testing123"; + /* * End of hacks for xlat * @@ -677,7 +695,7 @@ static void process_file(const char *root_dir, char const *filename) attr = data; vp = head; while (vp) { - len = rad_vp2attr(NULL, NULL, NULL, (VALUE_PAIR const **)(void **)&vp, + len = rad_vp2attr(&my_packet, &my_original, my_secret, (VALUE_PAIR const **)(void **)&vp, attr, data + sizeof(data) - attr); if (len < 0) { fprintf(stderr, "Failed encoding %s: %s\n", @@ -712,7 +730,7 @@ static void process_file(const char *root_dir, char const *filename) my_len = 0; while (len > 0) { vp = NULL; - my_len = rad_attr2vp(NULL, NULL, NULL, NULL, attr, len, &vp); + my_len = rad_attr2vp(NULL, &my_packet, &my_original, my_secret, attr, len, &vp); if (my_len < 0) { fr_pair_list_free(&head); break;