PERFORCE change 161590 for review
Stacey Son
sson at FreeBSD.org
Tue May 5 01:40:39 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=161590
Change 161590 by sson at sson_amd64 on 2009/05/05 01:40:11
Add IPv6 support for au_to_me().
Fixes a bug when the terminal ID has an IPv6 address type. au_to_me()
now calls getaudit_addr(2) first. If it fails with ENOSYS it falls
back to calling getaudit(2) to support legacy systems.
Affected files ...
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#92 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#92 (text+ko) ====
@@ -30,7 +30,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#91 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#92 $
*/
#include <sys/types.h>
@@ -1270,12 +1270,27 @@
au_to_me(void)
{
auditinfo_t auinfo;
+ auditinfo_addr_t aia;
- if (getaudit(&auinfo) != 0)
- return (NULL);
+ /*
+ * Try to use getaudit_addr(2) first. If this kernel does not support
+ * it, then fall back on to getaudit(2).
+ */
+ if (getaudit_addr(&aia, sizeof(aia)) != 0) {
+ if (errno == ENOSYS) {
+ if (getaudit(&auinfo) != 0)
+ return (NULL);
+ return (au_to_subject32(auinfo.ai_auid, geteuid(),
+ getegid(), getuid(), getgid(), getpid(),
+ auinfo.ai_asid, &auinfo.ai_termid));
+ } else {
+ /* getaudit_addr(2) failed for some other reason. */
+ return (NULL);
+ }
+ }
- return (au_to_subject32(auinfo.ai_auid, geteuid(), getegid(),
- getuid(), getgid(), getpid(), auinfo.ai_asid, &auinfo.ai_termid));
+ return (au_to_subject32_ex(aia.ai_auid, geteuid(), getegid(), getuid(),
+ getgid(), getpid(), aia.ai_asid, &aia.ai_termid));
}
#endif
More information about the p4-projects
mailing list