From: Chris Mikkelson Date: Tue, 7 Feb 2012 21:40:13 +0000 (-0600) Subject: Print abinary values without delimiters, unless requested by caller. X-Git-Tag: release_2_2_0~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a29c7a20d6e2a3595dae5d3873b7f70103340e9;p=thirdparty%2Ffreeradius-server.git Print abinary values without delimiters, unless requested by caller. --- diff --git a/src/include/libradius.h b/src/include/libradius.h index e7d18379658..729077c0671 100644 --- a/src/include/libradius.h +++ b/src/include/libradius.h @@ -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 */ diff --git a/src/lib/filters.c b/src/lib/filters.c index 33e3db4b675..2a2c92f895f 100644 --- a/src/lib/filters.c +++ b/src/lib/filters.c @@ -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 diff --git a/src/lib/print.c b/src/lib/print.c index db5b7d9407f..e6bb49e821e 100644 --- a/src/lib/print.c +++ b/src/lib/print.c @@ -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 */