In tac_get_av_value() empty attributes should be handled like 0-length

strings rather than unset strings.
Fix the present wrong behaviour.

Obtained from:	Sandvine Incorporated
Reviewed by:	emaste
Sponsored by:	Sandvine Incorporated
MFC:		1 week
This commit is contained in:
Attilio Rao 2009-11-25 14:59:28 +00:00
parent f413289ee0
commit 5e3d7b099a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=199802

View file

@ -1263,8 +1263,13 @@ tac_get_av_value(struct tac_handle *h, const char *attribute)
* h->srvr_avs[0] = "foobie=var1"
* h->srvr_avs[1] = "foo=var2"
* is handled.
*
* Note that for empty string attribute values a
* 0-length string is returned in order to distinguish
* against unset values.
* dump_str() will handle srvr.len == 0 correctly.
*/
if (found_seperator == 1 && ch != end) {
if (found_seperator == 1) {
srvr.len = end - ch;
srvr.data = ch;
return dup_str(h, &srvr, NULL);