Date: Tue, 2 Oct 2012 16:29:46 GMT From: "Daniel U. Thibault" <daniel.thibault@drdc-rddc.gc.ca> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/172277: OpenBSM-21/openbsm/libbsm/bsm_token.c au_to_socket_ex comments contradicted by code Message-ID: <201210021629.q92GTk9V015107@red.freebsd.org> Resent-Message-ID: <201210021630.q92GUPul054207@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 172277
>Category: misc
>Synopsis: OpenBSM-21/openbsm/libbsm/bsm_token.c au_to_socket_ex comments contradicted by code
>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: Tue Oct 02 16:30:25 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Daniel U. Thibault
>Release:
>Organization:
DRDC Valcartier
>Environment:
>Description:
The au_to_socket_ex function of bsm_token.c (a component of the current libbsm implementation) reads in part:
/*
[...]
* Domain and type arguments to this routine are assumed to already have been
* converted to the BSM constant space, so we don't do that here.
*/
token_t *
au_to_socket_ex(u_short so_domain, u_short so_type,
struct sockaddr *sa_local, struct sockaddr *sa_remote)
{
[...]
ADD_U_INT16(dptr, au_domain_to_bsm(so_domain));
ADD_U_INT16(dptr, au_socket_type_to_bsm(so_type));
The documentation claims the socket domain and type are assumed already converted to the BSM constant space, but the code invokes au_domain_to_bsm and au_socket_type_to_bsm, two functions (bsm_domain.c) which, unless I'm very much mistaken, actually do convert from the local domain to the BSM domain.
Either the documentation needs to be corrected, or the code is wrong.
>How-To-Repeat:
Look up http://www.opensource.apple.com/source/OpenBSM/OpenBSM-21/openbsm/libbsm/bsm_token.c and http://www.opensource.apple.com/source/OpenBSM/OpenBSM-21/openbsm/libbsm/bsm_domain.c and search for au_to_socket_ex, au_domain_to_bsm and au_socket_type_to_bsm.
>Fix:
If the documentation is to be fixed, change the au_to_socket_ex preamble to conclude with:
* Domain and type arguments to this routine are assumed to be in the local
* constant space; they are converted to the BSM constant space before
* incorporation in the token.
*/
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210021629.q92GTk9V015107>
