Allow 0x... for abinary
authoraland <aland>
Wed, 3 May 2006 17:38:51 +0000 (17:38 +0000)
committeraland <aland>
Wed, 3 May 2006 17:38:51 +0000 (17:38 +0000)
src/lib/valuepair.c

index 66a1d93..8e41a70 100644 (file)
@@ -806,26 +806,29 @@ VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value)
                        break;
                case PW_TYPE_ABINARY:
 #ifdef ASCEND_BINARY
-                       /*
-                        *      Special case to convert filter to binary
-                        */
-                       strNcpy(vp->vp_strvalue, value, sizeof(vp->vp_strvalue));
+                       if (strncasecmp(value, "0x", 2) == 0) {
+                               vp->type = PW_TYPE_OCTETS;
+                               goto do_octets;
+                       }
+
                        if (ascend_parse_filter(vp) < 0 ) {
                                librad_log("failed to parse Ascend binary attribute: %s",
                                           librad_errstr);
                                return NULL;
                        }
                        break;
+
                        /*
                         *      If Ascend binary is NOT defined,
                         *      then fall through to raw octets, so that
                         *      the user can at least make them by hand...
                         */
+       do_octets:
 #endif
                        /* raw octets: 0x01020304... */
                case PW_TYPE_OCTETS:
                        if (strncasecmp(value, "0x", 2) == 0) {
-                               u_char *us;
+                               uint8_t *us;
                                cp = value + 2;
                                us = vp->vp_strvalue;
                                vp->length = 0;