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_3_0_0_beta0~329^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8a75f0e0ccd309e194abc1a818f0d440d810db7;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 4b5618b6c9c..001195d0a51 100644 --- a/src/include/libradius.h +++ b/src/include/libradius.h @@ -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 */ diff --git a/src/lib/filters.c b/src/lib/filters.c index ba10a458106..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(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 diff --git a/src/lib/print.c b/src/lib/print.c index 619889a9587..f682d44811c 100644 --- a/src/lib/print.c +++ b/src/lib/print.c @@ -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 */