On mån, 2007-01-01 at 17:38 +0000, Dave Shield wrote:
> On 01/01/07, Magnus Fromreide <[EMAIL PROTECTED]> wrote:
> > Using this patch i get a segmentation violation when I run snmptrap as
> > an unpriviliged user since it insists that /var/net-snmp should be
> > updated but that path is not user writeable and no checking is done on
> > the return values of fopen.
> 
> I've just applied the following patch, which ought to address that problem.
> Please let me know whether this works for you or not.
> 
> Dave
> 
> ----- cut here -----
> --- mib.c       1 Jan 2007 15:29:30 -0000       5.105
> +++ mib.c       1 Jan 2007 17:34:50 -0000
> @@ -2845,7 +2845,8 @@
>      }
>      DEBUGMSGTL(("mibindex", "new: %s (%s)\n", dirname, cp ));
>      fp = fopen( cp, "w" );
> -    fprintf( fp, "DIR %s\n", dirname );
> +    if (fp)
> +        fprintf( fp, "DIR %s\n", dirname );
>      return fp;
>  }

The patch made snmptrap run successfully but it generates the message

Creating directory: /var/net-snmp/mib_indexes

even when not doing so.

Thanks for the patch.

/MF


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to