Move the SoH code to the server directory
authorAlan T. DeKok <aland@freeradius.org>
Tue, 12 Oct 2010 11:04:15 +0000 (13:04 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 12 Oct 2010 11:14:58 +0000 (13:14 +0200)
The code is suitable only for servers, not clients.  So it doesn't need
to be in the client library.

src/lib/Makefile
src/main/Makefile.in
src/main/soh.c [moved from src/lib/soh.c with 95% similarity]

index ffc7f09..2557201 100644 (file)
@@ -10,7 +10,7 @@ SRCS          = dict.c filters.c hash.c hmac.c hmacsha1.c isaac.c log.c \
                  misc.c missing.c md4.c md5.c print.c radius.c rbtree.c \
                  sha1.c snprintf.c strlcat.c strlcpy.c token.c udpfromto.c \
                  valuepair.c fifo.c packet.c event.c getaddrinfo.c vqp.c \
-                 heap.c dhcp.c tcp.c soh.c
+                 heap.c dhcp.c tcp.c
 
 LT_OBJS                = $(SRCS:.c=.lo)
 
index d626478..da8ac1b 100644 (file)
@@ -6,7 +6,7 @@ include ../../Make.inc
 
 SERVER_SRCS    = acct.c auth.c client.c conffile.c crypt.c exec.c files.c \
                  listen.c log.c mainconfig.c modules.c modcall.c \
-                 radiusd.c stats.c \
+                 radiusd.c stats.c soh.c \
                  session.c threads.c util.c valuepair.c version.c  \
                  xlat.c event.c realms.c evaluate.c vmps.c detail.c
 
similarity index 95%
rename from src/lib/soh.c
rename to src/main/soh.c
index 3e8af78..ca4de00 100644 (file)
@@ -23,6 +23,7 @@
 #include <freeradius-devel/ident.h>
 RCSID("$Id$")
 
+#include <freeradius-devel/radiusd.h>
 #include <freeradius-devel/soh.h>
 
 /*
@@ -318,14 +319,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", 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", hdr.soh_type);
                return -1;
        }
 
@@ -338,13 +339,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", 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");
                        break;
                case 2:
                        mode.outer_type = soh_pull_be_16(data); data += 2;
@@ -356,13 +357,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", mode.outer_type, mode.vendor, mode.content_type);
                                return -1;
                        }
                        DEBUG("SoH with mode subheader");
                        break;
                default:
-                       fr_strerror_printf("SoH invalid inner type %i", resp.inner_type);
+                       DEBUG("SoH invalid inner type %i", resp.inner_type);
                        return -1;
        }
 
@@ -414,7 +415,7 @@ int soh_verify(VALUE_PAIR *sohvp, const uint8_t *data, unsigned int data_len) {
                                        DEBUG("SoH MS type-value payload");
                                        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", curr_shid, curr_shid_c, tlv.tlv_len);
                                }
                                break;