>From 69f06d4f04aca5b44d1e8063b32988a87765a3e4 Mon Sep 17 00:00:00 2001
From: Phil Mayers <p.mayers@imperial.ac.uk>
Date: Mon, 11 Oct 2010 12:29:44 +0100
Subject: [PATCH 1/4] fix compile error in rlm_soh; use DEBUG macros in soh.c

---
 src/lib/soh.c                 |   36 ++++++++++++++++++------------------
 src/modules/rlm_soh/rlm_soh.c |    2 +-
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/lib/soh.c b/src/lib/soh.c
index 3e8af78..3310c36 100644
--- a/src/lib/soh.c
+++ b/src/lib/soh.c
@@ -116,7 +116,7 @@ static int eapsoh_mstlv(VALUE_PAIR *sohvp, const uint8_t *p, unsigned int data_l
 				 * MS-SOH section 2.2.4.1
 				 */
 				if (data_len < 18) {
-					DEBUG("insufficient data for MS-Machine-Inventory-Packet");
+					DEBUG("insufficient data for MS-Machine-Inventory-Packet\n");
 					return 0;
 				}
 				data_len -= 18;
@@ -171,7 +171,7 @@ static int eapsoh_mstlv(VALUE_PAIR *sohvp, const uint8_t *p, unsigned int data_l
 				/* MS-Packet-Info
 				 * MS-SOH 2.2.4.3
 				 */
-				DEBUG("SoH MS-Packet-Info %s vers=%i", *p & 0x10 ? "request" : "response", *p & 0xf);
+				DEBUG("SoH MS-Packet-Info %s vers=%i\n", *p & 0x10 ? "request" : "response", *p & 0xf);
 				p++;
 				data_len--;
 				break;
@@ -252,7 +252,7 @@ static int eapsoh_mstlv(VALUE_PAIR *sohvp, const uint8_t *p, unsigned int data_l
 				break;
 
 			default:
-				DEBUG("SoH Unknown MS TV %i stopping", c);
+				DEBUG("SoH Unknown MS TV %i stopping\n", c);
 				return 0;
 		}
 	}
@@ -318,14 +318,14 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 	hdr.tlv_vendor = soh_pull_be_32(data); data += 4;
 
 	if (hdr.tlv_type != 7 || hdr.tlv_vendor != 0x137) {
-		fr_strerror_printf("SoH payload is %i %08x not a ms-vendor packet", hdr.tlv_type, hdr.tlv_vendor);
+		DEBUG("SoH payload is %i %08x not a ms-vendor packet\n", hdr.tlv_type, hdr.tlv_vendor);
 		return -1;
 	}
 
 	hdr.soh_type = soh_pull_be_16(data); data += 2;
 	hdr.soh_len = soh_pull_be_16(data); data += 2;
 	if (hdr.soh_type != 1) {
-		fr_strerror_printf("SoH tlv %04x is not a response", hdr.soh_type);
+		DEBUG("SoH tlv %04x is not a response\n", hdr.soh_type);
 		return -1;
 	}
 
@@ -338,13 +338,13 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 
 
 	if (resp.outer_type!=7 || resp.vendor != 0x137) {
-		fr_strerror_printf("SoH response outer type %i/vendor %08x not recognised", resp.outer_type, resp.vendor);
+		DEBUG("SoH response outer type %i/vendor %08x not recognised\n", resp.outer_type, resp.vendor);
 		return -1;
 	}
 	switch (resp.inner_type) {
 		case 1:
 			/* no mode sub-header */
-			fr_strerror_printf("SoH without mode subheader");
+			DEBUG("SoH without mode subheader\n");
 			break;
 		case 2:
 			mode.outer_type = soh_pull_be_16(data); data += 2;
@@ -356,13 +356,13 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 			data += 2;
 
 			if (mode.outer_type != 7 || mode.vendor != 0x137 || mode.content_type != 0) {
-				fr_strerror_printf("SoH mode subheader outer type %i/vendor %08x/content type %i invalid", mode.outer_type, mode.vendor, mode.content_type);
+				DEBUG("SoH mode subheader outer type %i/vendor %08x/content type %i invalid\n", mode.outer_type, mode.vendor, mode.content_type);
 				return -1;
 			}
-			DEBUG("SoH with mode subheader");
+			DEBUG("SoH with mode subheader\n");
 			break;
 		default:
-			fr_strerror_printf("SoH invalid inner type %i", resp.inner_type);
+			DEBUG("SoH invalid inner type %i\n", resp.inner_type);
 			return -1;
 	}
 
@@ -400,7 +400,7 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 				 */
 				curr_shid = soh_pull_be_24(data);
 				curr_shid_c = data[3];
-				DEBUG("SoH System-Health-ID vendor %08x component=%i", curr_shid, curr_shid_c);
+				DEBUG("SoH System-Health-ID vendor %08x component=%i\n", curr_shid, curr_shid_c);
 				break;
 
 			case 7:
@@ -411,10 +411,10 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 				 * N bytes payload; for Microsoft component#0 this is the MS TV stuff
 				 */
 				if (curr_shid==0x137 && curr_shid_c==0) {
-					DEBUG("SoH MS type-value payload");
+					DEBUG("SoH MS type-value payload\n");
 					eapsoh_mstlv(sohvp, data + 4, tlv.tlv_len - 4);
 				} else {
-					fr_strerror_printf("SoH unhandled vendor-specific TLV %08x/component=%i %i bytes payload", curr_shid, curr_shid_c, tlv.tlv_len);
+					DEBUG("SoH unhandled vendor-specific TLV %08x/component=%i %i bytes payload\n", curr_shid, curr_shid_c, tlv.tlv_len);
 				}
 				break;
 
@@ -424,7 +424,7 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 				 *
 				 * 1 byte integer
 				 */
-				DEBUG("SoH Health-Class %i", data[0]);
+				DEBUG("SoH Health-Class %i\n", data[0]);
 				curr_hc = data[0];
 				break;
 
@@ -434,7 +434,7 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 				 *
 				 * 1 byte integer
 				 */
-				DEBUG("SoH Software-Version %i", data[0]);
+				DEBUG("SoH Software-Version %i\n", data[0]);
 				break;
 
 			case 11:
@@ -450,14 +450,14 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 				 *  1 bit - 1==product up-to-date
 				 *  1 bit - 1==product enabled
 				 */
-				DEBUG("SoH Health-Class-Status - current shid=%08x component=%i", curr_shid, curr_shid_c);
+				DEBUG("SoH Health-Class-Status - current shid=%08x component=%i\n", curr_shid, curr_shid_c);
 
 				if (curr_shid==0x137 && curr_shid_c==128) {
 
 					const char *s, *t;
 					uint32_t hcstatus = soh_pull_be_32(data);
 
-					DEBUG("SoH Health-Class-Status microsoft DWORD=%08x", hcstatus);
+					DEBUG("SoH Health-Class-Status microsoft DWORD=%08x\n", hcstatus);
 
 					vp = pairmake("SoH-MS-Windows-Health-Status", NULL, T_OP_EQ);
 					switch (curr_hc) {
@@ -566,7 +566,7 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
 				break;
 
 			default:
-				DEBUG("SoH Unknown TLV %i len=%i", tlv.tlv_type, tlv.tlv_len);
+				DEBUG("SoH Unknown TLV %i len=%i\n", tlv.tlv_type, tlv.tlv_len);
 				break;
 		}
 
diff --git a/src/modules/rlm_soh/rlm_soh.c b/src/modules/rlm_soh/rlm_soh.c
index c5aa1fe..027e0f6 100644
--- a/src/modules/rlm_soh/rlm_soh.c
+++ b/src/modules/rlm_soh/rlm_soh.c
@@ -205,7 +205,7 @@ static int soh_authorize(UNUSED void * instance, REQUEST *request)
 
 	RDEBUG("SoH radius VP found");
 	/* decode it */
-	rv = soh_verify(request, request->packet->vps, vp->vp_octets, vp->length);
+	rv = soh_verify(request->packet->vps, vp->vp_octets, vp->length);
 
 	return RLM_MODULE_OK;
 }
-- 
1.6.6.1

