]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Print abinary values without delimiters, unless requested by caller.
authorChris Mikkelson <cmikk@qwest.net>
Tue, 7 Feb 2012 21:40:13 +0000 (15:40 -0600)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 8 Feb 2012 08:34:56 +0000 (09:34 +0100)
src/include/libradius.h
src/lib/filters.c
src/lib/print.c

index e7d183796584f14787aa50cdcf97b844d2874a96..729077c067133807e3a9df75099a091478abebaa 100644 (file)
@@ -420,7 +420,7 @@ int fr_sockaddr2ipaddr(const struct sockaddr_storage *sa, socklen_t salen,
 #ifdef ASCEND_BINARY
 /* filters.c */
 int            ascend_parse_filter(VALUE_PAIR *pair);
-void           print_abinary(VALUE_PAIR *vp, char *buffer, size_t len);
+void           print_abinary(const VALUE_PAIR *vp, char *buffer, size_t len, int delimitst);
 #endif /*ASCEND_BINARY*/
 
 /* random numbers in isaac.c */
index 33e3db4b675e9f96cc2d257aa8fb236a2d54440f..2a2c92f895f62a1acb0daf498f624768b673b682 100644 (file)
@@ -1142,7 +1142,7 @@ ascend_parse_filter(VALUE_PAIR *pair)
  *     Note we don't bother checking 'len' after the snprintf's.
  *     This function should ONLY be called with a large (~1k) buffer.
  */
-void print_abinary(VALUE_PAIR *vp, char *buffer, size_t len)
+void print_abinary(const VALUE_PAIR *vp, char *buffer, size_t len, int delimitst)
 {
   size_t               i;
   char                 *p;
@@ -1168,8 +1168,10 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, size_t len)
          return;
   }
 
-  *(p++) = '"';
-  len -= 3;                    /* account for leading & trailing quotes */
+  if (delimitst) {
+       *(p++) = '"';
+       len -= 3;                       /* account for leading & trailing quotes */
+  }
 
   filter = (ascend_filter_t *) &(vp->vp_filter);
   i = snprintf(p, len, "%s %s %s",
@@ -1313,7 +1315,7 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, size_t len)
     }
   }
 
-  *(p++) = '"';
+  if (delimitst) *(p++) = '"';
   *p = '\0';
 }
 #endif
index db5b7d9407f179fb8ebf13a12e76ecda9c4a5a8a..e6bb49e821eebbe04eaf8cbb4c3c2c2c738e84da 100644 (file)
@@ -286,7 +286,7 @@ int vp_prints_value(char * out, size_t outlen, VALUE_PAIR *vp, int delimitst)
                case PW_TYPE_ABINARY:
 #ifdef ASCEND_BINARY
                        a = buf;
-                       print_abinary(vp, buf, sizeof(buf));
+                       print_abinary(vp, buf, sizeof(buf), delimitst);
                        break;
 #else
                  /* FALL THROUGH */