#!/bin/sh # This is `snmp2.08' (part 8 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/apps/snmpget.c' is being continued... # touch -am 1231235999 $$.touch >/dev/null 2>&1 if test ! -f 1231235999 && test -f $$.touch; then shar_touch=touch else shar_touch=: echo echo 'WARNING: not restoring timestamps. Consider getting and' echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 1231235999 $$.touch # if test ! -r _sharseq.tmp; then echo 'Please unpack part 1 first!' exit 1 fi shar_sequence=`cat _sharseq.tmp` if test "$shar_sequence" != 8; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/apps/snmpget.c' else echo 'x - continuing file snmp2/apps/snmpget.c' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/apps/snmpget.c' && #include "party.h" #include "context.h" #include "view.h" #include "acl.h" X extern int errno; #ifdef VXWORKS static #endif int snmp_dump_packet = 0; X #ifdef VXWORKS static #endif usage(){ X fprintf(stderr, "Usage: snmpget -v 1 hostname community objectID [objectID]* or:\n"); X fprintf(stderr, "Usage: snmpget [-v 2 ] hostname noAuth objectID [objectID]* or:\n"); X fprintf(stderr, "Usage: snmpget [-v 2 ] hostname srcParty dstParty context objectID [objectID]*\n"); } X #ifdef VXWORKS snmpget #else /* VXWORKS */ main #endif X (argc, argv) int argc; char *argv []; X { X struct snmp_session session, *ss; X struct snmp_pdu *pdu, *response; X struct variable_list *vars; X int arg; X char *hostname = NULL; X char *community = NULL; X int timeout_flag = 0, timeout, retransmission_flag = 0, retransmission; X int count, current_name = 0; X char *names[128]; X oid name[MAX_NAME_LEN]; X int name_length; X int status; X int version = 2; X int port_flag = 0; X int dest_port = 0; X u_long srcclock, dstclock; X int clock_flag = 0; X oid src[MAX_NAME_LEN], dst[MAX_NAME_LEN], context[MAX_NAME_LEN]; X int srclen = 0, dstlen = 0, contextlen = 0; X struct partyEntry *pp; X struct contextEntry *cxp; X int trivialSNMPv2 = FALSE; X struct hostent *hp; X u_long destAddr; X X X X init_mib(); X for(arg = 1; arg < argc; arg++){ X if (argv[arg][0] == '-'){ X switch(argv[arg][1]){ X case 'd': X snmp_dump_packet++; X break; X case 'p': X port_flag++; X dest_port = atoi(argv[++arg]); X break; X case 't': X timeout_flag++; X timeout = atoi(argv[++arg]) * 1000000L; X break; X case 'r': X retransmission_flag++; X retransmission = atoi(argv[++arg]); X break; X case 'c': X clock_flag++; X srcclock = atoi(argv[++arg]); X dstclock = atoi(argv[++arg]); X break; X case 'v': X version = atoi(argv[++arg]); X if (version < 1 || version > 2){ X fprintf(stderr, "Invalid version\n"); X usage(); X exit(1); X } X break; X default: X printf("invalid option: -%c\n", argv[arg][1]); X break; X } X continue; X } X if (hostname == NULL){ X hostname = argv[arg]; X } else if (version == 1 && community == NULL){ X community = argv[arg]; X } else if (version == 2 && srclen == 0 && !trivialSNMPv2){ X if (read_party_database("/etc/party.conf") > 0){ X fprintf(stderr, X "Couldn't read party database from /etc/party.conf\n"); X exit(0); X } X if (read_context_database("/etc/context.conf") > 0){ X fprintf(stderr, X "Couldn't read context database from /etc/context.conf\n"); X exit(0); X } X if (read_acl_database("/etc/acl.conf") > 0){ X fprintf(stderr, X "Couldn't read access control database from /etc/acl.conf\n"); X exit(0); X } X if (!strcasecmp(argv[arg], "noauth")){ X trivialSNMPv2 = TRUE; X } else { X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X srclen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, src, srclen * sizeof(oid)); X break; X } X } X if (!pp){ X srclen = MAX_NAME_LEN; X if (!read_objid(argv[arg], src, &srclen)){ X printf("Invalid source party: %s\n", argv[arg]); X srclen = 0; X usage(); X exit(1); X } X } X } X } else if (version == 2 && dstlen == 0 && !trivialSNMPv2){ X dstlen = MAX_NAME_LEN; X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X dstlen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, dst, dstlen * sizeof(oid)); X break; X } X } X if (!pp){ X if (!read_objid(argv[arg], dst, &dstlen)){ X printf("Invalid destination party: %s\n", argv[arg]); X dstlen = 0; X usage(); X exit(1); X } X } X } else if (version == 2 && contextlen == 0 && !trivialSNMPv2){ X contextlen = MAX_NAME_LEN; X context_scanInit(); X for(cxp = context_scanNext(); cxp; cxp = context_scanNext()){ X if (!strcasecmp(cxp->contextName, argv[arg])){ X contextlen = cxp->contextIdentityLen; X bcopy(cxp->contextIdentity, context, X contextlen * sizeof(oid)); X break; X } X } X if (!cxp){ X if (!read_objid(argv[arg], context, &contextlen)){ X printf("Invalid context: %s\n", argv[arg]); X contextlen = 0; X usage(); X exit(1); X } X } X } else { X names[current_name++] = argv[arg]; X } X } X X if (!hostname || current_name <= 0 || (version < 1) || (version > 2) X || (version == 1 && !community) X || (version == 2 && (!srclen || !dstlen || !contextlen) X && !trivialSNMPv2)){ X usage(); X exit(1); X } X X if (trivialSNMPv2){ X if ((destAddr = inet_addr(hostname)) == -1){ X hp = gethostbyname(hostname); X if (hp == NULL){ X fprintf(stderr, "unknown host: %s\n", hostname); X exit(1); X } else { X bcopy((char *)hp->h_addr, (char *)&destAddr, X hp->h_length); X } X } X srclen = dstlen = contextlen = MAX_NAME_LEN; X ms_party_init(destAddr, src, &srclen, dst, &dstlen, X context, &contextlen); X } X X if (clock_flag){ X pp = party_getEntry(src, srclen); X if (pp){ X pp->partyAuthClock = srcclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X pp = party_getEntry(dst, dstlen); X if (pp){ X pp->partyAuthClock = dstclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X } X X bzero((char *)&session, sizeof(struct snmp_session)); X session.peername = hostname; X if (port_flag) X session.remote_port = dest_port; X X if (version == 1){ X session.version = SNMP_VERSION_1; X session.community = (u_char *)community; X session.community_len = strlen((char *)community); X } else if (version == 2){ X session.version = SNMP_VERSION_2; X session.srcParty = src; X session.srcPartyLen = srclen; X session.dstParty = dst; X session.dstPartyLen = dstlen; X session.context = context; X session.contextLen = contextlen; X } X if (retransmission_flag) X session.retries = retransmission; X else X session.retries = SNMP_DEFAULT_RETRIES; X if (timeout_flag) X session.timeout = timeout; X else X session.timeout = SNMP_DEFAULT_TIMEOUT; X X session.authenticator = NULL; X snmp_synch_setup(&session); X ss = snmp_open(&session); X if (ss == NULL){ X printf("Couldn't open snmp\n"); X exit(-1); X } X X pdu = snmp_pdu_create(GET_REQ_MSG); X X for(count = 0; count < current_name; count++){ X name_length = MAX_NAME_LEN; X if (!read_objid(names[count], name, &name_length)){ X printf("Invalid object identifier: %s\n", names[count]); X } X X snmp_add_null_var(pdu, name, name_length); X } X retry: X status = snmp_synch_response(ss, pdu, &response); X if (status == STAT_SUCCESS){ X if (response->errstat == SNMP_ERR_NOERROR){ X for(vars = response->variables; vars; vars = vars->next_variable) X print_variable(vars->name, vars->name_length, vars); X } else { X printf("Error in packet.\nReason: %s\n", snmp_errstring(response->errstat)); X if (response->errstat == SNMP_ERR_NOSUCHNAME){ X printf("This name doesn't exist: "); X for(count = 1, vars = response->variables; vars && count != response->errindex; X vars = vars->next_variable, count++) X ; X if (vars) X print_objid(vars->name, vars->name_length); X printf("\n"); X } X if ((pdu = snmp_fix_pdu(response, GET_REQ_MSG)) != NULL) X goto retry; X } X X } else if (status == STAT_TIMEOUT){ X printf("No Response from %s\n", hostname); X } else { /* status == STAT_ERROR */ X printf("An error occurred, Quitting\n"); X } X X if (response) X snmp_free_pdu(response); X snmp_close(ss); } X SHAR_EOF echo 'File snmp2/apps/snmpget.c is complete' && $shar_touch -am 1015123593 'snmp2/apps/snmpget.c' && chmod 0644 'snmp2/apps/snmpget.c' || echo 'restore of snmp2/apps/snmpget.c failed' shar_count="`wc -c < 'snmp2/apps/snmpget.c'`" test 10154 -eq "$shar_count" || echo "snmp2/apps/snmpget.c: original size 10154, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/snmpbulkwalk.c ============== if test -f 'snmp2/apps/snmpbulkwalk.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/snmpbulkwalk.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/snmpbulkwalk.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/snmpbulkwalk.c' && /* X * snmpbulkwalk.c - send SNMPv2 Bulk requests to a network entity, walking a X * subtree. X * X */ /********************************************************************* X Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University X X All Rights Reserved X Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of CMU not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. X CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ #include #include X #ifdef VXWORKS #include "VXtime.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include X #ifdef VXWORKS #include "VXnetdb.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include "snmp.h" #include "asn1.h" #include "snmp_impl.h" #include "snmp_api.h" #include "snmp_client.h" #include "party.h" #include "context.h" #include "view.h" #include "acl.h" X #ifdef VXWORKS static #endif oid objid_mib[] = {1, 3, 6, 1, 2, 1}; X #ifdef VXWORKS static #endif int snmp_dump_packet = 0; X X #ifdef VXWORKS static #endif usage(){ X fprintf(stderr, "Usage: snmpbulkwalk -v 1 hostname community [objectID] or:\n"); X fprintf(stderr, "Usage: snmpbulkwalk [-v 2 ] hostname noAuth [objectID] or:\n"); X fprintf(stderr, "Usage: snmpbulkwalk [-v 2 ] hostname srcParty dstParty context [objectID]\n"); } X #ifdef VXWORKS snmpbulkwalk #else /* VXWORKS */ main #endif X (argc, argv) int argc; char *argv []; X { X struct snmp_session session, *ss; X struct snmp_pdu *pdu, *response; X struct variable_list *vars; X int arg; X char *hostname = NULL; X char *community = NULL; X int gotroot = 0, version = 2; X oid name[MAX_NAME_LEN]; X int name_length; X oid root[MAX_NAME_LEN]; X int rootlen, count; X int running; X int status; X int port_flag = 0; X int dest_port = 0; X oid src[MAX_NAME_LEN], dst[MAX_NAME_LEN], context[MAX_NAME_LEN]; X int srclen = 0, dstlen = 0, contextlen = 0; X u_long srcclock, dstclock; X int clock_flag = 0; X struct partyEntry *pp; X struct contextEntry *cxp; X int reps = 1000; X int trivialSNMPv2 = FALSE; X struct hostent *hp; X u_long destAddr; X X init_mib(); X for(arg = 1; arg < argc; arg++){ X if (argv[arg][0] == '-'){ X switch(argv[arg][1]){ X case 'd': X snmp_dump_packet++; X break; X case 'r': X reps = atoi(argv[++arg]); X break; X case 'p': X port_flag++; X dest_port = atoi(argv[++arg]); X break; X case 'c': X clock_flag++; X srcclock = atoi(argv[++arg]); X dstclock = atoi(argv[++arg]); X break; X case 'v': X version = atoi(argv[++arg]); X if (version < 1 || version > 2){ X fprintf(stderr, "Invalid version\n"); X usage(); X exit(1); X } X break; X default: X printf("invalid option: -%c\n", argv[arg][1]); X break; X } X continue; X } X if (hostname == NULL){ X hostname = argv[arg]; X } else if (version == 1 && community == NULL){ X community = argv[arg]; X } else if (version == 2 && srclen == 0 && !trivialSNMPv2){ X if (read_party_database("/etc/party.conf") > 0){ X fprintf(stderr, X "Couldn't read party database from /etc/party.conf\n"); X exit(0); X } X if (read_context_database("/etc/context.conf") > 0){ X fprintf(stderr, X "Couldn't read context database from /etc/context.conf\n"); X exit(0); X } X if (read_acl_database("/etc/acl.conf") > 0){ X fprintf(stderr, X "Couldn't read access control database from /etc/acl.conf\n"); X exit(0); X } X if (!strcasecmp(argv[arg], "noauth")){ X trivialSNMPv2 = TRUE; X } else { X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X srclen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, src, srclen * sizeof(oid)); X break; X } X } X if (!pp){ X srclen = MAX_NAME_LEN; X if (!read_objid(argv[arg], src, &srclen)){ X printf("Invalid source party: %s\n", argv[arg]); X srclen = 0; X usage(); X exit(1); X } X } X } X } else if (version == 2 && dstlen == 0 && !trivialSNMPv2){ X dstlen = MAX_NAME_LEN; X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X dstlen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, dst, dstlen * sizeof(oid)); X break; X } X } X if (!pp){ X if (!read_objid(argv[arg], dst, &dstlen)){ X printf("Invalid destination party: %s\n", argv[arg]); X dstlen = 0; X usage(); X exit(1); X } X } X } else if (version == 2 && contextlen == 0 && !trivialSNMPv2){ X contextlen = MAX_NAME_LEN; X context_scanInit(); X for(cxp = context_scanNext(); cxp; cxp = context_scanNext()){ X if (!strcasecmp(cxp->contextName, argv[arg])){ X contextlen = cxp->contextIdentityLen; X bcopy(cxp->contextIdentity, context, X contextlen * sizeof(oid)); X break; X } X } X if (!cxp){ X if (!read_objid(argv[arg], context, &contextlen)){ X printf("Invalid context: %s\n", argv[arg]); X contextlen = 0; X usage(); X exit(1); X } X } X } else { X rootlen = MAX_NAME_LEN; X if (read_objid(argv[arg], root, &rootlen)){ X gotroot = 1; X } else { X printf("Invalid object identifier: %s\n", argv[arg]); X } X } X } X X if (gotroot == 0){ X bcopy((char *)objid_mib, (char *)root, sizeof(objid_mib)); X rootlen = sizeof(objid_mib) / sizeof(oid); X gotroot = 1; X } X X if (!hostname || (version < 1) || (version > 2) X || (version == 1 && !community) X || (version == 2 && (!srclen || !dstlen || !contextlen) X && !trivialSNMPv2)){ X usage(); X exit(1); X } X X if (trivialSNMPv2){ X if ((destAddr = inet_addr(hostname)) == -1){ X hp = gethostbyname(hostname); X if (hp == NULL){ X fprintf(stderr, "unknown host: %s\n", hostname); X exit(1); X } else { X bcopy((char *)hp->h_addr, (char *)&destAddr, X hp->h_length); X } X } X srclen = dstlen = contextlen = MAX_NAME_LEN; X ms_party_init(destAddr, src, &srclen, dst, &dstlen, X context, &contextlen); X } X X if (clock_flag){ X pp = party_getEntry(src, srclen); X if (pp){ X pp->partyAuthClock = srcclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X pp = party_getEntry(dst, dstlen); X if (pp){ X pp->partyAuthClock = dstclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X } X X bzero((char *)&session, sizeof(struct snmp_session)); X session.peername = hostname; X if (port_flag) X session.remote_port = dest_port; X if (version == 1){ X session.version = SNMP_VERSION_1; X session.community = (u_char *)community; X session.community_len = strlen((char *)community); X } else if (version == 2){ X session.version = SNMP_VERSION_2; X session.srcParty = src; X session.srcPartyLen = srclen; X session.dstParty = dst; X session.dstPartyLen = dstlen; X session.context = context; X session.contextLen = contextlen; X } X session.retries = SNMP_DEFAULT_RETRIES; X session.timeout = 2000000L; X session.authenticator = NULL; X snmp_synch_setup(&session); X ss = snmp_open(&session); X if (ss == NULL){ X printf("Couldn't open snmp\n"); X exit(-1); X } X X X bcopy((char *)root, (char *)name, rootlen * sizeof(oid)); X name_length = rootlen; X X running = 1; X while(running){ X running = 1; X pdu = snmp_pdu_create(BULK_REQ_MSG); X pdu->non_repeaters = 0; X pdu->max_repetitions = reps; /* fill the packet */ X X snmp_add_null_var(pdu, name, name_length); X X status = snmp_synch_response(ss, pdu, &response); X if (status == STAT_SUCCESS){ X if (response->errstat == SNMP_ERR_NOERROR){ X for(vars = response->variables; vars; X vars = vars->next_variable){ X if (vars->name_length < rootlen X || bcmp(root, vars->name, rootlen * sizeof(oid))){ X running = 0; X continue; /* not part of this subtree */ X } X print_variable(vars->name, vars->name_length, vars); X if (vars->type == SNMP_ENDOFMIBVIEW X || vars->type == SNMP_NOSUCHOBJECT /* for robustness */ X || vars->type == SNMP_NOSUCHINSTANCE){ X running = 0; /* restart so we can get next variable */ X } X if (!vars->next_variable){ /* repeat on last variable */ X bcopy((char *)vars->name, (char *)name, X vars->name_length * sizeof(oid)); X name_length = vars->name_length; X } X } X } else { X running = 0; X if (response->errstat == SNMP_ERR_NOSUCHNAME){ X printf("End of MIB.\n"); X } else { X printf("Error in packet.\nReason: %s\n", X snmp_errstring(response->errstat)); X if (response->errstat == SNMP_ERR_NOSUCHNAME){ X printf("The request for this object identifier failed: "); X for(count = 1, vars = response->variables; vars X && count != response->errindex; X vars = vars->next_variable, count++) X /*EMPTY*/; X if (vars) X print_objid(vars->name, vars->name_length); X printf("\n"); X } X } X } X X } else if (status == STAT_TIMEOUT){ X printf("No Response from %s\n", hostname); X running = 0; X } else { /* status == STAT_ERROR */ X printf("An error occurred, Quitting\n"); X running = 0; X } X X if (response) X snmp_free_pdu(response); X } X snmp_close(ss); } SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/snmpbulkwalk.c' && chmod 0644 'snmp2/apps/snmpbulkwalk.c' || echo 'restore of snmp2/apps/snmpbulkwalk.c failed' shar_count="`wc -c < 'snmp2/apps/snmpbulkwalk.c'`" test 10443 -eq "$shar_count" || echo "snmp2/apps/snmpbulkwalk.c: original size 10443, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/snmptest.c ============== if test -f 'snmp2/apps/snmptest.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/snmptest.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/snmptest.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/snmptest.c' && /* X * snmptest.c - send snmp requests to a network entity. X * X */ /*********************************************************************** X Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University X X All Rights Reserved X Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of CMU not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. X CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include #include X #ifdef VXWORKS #include "VXtime.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include #include X #ifdef VXWORKS #include "VXnetdb.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include X #include "snmp.h" #include "asn1.h" #include "snmp_impl.h" #include "snmp_api.h" #include "snmp_client.h" #include "party.h" #include "context.h" #include "view.h" #include "acl.h" X extern int errno; #ifdef VXWORKS static #endif int command = GET_REQ_MSG; #ifdef VXWORKS static #endif int snmp_dump_packet = 0; X X #ifdef VXWORKS static #endif usage(){ X fprintf(stderr, "Usage: snmptest -v 1 hostname community or:\n"); X fprintf(stderr, "Usage: snmptest [-v 2 ] hostname noAuth or:\n"); X fprintf(stderr, "Usage: snmptest [-v 2 ] hostname srcParty dstParty context\n"); } X #ifdef VXWORKS snmptest #else /* VXWORKS */ main #endif X (argc, argv) int argc; char *argv []; X X { X struct snmp_session session, *ss; X struct snmp_pdu *pdu, *response, *copy = NULL; X struct variable_list *vars, *vp; X int arg, ret, version = 2; X char *hostname = NULL; X char *community = NULL; X int port_flag = 0; X int dest_port = 0; X oid src[MAX_NAME_LEN], dst[MAX_NAME_LEN], context[MAX_NAME_LEN]; X int srclen = 0, dstlen = 0, contextlen = 0; X u_long srcclock, dstclock; X int clock_flag = 0; X struct partyEntry *pp; X struct contextEntry *cxp; X int status, count; X char input[128]; X int varcount, nonRepeaters = -1, maxRepetitions; X int timeout_flag = 0, timeout, retransmission_flag = 0, retransmission; X int trivialSNMPv2 = FALSE; X struct hostent *hp; X u_long destAddr; X X init_mib(); X /* Usage: snmptest -v 1 hostname community [objectID] or: X * Usage: snmptest [-v 2 ] hostname noAuth [objectID] or: X * Usage: snmptest [-v 2 ] hostname srcParty dstParty context [objectID] X */ X for(arg = 1; arg < argc; arg++){ X if (argv[arg][0] == '-'){ X switch(argv[arg][1]){ X case 'd': X snmp_dump_packet++; X break; X case 'p': X port_flag++; X dest_port = atoi(argv[++arg]); X break; X case 't': X timeout_flag++; X timeout = atoi(argv[++arg]) * 1000000L; X break; X case 'r': X retransmission_flag++; X retransmission = atoi(argv[++arg]); X break; X case 'c': X clock_flag++; X srcclock = atoi(argv[++arg]); X dstclock = atoi(argv[++arg]); X break; X case 'v': X version = atoi(argv[++arg]); X if (version < 1 || version > 2){ X fprintf(stderr, "Invalid version\n"); X usage(); X return(1); X } X break; X default: X fprintf(stderr, "invalid option: -%c\n", argv[arg][1]); X break; X } X continue; X } X if (hostname == NULL){ X hostname = argv[arg]; X } else if (version == 1 && community == NULL){ X community = argv[arg]; X } else if (version == 2 && srclen == 0 && !trivialSNMPv2) { X if (read_party_database("/etc/party.conf") > 0){ X fprintf(stderr, X "Couldn't read party database from /etc/party.conf\n"); X return(0); X } X if (read_context_database("/etc/context.conf") > 0){ X fprintf(stderr, X "Couldn't read context database from /etc/context.conf\n"); X return(0); X } X if (read_acl_database("/etc/acl.conf") > 0){ X fprintf(stderr, X "Couldn't read access control database from /etc/acl.conf\n"); X return(0); X } X if (!strcasecmp(argv[arg], "noauth")){ X trivialSNMPv2 = TRUE; X } else { X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X srclen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, src, srclen * sizeof(oid)); X break; X } X } X if (!pp){ X srclen = MAX_NAME_LEN; X if (!read_objid(argv[arg], src, &srclen)){ X printf("Invalid source party: %s\n", argv[arg]); X srclen = 0; X usage(); X return(1); X } X } X } X } else if (version == 2 && dstlen == 0 && !trivialSNMPv2){ X dstlen = MAX_NAME_LEN; X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X dstlen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, dst, dstlen * sizeof(oid)); X break; X } X } X if (!pp){ X if (!read_objid(argv[arg], dst, &dstlen)){ X printf("Invalid destination party: %s\n", argv[arg]); X dstlen = 0; X usage(); X return(1); X } X } X } else if (version == 2 && contextlen == 0 && !trivialSNMPv2){ X contextlen = MAX_NAME_LEN; X context_scanInit(); X for(cxp = context_scanNext(); cxp; cxp = context_scanNext()){ X if (!strcasecmp(cxp->contextName, argv[arg])){ X contextlen = cxp->contextIdentityLen; X bcopy(cxp->contextIdentity, context, X contextlen * sizeof(oid)); X break; X } X } X if (!cxp){ X if (!read_objid(argv[arg], context, &contextlen)){ X printf("Invalid context: %s\n", argv[arg]); X contextlen = 0; X usage(); X return(1); X } X } X } else { X usage(); X return(1); X } X } X if (version == 1 && community == NULL) X community = "public"; /* default to public */ X X if (!hostname || (version < 1) || (version > 2) X || (version == 1 && !community) X || (version == 2 && (!srclen || !dstlen || !contextlen) X && !trivialSNMPv2)){ X usage(); X return(1); X } X X if (trivialSNMPv2){ X if ((destAddr = inet_addr(hostname)) == -1){ X hp = gethostbyname(hostname); X if (hp == NULL){ X fprintf(stderr, "unknown host: %s\n", hostname); X return(1); X } else { X bcopy((char *)hp->h_addr, (char *)&destAddr, X hp->h_length); X } X } X srclen = dstlen = contextlen = MAX_NAME_LEN; X ms_party_init(destAddr, src, &srclen, dst, &dstlen, X context, &contextlen); X } X X if (clock_flag){ X pp = party_getEntry(src, srclen); X if (pp){ X pp->partyAuthClock = srcclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X pp = party_getEntry(dst, dstlen); X if (pp){ X pp->partyAuthClock = dstclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X } X X bzero((char *)&session, sizeof(struct snmp_session)); X session.peername = hostname; X if (port_flag) X session.remote_port = dest_port; X if (version == 1){ X session.version = SNMP_VERSION_1; X session.community = (u_char *)community; X session.community_len = strlen((char *)community); X } else if (version == 2){ X session.version = SNMP_VERSION_2; X session.srcParty = src; X session.srcPartyLen = srclen; X session.dstParty = dst; X session.dstPartyLen = dstlen; X session.context = context; X session.contextLen = contextlen; X } X if (retransmission_flag) X session.retries = retransmission; X else X session.retries = SNMP_DEFAULT_RETRIES; X if (timeout_flag) X session.timeout = timeout; X else X session.timeout = SNMP_DEFAULT_TIMEOUT; X session.authenticator = NULL; X snmp_synch_setup(&session); X ss = snmp_open(&session); X if (ss == NULL){ X fprintf(stderr, "Couldn't open snmp\n"); X return(-1); X } X X varcount = 0; X while(1){ X vars = NULL; X for(ret = 1; ret != 0;){ X vp = (struct variable_list *)malloc(sizeof(struct variable_list)); X vp->next_variable = NULL; X vp->name = NULL; X vp->val.string = NULL; X X while((ret = input_variable(vp)) == -1) X ; X if (ret == 1){ X varcount++; X /* add it to the list */ X if (vars == NULL){ X /* if first variable */ X pdu = snmp_pdu_create(command); X pdu->variables = vp; X } else { X vars->next_variable = vp; X } X vars = vp; X } else { X /* free the last (unused) variable */ X if (vp->name) X free((char *)vp->name); X if (vp->val.string) X free((char *)vp->val.string); X free((char *)vp); X X if (command == BULK_REQ_MSG){ X if (nonRepeaters == -1){ X nonRepeaters = varcount; X ret = -1; /* so we collect more variables */ X printf("Now input the repeating variables\n"); X } else { X printf("What repeat count? "); X fflush(stdout); X gets(input); X maxRepetitions = atoi(input); X pdu->non_repeaters = nonRepeaters; X pdu->max_repetitions = maxRepetitions; X } X } X } X if (varcount == 0 && ret == 0){ X if (!copy){ X printf("No PDU to send.\n"); X ret = -1; X } else { X pdu = snmp_clone_pdu(copy); X printf("Resending last PDU.\n"); X } X } X } X copy = snmp_clone_pdu(pdu); X if (command == TRP2_REQ_MSG){ X /* No response needed */ X if (!snmp_send(ss, pdu)){ X printf("Couldn't send SNMPv2 trap.\n"); X } X } else { X status = snmp_synch_response(ss, pdu, &response); X if (status == STAT_SUCCESS){ X if (command == INFORM_REQ_MSG && X response->errstat == SNMP_ERR_NOERROR){ X printf("Inform Acknowledged\n"); X } else { X switch(response->command){ X case GET_REQ_MSG: X printf("Received Get Request "); X break; X case GETNEXT_REQ_MSG: X printf("Received Getnext Request "); X break; X case GET_RSP_MSG: X printf("Received Get Response "); X break; X case SET_REQ_MSG: X printf("Received Set Request "); X break; X case TRP_REQ_MSG: X printf("Received Trap Request "); X break; X case BULK_REQ_MSG: X printf("Received Bulk Request "); X break; X case INFORM_REQ_MSG: X printf("Received Inform Request "); X break; X case TRP2_REQ_MSG: X printf("Received SNMPv2 Trap Request "); X break; X } X printf("from %s\n", inet_ntoa(response->address.sin_addr)); X printf("requestid 0x%X errstat 0x%X errindex 0x%X\n", X response->reqid, response->errstat, X response->errindex); X if (response->errstat == SNMP_ERR_NOERROR){ X for(vars = response->variables; vars; X vars = vars->next_variable) X print_variable(vars->name, vars->name_length, X vars); X } else { X fprintf(stderr, "Error in packet.\nReason: %s\n", X snmp_errstring(response->errstat)); X if (response->errstat == SNMP_ERR_NOSUCHNAME){ X for(count = 1, vars = response->variables; X vars && count != response->errindex; X vars = vars->next_variable, count++) X ; X if (vars){ X printf("This name doesn't exist: "); X print_objid(vars->name, vars->name_length); X } X printf("\n"); X } X } X } X } else if (status == STAT_TIMEOUT){ X fprintf(stderr, "No Response from %s\n", hostname); X } else { /* status == STAT_ERROR */ X fprintf(stderr, "An error occurred, Quitting\n"); X } X X if (response) X snmp_free_pdu(response); X } X varcount = 0; X nonRepeaters = -1; X } } X int ascii_to_binary(cp, bufp) X u_char *cp; X u_char *bufp; { X int subidentifier; X u_char *bp = bufp; X X for(; *cp != '\0'; cp++){ X if (isspace(*cp)) X continue; X if (!isdigit(*cp)){ X fprintf(stderr, "Input error\n"); X return -1; X } X subidentifier = atoi(cp); X if (subidentifier > 255){ X fprintf(stderr, "subidentifier %d is too large ( > 255)\n", X subidentifier); X return -1; X } X *bp++ = (u_char)subidentifier; X while(isdigit(*cp)) X cp++; X cp--; X } X return bp - bufp; } X X int hex_to_binary(cp, bufp) X u_char *cp; X u_char *bufp; { X int subidentifier; X u_char *bp = bufp; X X for(; *cp != '\0'; cp++){ X if (isspace(*cp)) X continue; X if (!isxdigit(*cp)){ X fprintf(stderr, "Input error\n"); X return -1; X } X sscanf(cp, "%x", &subidentifier); X if (subidentifier > 255){ X fprintf(stderr, "subidentifier %d is too large ( > 255)\n", X subidentifier); X return -1; X } X *bp++ = (u_char)subidentifier; X while(isxdigit(*cp)) X cp++; X cp--; X } X return bp - bufp; } X X input_variable(vp) X struct variable_list *vp; { X char buf[256]; X u_char value[256], ch; X oid name[MAX_NAME_LEN]; X X printf("Variable: "); X fflush(stdout); X gets(buf); X X if (*buf == 0){ X vp->name_length = 0; X return 0; X } X if (*buf == '$'){ X switch(buf[1]){ X case 'G': X command = GET_REQ_MSG; X printf("Request type is Get Request\n"); X break; X case 'N': X command = GETNEXT_REQ_MSG; X printf("Request type is Getnext Request\n"); X break; X case 'S': X command = SET_REQ_MSG; X printf("Request type is Set Request\n"); X break; X case 'B': X command = BULK_REQ_MSG; X printf("Request type is Bulk Request\n"); X printf("Enter a blank line to terminate the list of non-repeaters\n"); X printf("and to begin the repeating variables\n"); X break; X case 'I': X command = INFORM_REQ_MSG; X printf("Request type is Inform Request\n"); X printf("(Are you sending to the right port?)\n"); X break; X case 'T': X command = TRP2_REQ_MSG; X printf("Request type is SNMPv2 Trap Request\n"); X printf("(Are you sending to the right port?)\n"); X break; X case 'D': X if (snmp_dump_packet){ X snmp_dump_packet = 0; X printf("Turned packet dump off\n"); X } else { X snmp_dump_packet = 1; X printf("Turned packet dump on\n"); X } X break; X case 'Q': X printf("Quitting, Goodbye\n"); #ifdef VXWORKS X taskDelete(taskIdSelf()); #else /* VXWORKS */ X exit(0); #endif /* VXWORKS */ X break; X default: X fprintf(stderr, "Bad command\n"); X } X return -1; X } X vp->name_length = MAX_NAME_LEN; X if (!read_objid(buf, name, &vp->name_length)) X return -1; X vp->name = (oid *)malloc(vp->name_length * sizeof(oid)); X bcopy((char *)name, (char *)vp->name, vp->name_length * sizeof(oid)); X X if (command == SET_REQ_MSG || command == INFORM_REQ_MSG X || command == TRP2_REQ_MSG){ X printf("Type [i|s|x|d|n|o|t|a]: "); X fflush(stdout); X gets(buf); X ch = *buf; X switch(ch){ X case 'i': X vp->type = INTEGER; X break; X case 's': X vp->type = STRING; X break; X case 'x': X vp->type = STRING; X break; X case 'd': X vp->type = STRING; X break; X case 'n': X vp->type = NULLOBJ; X break; X case 'o': X vp->type = OBJID; X break; X case 't': X vp->type = TIMETICKS; X break; X case 'a': X vp->type = IPADDRESS; X break; X default: X fprintf(stderr, "bad type \"%c\", use \"i\", \"s\", \"x\", \"d\", \"n\", \"o\", \"t\", or \"a\".\n", *buf); X return -1; X } X printf("Value: "); fflush(stdout); X gets(buf); X switch(vp->type){ X case INTEGER: X vp->val.integer = (long *)malloc(sizeof(long)); X *(vp->val.integer) = atoi(buf); X vp->val_len = sizeof(long); X break; X case STRING: X if (ch == 'd'){ X vp->val_len = ascii_to_binary((u_char *)buf, value); X } else if (ch == 's'){ X strcpy(value, buf); X vp->val_len = strlen(buf); X } else if (ch == 'x'){ X vp->val_len = hex_to_binary((u_char *)buf, value); X } X vp->val.string = (u_char *)malloc(vp->val_len); X bcopy((char *)value, (char *)vp->val.string, vp->val_len); X break; X case NULLOBJ: X vp->val_len = 0; X vp->val.string = NULL; X break; X case OBJID: X vp->val_len = MAX_NAME_LEN;; X read_objid(buf, (oid *)value, &vp->val_len); X vp->val_len *= sizeof(oid); X vp->val.objid = (oid *)malloc(vp->val_len); X bcopy((char *)value, (char *)vp->val.objid, vp->val_len); X break; X case TIMETICKS: X vp->val.integer = (long *)malloc(sizeof(long)); X *(vp->val.integer) = atoi(buf); X vp->val_len = sizeof(long); X break; X case IPADDRESS: X vp->val.integer = (long *)malloc(sizeof(long)); X *(vp->val.integer) = inet_addr(buf); X vp->val_len = sizeof(long); X break; X default: X fprintf(stderr, "Internal error\n"); X break; X } X } else { /* some form of get message */ X vp->type = NULLOBJ; X vp->val_len = 0; X } X return 1; } X SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/snmptest.c' && chmod 0644 'snmp2/apps/snmptest.c' || echo 'restore of snmp2/apps/snmptest.c failed' shar_count="`wc -c < 'snmp2/apps/snmptest.c'`" test 17608 -eq "$shar_count" || echo "snmp2/apps/snmptest.c: original size 17608, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/snmpwalk.c ============== if test -f 'snmp2/apps/snmpwalk.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/snmpwalk.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/snmpwalk.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/snmpwalk.c' && /* X * snmpwalk.c - send snmp GETNEXT requests to a network entity, walking a X * subtree. X * X */ /********************************************************************** X Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University X X All Rights Reserved X Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of CMU not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. X CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include #include X #ifdef VXWORKS #include "VXtime.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include #ifdef VXWORKS #include "VXnetdb.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include "snmp.h" #include "asn1.h" #include "snmp_impl.h" #include "snmp_api.h" #include "snmp_client.h" #include "party.h" #include "context.h" #include "view.h" #include "acl.h" X #ifdef VXWORKS static #endif oid objid_mib[] = {1, 3, 6, 1, 2, 1}; X #ifdef VXWORKS static #endif int snmp_dump_packet = 0; X #ifdef VXWORKS static #endif usage(){ X fprintf(stderr, "Usage: snmpwalk -v 1 hostname community [objectID] or:\n"); X fprintf(stderr, "Usage: snmpwalk [-v 2 ] hostname noAuth [objectID] or:\n"); X fprintf(stderr, "Usage: snmpwalk [-v 2 ] hostname srcParty dstParty context [objectID]\n"); } X #ifdef VXWORKS snmpwalk #else /* VXWORKS */ main #endif X (argc, argv) int argc; char *argv []; { X struct snmp_session session, *ss; X struct snmp_pdu *pdu, *response; X struct variable_list *vars; X int arg; X char *hostname = NULL; X char *community = NULL; X int gotroot = 0, version = 2; X oid name[MAX_NAME_LEN]; X int name_length; X oid root[MAX_NAME_LEN]; X int rootlen, count; X int running; X int status; X int port_flag = 0; X int dest_port = 0; X oid src[MAX_NAME_LEN], dst[MAX_NAME_LEN], context[MAX_NAME_LEN]; X int srclen = 0, dstlen = 0, contextlen = 0; X u_long srcclock, dstclock; X int clock_flag = 0; X struct partyEntry *pp; X struct contextEntry *cxp; X int trivialSNMPv2 = FALSE; X struct hostent *hp; X u_long destAddr; X X init_mib(); X /* X * Usage: snmpwalk -v 1 hostname community [objectID] or: X * Usage: snmpwalk [-v 2 ] hostname noAuth [objectID] or: X * Usage: snmpwalk [-v 2 ] hostname srcParty dstParty context [objectID] X */ X for(arg = 1; arg < argc; arg++){ X if (argv[arg][0] == '-'){ X switch(argv[arg][1]){ X case 'd': X snmp_dump_packet++; X break; X case 'p': X port_flag++; X dest_port = atoi(argv[++arg]); X break; X case 'c': X clock_flag++; X srcclock = atoi(argv[++arg]); X dstclock = atoi(argv[++arg]); X break; X case 'v': X version = atoi(argv[++arg]); X if (version < 1 || version > 2){ X fprintf(stderr, "Invalid version: %d\n", version); X usage(); X exit(1); X } X break; X default: X printf("invalid option: -%c\n", argv[arg][1]); X break; X } X continue; X } X if (hostname == NULL){ X hostname = argv[arg]; X } else if (version == 1 && community == NULL){ X community = argv[arg]; X } else if (version == 2 && srclen == 0 && !trivialSNMPv2){ X if (read_party_database("/etc/party.conf") > 0){ X fprintf(stderr, X "Couldn't read party database from /etc/party.conf\n"); X exit(0); X } X if (read_context_database("/etc/context.conf") > 0){ X fprintf(stderr, X "Couldn't read context database from /etc/context.conf\n"); X exit(0); X } X if (read_acl_database("/etc/acl.conf") > 0){ X fprintf(stderr, X "Couldn't read access control database from /etc/acl.conf\n"); X exit(0); X } X X if (!strcasecmp(argv[arg], "noauth")){ X trivialSNMPv2 = TRUE; X } else { X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X srclen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, src, srclen * sizeof(oid)); X break; X } X } X if (!pp){ X srclen = MAX_NAME_LEN; X if (!read_objid(argv[arg], src, &srclen)){ X printf("Invalid source party: %s\n", argv[arg]); X srclen = 0; X usage(); X exit(1); X } X } X } X } else if (version == 2 && dstlen == 0 && !trivialSNMPv2){ X dstlen = MAX_NAME_LEN; X party_scanInit(); X for(pp = party_scanNext(); pp; pp = party_scanNext()){ X if (!strcasecmp(pp->partyName, argv[arg])){ X dstlen = pp->partyIdentityLen; X bcopy(pp->partyIdentity, dst, dstlen * sizeof(oid)); X break; X } X } X if (!pp){ X if (!read_objid(argv[arg], dst, &dstlen)){ X printf("Invalid destination party: %s\n", argv[arg]); X dstlen = 0; X usage(); X exit(1); X } X } X } else if (version == 2 && contextlen == 0 && !trivialSNMPv2){ X contextlen = MAX_NAME_LEN; X context_scanInit(); X for(cxp = context_scanNext(); cxp; cxp = context_scanNext()){ X if (!strcasecmp(cxp->contextName, argv[arg])){ X contextlen = cxp->contextIdentityLen; X bcopy(cxp->contextIdentity, context, X contextlen * sizeof(oid)); X break; X } X } X if (!cxp){ X if (!read_objid(argv[arg], context, &contextlen)){ X printf("Invalid context: %s\n", argv[arg]); X contextlen = 0; X usage(); X exit(1); X } X } X } else { X rootlen = MAX_NAME_LEN; X if (read_objid(argv[arg], root, &rootlen)){ X gotroot = 1; X } else { X printf("Invalid object identifier: %s\n", argv[arg]); X } X } X } X X if (gotroot == 0){ X bcopy((char *)objid_mib, (char *)root, sizeof(objid_mib)); X rootlen = sizeof(objid_mib) / sizeof(oid); X gotroot = 1; X } X X if (!hostname || (version < 1) || (version > 2) X || (version == 1 && !community) X || (version == 2 && (!srclen || !dstlen || !contextlen) X && !trivialSNMPv2)){ X usage(); X exit(1); X } X X if (trivialSNMPv2){ X if ((destAddr = inet_addr(hostname)) == -1){ X hp = gethostbyname(hostname); X if (hp == NULL){ X fprintf(stderr, "unknown host: %s\n", hostname); X exit(1); X } else { X bcopy((char *)hp->h_addr, (char *)&destAddr, X hp->h_length); X } X } X srclen = dstlen = contextlen = MAX_NAME_LEN; X ms_party_init(destAddr, src, &srclen, dst, &dstlen, X context, &contextlen); X } X X if (clock_flag){ X pp = party_getEntry(src, srclen); X if (pp){ X pp->partyAuthClock = srcclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X pp = party_getEntry(dst, dstlen); X if (pp){ X pp->partyAuthClock = dstclock; X gettimeofday(&pp->tv, (struct timezone *)0); X pp->tv.tv_sec -= pp->partyAuthClock; X } X } X X bzero((char *)&session, sizeof(struct snmp_session)); SHAR_EOF : || echo 'restore of snmp2/apps/snmpwalk.c failed' fi echo 'End of snmp2 part 8' echo 'File snmp2/apps/snmpwalk.c is continued in part 9' echo 9 > _sharseq.tmp exit 0