Bug 218011 - net-mgmt/net-snmp: Always pass valid flags to getfsstat()
Summary: net-mgmt/net-snmp: Always pass valid flags to getfsstat()
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ryan Steinmetz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-22 16:50 UTC by John Baldwin
Modified: 2017-04-14 19:00 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (zi)


Attachments
net-snmp.getfsstat.patch (1.22 KB, patch)
2017-03-22 16:50 UTC, John Baldwin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Baldwin freebsd_committer freebsd_triage 2017-03-22 16:50:39 UTC
Created attachment 181062 [details]
net-snmp.getfsstat.patch

The getfsstat() manpage says that the last argument should either be MNT_NOWAIT or MNT_WAIT.  I recently changed the code in HEAD (and then merged to stable/11) to validate this argument so that invalid values are rejected with EINVAL.  net-snmp calls getfsstat() in 4 places, 3 of which use MNT_NOWAIT and 1 which passes '0'.  This patch fixes the 4th instance to use MNT_NOWAIT.

Issue reported by Slawa (cc'd).  I've only tested that the patch applies, I have not run-tested this.  Hopefully Slawa can verify the patch works correctly at runtime.
Comment 1 slw 2017-03-22 17:42:22 UTC
(In reply to John Baldwin from comment #0)

Yes, this work for me
Comment 2 John Baldwin freebsd_committer freebsd_triage 2017-03-30 17:19:08 UTC
This probably warrants a port revision bump as well.
Comment 3 Ryan Steinmetz freebsd_committer freebsd_triage 2017-04-08 01:51:45 UTC
Approved, please open a ticket upstream as well if you can.
Comment 4 John Baldwin freebsd_committer freebsd_triage 2017-04-10 17:13:27 UTC
Created upstream bug report: https://sourceforge.net/p/net-snmp/patches/1340/
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-04-10 17:18:31 UTC
A commit references this bug:

Author: jhb
Date: Mon Apr 10 17:17:33 UTC 2017
New revision: 438192
URL: https://svnweb.freebsd.org/changeset/ports/438192

Log:
  Always pass MNT_NOWAIT to getfsstat() as documented in the manpage.

  One of the four calls in net-snmp currently passes 0 which triggers an
  EINVAL change after recent changes in HEAD and 11-stable to add stricter
  argument checking for the flags passed to getsstat().

  Bump PORTREVISION.

  PR:		218011
  Reported by:	Slawa Olhovchenkov <slw@zxy.spb.ru>
  Reviewed by:	brooks
  Approved by:	maintainer (zi)

Changes:
  head/net-mgmt/net-snmp/Makefile
  head/net-mgmt/net-snmp/files/patch-agent_mibgroup_hardware_fsys_fsys__getfsstats.c
Comment 6 John Baldwin freebsd_committer freebsd_triage 2017-04-14 19:00:16 UTC
FYI, patch accepted upstream.