From owner-p4-projects@FreeBSD.ORG Mon Apr 14 22:33:00 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 934A232F; Mon, 14 Apr 2014 22:33:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D04432D for ; Mon, 14 Apr 2014 22:33:00 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2869915D9 for ; Mon, 14 Apr 2014 22:33:00 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.8/8.14.8) with ESMTP id s3EMWx08084361 for ; Mon, 14 Apr 2014 22:33:00 GMT (envelope-from brueffer@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.8/8.14.8/Submit) id s3EMWxPb084358 for perforce@freebsd.org; Mon, 14 Apr 2014 22:32:59 GMT (envelope-from brueffer@freebsd.org) Date: Mon, 14 Apr 2014 22:32:59 GMT Message-Id: <201404142232.s3EMWxPb084358@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brueffer@freebsd.org using -f From: Christian Brueffer Subject: PERFORCE change 1192820 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.17 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2014 22:33:00 -0000 http://p4web.freebsd.org/@@1192820?ac=10 Change 1192820 by brueffer@brueffer_freefall on 2014/04/14 22:32:54 Check readlink() return value; auditd_expire_trails() may return ADE_READLINK now. While here, fix a comment typo. Affected files ... .. //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 (text+ko) ==== @@ -26,7 +26,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/libauditd/auditd_lib.c#18 $ + * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 $ */ #include @@ -402,12 +402,13 @@ * ADE_NOERR on success or there is nothing to do. * ADE_PARSE if error parsing audit_control(5). * ADE_NOMEM if could not allocate memory. - * ADE_EXPIRE if there was an unespected error. + * ADE_READLINK if could not read link file. + * ADE_EXPIRE if there was an unexpected error. */ int auditd_expire_trails(int (*warn_expired)(char *)) { - int andflg, ret = ADE_NOERR; + int andflg, len, ret = ADE_NOERR; size_t expire_size, total_size = 0L; time_t expire_age, oldest_time, current_time = time(NULL); struct dir_ent *traildir; @@ -431,7 +432,9 @@ * Read the 'current' trail file name. Trim off directory path. */ activefn[0] = '\0'; - readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1); + len = readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1); + if (len < 0) + return (ADE_READLINK); if ((afnp = strrchr(activefn, '/')) != NULL) afnp++;