~rdoering/ubuntu/intrepid/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/snmp/src/agent/snmp_community_mib.erl

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2007-05-01 16:57:10 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070501165710-2sapk0hp2gf3o0ip
Tags: 1:11.b.4-2ubuntu1
* Merge with Debian Unstable. Remaining changes:
  - Add -fno-stack-protector to fix broken crypto_drv.
* DebianMaintainerField update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
%% indirection.
221
221
%%-----------------------------------------------------------------
222
222
community2vacm(Community, Addr) ->
223
 
    case ets:lookup(snmp_community_cache, Community) of
224
 
        Found when list(Found) ->
225
 
            Fs = lists:keysort(2, Found),
226
 
            loop_c2v_rows(Fs, Addr);
227
 
        _ ->
228
 
            undefined
229
 
    end.
 
223
    Idxs = ets:lookup(snmp_community_cache, Community),
 
224
    loop_c2v_rows(lists:keysort(2, Idxs), Addr).
230
225
 
231
226
loop_c2v_rows([{_, CommunityIndex} | T], Addr) ->
 
227
    ?vtrace("loop_c2v_rows -> entry with"
 
228
            "~n   CommunityIndex: ~p", [CommunityIndex]),
232
229
    case get_row(CommunityIndex) of
233
230
        {_Community, VacmParams, Tag} ->
234
231
            {TDomain, TAddr} = Addr,
235
232
            case snmp_target_mib:is_valid_tag(Tag, TDomain, TAddr) of
236
233
                true ->
237
 
                    ?vtrace("loop_c2v_rows -> "
 
234
                    ?vdebug("loop_c2v_rows -> "
238
235
                            "~p valid tag for community index ~p", 
239
236
                            [Tag, CommunityIndex]),
240
237
                    VacmParams;
260
257
%%          in a notification.
261
258
%%-----------------------------------------------------------------
262
259
vacm2community(Vacm, Addr) ->
263
 
    case ets:lookup(snmp_community_cache, Vacm) of
264
 
        Found when list(Found) ->
265
 
            Fs = lists:keysort(2, Found),
266
 
            loop_v2c_rows(Fs, Addr);
267
 
        _ ->
268
 
            undefined
269
 
    end.
 
260
    Names = ets:lookup(snmp_community_cache, Vacm),
 
261
    loop_v2c_rows(lists:keysort(2, Names), Addr).
270
262
    
271
263
loop_v2c_rows([{_, {CommunityName, Tag}} | T], Addr) ->
 
264
    ?vtrace("loop_v2c_rows -> entry with"
 
265
            "~n   CommunityName: ~p"
 
266
            "~n   Tag:           ~p", [CommunityName, Tag]),
272
267
    {TDomain, TAddr} = Addr,
273
268
    case snmp_target_mib:is_valid_tag(Tag, TDomain, TAddr) of
274
269
        true ->
 
270
            ?vdebug("loop_v2c_rows -> "
 
271
                    "~p valid tag for community name ~p", 
 
272
                    [Tag, CommunityName]),
275
273
            {ok, CommunityName};
276
274
        false ->
277
275
            loop_v2c_rows(T, Addr)