]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Print abinary values without delimiters, unless requested by caller. 48/head
authorChris Mikkelson <cmikk@qwest.net>
Tue, 7 Feb 2012 21:40:13 +0000 (15:40 -0600)
committerChris Mikkelson <cmikk@qwest.net>
Tue, 7 Feb 2012 21:53:51 +0000 (15:53 -0600)
src/include/libradius.h
src/lib/filters.c
src/lib/print.c

index 4b5618b6c9cb468b92d6776613eee62c437a6edf..001195d0a51d95d52fdd8a86faacc31c98ddc2e1 100644 (file)
@@ -484,7 +484,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(const 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 ba10a458106577b00a688fb94a9a04cd60f658f2..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(const 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(const 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(const VALUE_PAIR *vp, char *buffer, size_t len)
     }
   }
 
-  *(p++) = '"';
+  if (delimitst) *(p++) = '"';
   *p = '\0';
 }
 #endif
index 619889a9587450d2b34ed2707ab81d29df8ffacb..f682d44811cbae4b11042552500731cca0f689f8 100644 (file)
@@ -292,7 +292,7 @@ int vp_prints_value(char * out, size_t outlen, const VALUE_PAIR *vp, int delimit
                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 */