Hi,

It  seems  there are  some  problems in  the  way  tkmib handles  it's
configuration file :

 - The command line switch -C is used twice
 - the  filename  option value  is  sometimes  called $opts{'C'},  and
   sometimes $opts{C}
 - the  parameters read in  the configuration file are  overwritten by
   hardcoded default parameters.

So here is a patch that tries to correct these.

Please note that  I am quite new to net-snmp, and  not a perl/tk guru,
so it is probable that I missed something.


Index: local/tkmib
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/local/tkmib,v
retrieving revision 5.1
diff -r5.1 tkmib
57c57
< $opts{'C'}=$ENV{'HOME'} . "/.snmp/tkmibrc";
---
> $opts{'f'} = $ENV{'HOME'} . "/.snmp/tkmibrc";
59,76c59
< # default session options
< if (test_version(1,5,0,0)) {
<     print "setting opts\n";
<     %opts = (
<            'c'          => "public",
<            'p'   => 161,
<            't'      => 5000000,
<            'r'      => 5,
<            'v'      => 1,
<            'a'    => 'MD5',
<            'x'    => 'DES',
<            'A'     => '',
<            'X'     => '',
<            'n'      => '',
<            'u'      => 'initial',
<            'l'     => 'authNoPriv',
<            );
< }
---
> getopts("hp:v:a:A:x:X:n:u:l:r:t:o:c:Cf:", \%opts);
78c61,76
< getopts("hp:v:a:A:x:X:n:u:l:r:t:o:c:C", \%opts);
---
> # default session options
> print "setting opts\n";
> %session_opts = (
>       'Community'    => "public",
>       'RemotePort'   => 161,
>       'Timeout'      => 5000000,
>       'Retries'      => 5,
>       'Version'      => 1,
>       'AuthProto'    => 'MD5',
>       'PrivProto'    => 'DES',
>       'AuthPass'     => '',
>       'PrivPass'     => '',
>       'Context'      => '',
>       'SecName'      => 'initial',
>       'SecLevel'     => 'authNoPriv',
>       );
83,84c81,82
<   -C CONFIG_FILE  load CONFIG_FILE after starting up. (default: 
~/.snmp/tkmibrc)
<                   (use -C /dev/null to not read one).
---
>   -f CONFIG_FILE  load CONFIG_FILE after starting up. (default: 
> ~/.snmp/tkmibrc)
>                   (use -f /dev/null to not read one).
107c105
< do $opts{'C'} if ($opts{'C'} && -f $opts{'C'});
---
> do $opts{'f'} if ($opts{'f'} && -f $opts{'f'});
937,938c935,936
<     if (!open(O,">$opts{C}")) {
<       warn "can't save to $opts{C}\n";
---
>     if (!open(O,">$opts{'f'}")) {
>       warn "can't save to $opts{'f'}\n";
949c947
<     $status->configure(-text => "saved options to $opts{C}");
---
>     $status->configure(-text => "saved options to $opts{'f'}");

-------------------------------------------------------------------------
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