misc/80269: [PATCH] libtacplus tac_get_av_value will not return empty attribute value

Ed Maste emaste at phaedrus.sandvine.ca
Fri Apr 22 18:23:05 PDT 2005


>Number:         80269
>Category:       misc
>Synopsis:       [PATCH] libtacplus tac_get_av_value will not return empty attribute value
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 23 01:23:03 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Ed Maste
>Release:        5.3-RELEASE-p2
>Organization:
Sandvine Inc.
>Environment:
FreeBSD bsd10.phaedrus.sandvine.com 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #2: Fri Dec  3 13:30:36 EST 2004 root at bsd10.phaedrus.sandvine.com:/usr/obj/usr/src/sys/WORKFARM  i386

>Description:
We have an application that uses libtacplus(3).  During the authorization phase the tacplus server returns a list of attribute/value pairs.  If an attribute has an empty value, tac_get_av_value() returns NULL and not a zero-length string.  This makes it impossible to distinguish between a set but empty attribute and an unset attribute.

>How-To-Repeat:
Call tac_get_av_value() on a tac_handle containing an attribute with an empty value.
>Fix:
--- src/lib/libtacplus/taclib.c.orig       2005-04-22 20:25:41.000000000 -0400
+++ src/lib/libtacplus/taclib.c    2005-04-22 20:26:19.000000000 -0400
@@ -1264,8 +1264,11 @@
                         *     h->srvr_avs[0] = "foobie=var1"
                         *     h->srvr_avs[1] = "foo=var2"
                         * is handled.
+                        * Return 0-length string for empty attribute value,
+                        * to distinguish between empty and unset.  Note that
+                        * dup_str does the right thing if srvr.len = 0.
                         */
-                       if (found_seperator == 1 && ch != end) {
+                       if (found_seperator == 1) {
                                srvr.len = end - ch;
                                srvr.data = ch;
                                return dup_str(h, &srvr, NULL);

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list