#!/bin/sh # This is `snmp2.36' (part 36 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/agent/snmp_agent.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" != 36; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/agent/snmp_agent.c' else echo 'x - continuing file snmp2/agent/snmp_agent.c' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/agent/snmp_agent.c' && 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. ******************************************************************/ #ifdef VXWORKS #include #include "VXtime.h" #else #if defined(unix) #include #include #include #ifndef NULL #define NULL 0 #endif /* unix */ #endif /* NULL */ #endif /*VXWORKS */ X #include "snmp.h" #include "asn1.h" #include "snmp_impl.h" #include "acl.h" #include "party.h" #include "context.h" X #include "mib.h" X void snmp_trap(); int create_identical(); int parse_var_op_list(); int snmp_access(); X struct pbuf *definitelyGetBuf(); X #define NUM_COMMUNITIES 5 char *communities[NUM_COMMUNITIES] = { X "public", X "private", X "regional", X "proxy", X "core" }; X int snmp_agent_parse(data, length, out_data, out_length, sourceip) X register u_char *data; X int length; X register u_char *out_data; X int *out_length; X u_long sourceip; /* possibly for authentication */ { X struct packet_info packet, *pi = &packet; X u_char type; X long zero = 0; X long reqid, errstat, errindex, dummyindex; X register u_char *out_auth, *out_header, *out_reqid; X u_char *startData = data; X int startLength = length; X int header_shift, auth_shift; X int packet_len, len; X struct partyEntry *tmp; X oid tmpParty[64]; X int tmpPartyLen; X X len = length; X (void)asn_parse_header(data, &len, &type); X X if (type == (ASN_SEQUENCE | ASN_CONSTRUCTOR)){ X /* authenticates message and returns length if valid */ X pi->community_len = COMMUNITY_MAX_LEN; X data = snmp_auth_parse(data, &length, X pi->community, &pi->community_len, X &pi->version); X } else if (type == (ASN_CONTEXT | ASN_CONSTRUCTOR | 1)){ X pi->srcPartyLength = sizeof(pi->srcParty)/sizeof(oid); X pi->dstPartyLength = sizeof(pi->dstParty)/sizeof(oid); X pi->contextLength = sizeof(pi->context)/sizeof(oid); X X /* authenticates message and returns length if valid */ X data = snmp_secauth_parse(data, &length, pi, X pi->srcParty, &pi->srcPartyLength, X pi->dstParty, &pi->dstPartyLength, X pi->context, &pi->contextLength, X FIRST_PASS); X } else { X ERROR("unknown auth header type"); X return NULL; X } X X if (data == NULL){ X ERROR("bad authentication"); X /* send auth fail trap */ X return 0; X } X if (pi->version == SNMP_VERSION_1){ X pi->community_id = get_community(pi->community, pi->community_len); X if (pi->community_id == -1) X return NULL; X } else if (pi->version == SNMP_VERSION_2){ X pi->community_id = 0; X } else { X ERROR("Bad Version"); X return NULL; X } X data = asn_parse_header(data, &length, &pi->pdutype); X if (data == NULL){ X ERROR("bad header"); X return 0; X } X if (pi->pdutype != GET_REQ_MSG && pi->pdutype != GETNEXT_REQ_MSG X && pi->pdutype != SET_REQ_MSG && pi->pdutype != BULK_REQ_MSG){ X return 0; X } X X if (pi->version == SNMP_VERSION_2){ X /* X * Swap source and destination party pointers for building the reply X * packet. X */ X tmp = pi->srcp; X pi->srcp = pi->dstp; X pi->dstp = tmp; X } X #if 0 X /* these should really be swapped too, but this makes for problems X ** with the create_identical() routine, which expects them to not X ** be swapped. X */ X bcopy(pi->srcParty, tmpParty, pi->srcPartyLength); X tmpPartyLen = pi->srcPartyLength; X bcopy(pi->dstParty, pi->srcParty, pi->dstPartyLength); X pi->srcPartyLength = pi->dstPartyLength; X bcopy(tmpParty, pi->dstParty, tmpPartyLen); X pi->dstPartyLength = tmpPartyLen; #endif X /* X * Now create the auth_header for the output packet X * The final lengths are not known now, so they will have to be recomputed X * later. X */ X out_auth = out_data; X if (pi->version == SNMP_VERSION_1){ X out_header = snmp_auth_build(out_auth, out_length, X pi->community, &pi->community_len, X &pi->version, 0); X } else if (pi->version == SNMP_VERSION_2){ X out_header = snmp_secauth_build(out_auth, out_length, pi, 0, X pi->dstParty, pi->dstPartyLength, X pi->srcParty, pi->srcPartyLength, X pi->context, pi->contextLength, X &packet_len, FIRST_PASS); X } X if (out_header == NULL){ X ERROR("snmp_auth_build failed"); X return 0; X } X X if ((pi->version == SNMP_VERSION_2) X && !has_access(pi->pdutype, pi->dstp->partyIndex, X pi->srcp->partyIndex, pi->cxp->contextIndex)){ X /* Make sure not to send this response to GetResponse or X * Trap packets. Currently, code above has this handled. X */ X errstat = SNMP_ERR_READONLY; X if (pi->version == SNMP_VERSION_2){ X errstat = SNMP_ERR_AUTHORIZATIONERROR; X } X errindex = 0; X if (create_identical(startData, out_auth, startLength, errstat, X errindex, pi)){ X *out_length = pi->packet_end - out_auth; X return 1; X } X return 0; X } X data = asn_parse_int(data, &length, &type, &reqid, sizeof(reqid)); X if (data == NULL){ X ERROR("bad parse of reqid"); X return 0; X } X data = asn_parse_int(data, &length, &type, &errstat, sizeof(errstat)); X if (data == NULL){ X ERROR("bad parse of errstat"); X return 0; X } X data = asn_parse_int(data, &length, &type, &errindex, sizeof(errindex)); X if (data == NULL){ X ERROR("bad parse of errindex"); X return 0; X } X X /* create the requid, errstatus, errindex for the output packet */ X out_reqid = asn_build_sequence(out_header, out_length, X (u_char)GET_RSP_MSG, 0); X if (out_reqid == NULL){ X ERROR(""); X return 0; X } X X type = (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER); X /* return identical request id */ X out_data = asn_build_int(out_reqid, out_length, type, &reqid, X sizeof(reqid)); X if (out_data == NULL){ X ERROR("build reqid failed"); X return 0; X } X X /* assume that error status will be zero */ X out_data = asn_build_int(out_data, out_length, type, &zero, sizeof(zero)); X if (out_data == NULL){ X ERROR("build errstat failed"); X return 0; X } X X /* assume that error index will be zero */ X out_data = asn_build_int(out_data, out_length, type, &zero, sizeof(zero)); X if (out_data == NULL){ X ERROR("build errindex failed"); X return 0; X } X X if (pi->pdutype == BULK_REQ_MSG) X errstat = bulk_var_op_list(data, length, out_data, *out_length, X errstat, errindex, &errindex, pi); X else X errstat = parse_var_op_list(data, length, out_data, *out_length, X &errindex, pi, RESERVE1); X if (pi->pdutype == SET_REQ_MSG){ X if (errstat == SNMP_ERR_NOERROR) X errstat = parse_var_op_list(data, length, out_data, *out_length, X &errindex, pi, RESERVE2); X if (errstat == SNMP_ERR_NOERROR){ X /* X * SETS require 3-4 passes through the var_op_list. The first two X * passes verify that all types, lengths, and values are valid X * and may reserve resources and the third does the set and a X * fourth executes any actions. Then the identical GET RESPONSE X * packet is returned. X * If either of the first two passes returns an error, another X * pass is made so that any reserved resources can be freed. X */ X parse_var_op_list(data, length, out_data, *out_length, X &dummyindex, pi, COMMIT); X parse_var_op_list(data, length, out_data, *out_length, X &dummyindex, pi, ACTION); X if (create_identical(startData, out_auth, startLength, 0L, 0L, pi)){ X *out_length = pi->packet_end - out_auth; X return 1; X } X return 0; X } else { X parse_var_op_list(data, length, out_data, *out_length, X &dummyindex, pi, FREE); X } X } X switch((short)errstat){ X case SNMP_ERR_NOERROR: X /* re-encode the headers with the real lengths */ X *out_length = pi->packet_end - out_header; X out_data = asn_build_sequence(out_header, out_length, GET_RSP_MSG, X pi->packet_end - out_reqid); X if (out_data != out_reqid){ X ERROR("internal error: header"); X return 0; X } X X *out_length = pi->packet_end - out_auth; X if (pi->version == SNMP_VERSION_1){ X out_data = snmp_auth_build(out_auth, out_length, X pi->community, &pi->community_len, X &pi->version, X pi->packet_end - out_header); X if (out_data != out_header){ X ERROR("internal error"); X return 0; X } X } else if (pi->version == SNMP_VERSION_2){ X out_data = snmp_secauth_build(out_auth, out_length, pi, X pi->packet_end - out_header, X pi->dstParty, pi->dstPartyLength, X pi->srcParty, pi->srcPartyLength, X pi->context, pi->contextLength, X &packet_len, LAST_PASS); X } X X /* packet_end is correct for old SNMP. This dichotomy needs X to be fixed. */ X if (pi->version == SNMP_VERSION_2) X pi->packet_end = out_auth + packet_len; X break; X case SNMP_ERR_TOOBIG: X if (pi->version == SNMP_VERSION_2){ X create_toobig(out_auth, *out_length, reqid, pi); X break; X } /* else FALLTHRU */ X case SNMP_ERR_NOACCESS: X case SNMP_ERR_WRONGTYPE: X case SNMP_ERR_WRONGLENGTH: X case SNMP_ERR_WRONGENCODING: X case SNMP_ERR_WRONGVALUE: X case SNMP_ERR_NOCREATION: X case SNMP_ERR_INCONSISTENTVALUE: X case SNMP_ERR_RESOURCEUNAVAILABLE: X case SNMP_ERR_COMMITFAILED: X case SNMP_ERR_UNDOFAILED: X case SNMP_ERR_AUTHORIZATIONERROR: X case SNMP_ERR_NOTWRITABLE: X case SNMP_ERR_NOSUCHNAME: X case SNMP_ERR_BADVALUE: X case SNMP_ERR_READONLY: X case SNMP_ERR_GENERR: X if (create_identical(startData, out_auth, startLength, errstat, X errindex, pi)){ X *out_length = pi->packet_end - out_auth; X return 1; X } X return 0; X default: X return 0; X } X *out_length = pi->packet_end - out_auth; X return 1; } X /* X * Parse_var_op_list goes through the list of variables and retrieves each one, X * placing it's value in the output packet. In the case of a set request, X * if action is RESERVE, the value is just checked for correct type and X * value, and resources may need to be reserved. If the action is COMMIT, X * the variable is set. If the action is FREE, an error was discovered X * somewhere in the previous RESERVE pass, so any reserved resources X * should be FREE'd. X * If any error occurs, an error code is returned. X */ int parse_var_op_list(data, length, out_data, out_length, index, pi, action) X register u_char *data; X int length; X register u_char *out_data; X int out_length; X register long *index; X struct packet_info *pi; X int action; { X u_char type; X oid var_name[MAX_NAME_LEN]; X int var_name_len, var_val_len; X u_char var_val_type, *var_val, statType; X register u_char *statP; X int statLen; X u_short acl; X int rw, exact, err; X int (*write_method)(); X u_char *headerP, *var_list_start; X int dummyLen; X int header_shift; X u_char *getStatPtr(); X int noSuchObject; X X if (pi->pdutype == SET_REQ_MSG) X rw = WRITE; X else X rw = READ; X if (pi->pdutype == GETNEXT_REQ_MSG){ X exact = FALSE; X } else { X exact = TRUE; X } X data = asn_parse_header(data, &length, &type); X if (data == NULL){ X ERROR("not enough space for varlist"); X return PARSE_ERROR; X } X if (type != (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR)){ X ERROR("wrong type"); X return PARSE_ERROR; X } X headerP = out_data; X out_data = asn_build_sequence(out_data, &out_length, X (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); X if (out_data == NULL){ X ERROR("not enough space in output packet"); X return BUILD_ERROR; X } X var_list_start = out_data; X X *index = 1; X while((int)length > 0){ X /* parse the name, value pair */ X var_name_len = MAX_NAME_LEN; X data = snmp_parse_var_op(data, var_name, &var_name_len, &var_val_type, X &var_val_len, &var_val, (int *)&length); X if (data == NULL) X return PARSE_ERROR; X /* now attempt to retrieve the variable on the local entity */ X statP = getStatPtr(var_name, &var_name_len, &statType, &statLen, &acl, X exact, &write_method, pi, &noSuchObject); X if (pi->version != SNMP_VERSION_2 && statP == NULL X && (pi->pdutype != SET_REQ_MSG || !write_method)){ ERROR(""); X return SNMP_ERR_NOSUCHNAME; X } X X /* Effectively, check if this variable is read-only or read-write X (in the MIB sense). */ X if (pi->pdutype == SET_REQ_MSG && pi->version != SNMP_VERSION_2 X && !snmp_access(acl, pi->community_id, rw)){ ERROR(""); X return SNMP_ERR_NOSUCHNAME; X } X if (pi->pdutype == SET_REQ_MSG && pi->version == SNMP_VERSION_2 X && !snmp_access(acl, pi->community_id, rw)){ printf("%X %d %d\n", acl, pi->community_id, rw); ERROR(""); X return SNMP_ERR_NOTWRITABLE; X } X /* Its bogus to check here on getnexts - the whole packet shouldn't X be dumped - this should should be the loop in getStatPtr X luckily no objects are set unreadable. This can still be X useful for sets to determine which are intrinsically writable */ X X if (pi->pdutype == SET_REQ_MSG){ X if (write_method == NULL){ X if (statP != NULL){ X /* see if the type and value is consistent with this X entity's variable */ X if (!goodValue(var_val_type, var_val_len, statType, X statLen)){ X if (pi->version == SNMP_VERSION_2) X return SNMP_ERR_WRONGTYPE; /* poor approximation */ X else X return SNMP_ERR_BADVALUE; X } X /* actually do the set if necessary */ X if (action == COMMIT) X setVariable(var_val, var_val_type, var_val_len, X statP, statLen); X } else { X if (pi->version == SNMP_VERSION_2) X return SNMP_ERR_NOCREATION; X else X return SNMP_ERR_NOSUCHNAME; X } X } else { X err = (*write_method)(action, var_val, var_val_type, X var_val_len, statP, var_name, X var_name_len); X if (err != SNMP_ERR_NOERROR){ X if (pi->version != SNMP_VERSION_2) X return SNMP_ERR_BADVALUE; X else X return err; X } X } X } else { X /* retrieve the value of the variable and place it into the X * outgoing packet */ X if (statP == NULL){ X statLen = 0; X if (exact){ X if (noSuchObject == TRUE){ X statType = SNMP_NOSUCHOBJECT; X } else { X statType = SNMP_NOSUCHINSTANCE; X } X } else { X statType = SNMP_ENDOFMIBVIEW; X } X } X out_data = snmp_build_var_op(out_data, var_name, &var_name_len, X statType, statLen, statP, X &out_length); X if (out_data == NULL){ X return SNMP_ERR_TOOBIG; X } X } X X (*index)++; X } X if (pi->pdutype != SET_REQ_MSG){ X /* save a pointer to the end of the packet */ X pi->packet_end = out_data; X X /* Now rebuild header with the actual lengths */ X dummyLen = pi->packet_end - var_list_start; X if (asn_build_sequence(headerP, &dummyLen, X (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), X dummyLen) == NULL){ X return SNMP_ERR_TOOBIG; /* bogus error ???? */ X } X } X *index = 0; X return SNMP_ERR_NOERROR; } X struct repeater { X oid name[MAX_NAME_LEN]; X int length; } repeaterList[10]; X /* X * Bulk_var_op_list goes through the list of variables and retrieves each one, X * placing it's value in the output packet. In the case of a set request, X * if action is RESERVE, the value is just checked for correct type and X * value, and resources may need to be reserved. If the action is COMMIT, X * the variable is set. If the action is FREE, an error was discovered X * somewhere in the previous RESERVE pass, so any reserved resources X * should be FREE'd. X * If any error occurs, an error code is returned. X */ int bulk_var_op_list(data, length, out_data, out_length, non_repeaters, X max_repetitions, index, pi) X register u_char *data; X int length; X register u_char *out_data; X int out_length; X int non_repeaters; X int max_repetitions; X register long *index; X struct packet_info *pi; { X u_char type; X oid var_name[MAX_NAME_LEN]; X int var_name_len, var_val_len; X u_char var_val_type, *var_val, statType; X register u_char *statP; X int statLen; X u_short acl; X int (*write_method)(); X u_char *headerP, *var_list_start; X int dummyLen; X int header_shift; X u_char *getStatPtr(); X u_char *repeaterStart, *out_data_save; X int repeatCount, repeaterLength, indexStart, out_length_save; X int full = FALSE; X int noSuchObject, useful; X int repeaterIndex, repeaterCount; X struct repeater *rl; X X if (non_repeaters < 0) X non_repeaters = 0; X max_repetitions = *index; X if (max_repetitions < 0) X max_repetitions = 0; X X data = asn_parse_header(data, &length, &type); X if (data == NULL){ X ERROR("not enough space for varlist"); X return PARSE_ERROR; X } X if (type != (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR)){ X ERROR("wrong type"); X return PARSE_ERROR; X } X headerP = out_data; X out_data = asn_build_sequence(out_data, &out_length, X (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); X if (out_data == NULL){ X ERROR("not enough space in output packet"); X return BUILD_ERROR; X } #if 0 X out_data += 4; X out_length -= 4; #endif X var_list_start = out_data; X X out_length -= 32; /* slop factor */ X *index = 1; X while((int)length > 0 && non_repeaters > 0){ X /* parse the name, value pair */ X X var_name_len = MAX_NAME_LEN; X data = snmp_parse_var_op(data, var_name, &var_name_len, &var_val_type, X &var_val_len, &var_val, (int *)&length); X if (data == NULL) X return PARSE_ERROR; X /* now attempt to retrieve the variable on the local entity */ X statP = getStatPtr(var_name, &var_name_len, &statType, &statLen, &acl, X FALSE, &write_method, pi, &noSuchObject); X X if (statP == NULL) X statType = SNMP_ENDOFMIBVIEW; X X /* save out_data so this varbind can be removed if it goes over X the limit for this packet */ X X /* retrieve the value of the variable and place it into the X * outgoing packet */ X out_data = snmp_build_var_op(out_data, var_name, &var_name_len, X statType, statLen, statP, X &out_length); X if (out_data == NULL){ X return SNMP_ERR_TOOBIG; /* ??? */ X } X (*index)++; X non_repeaters--; X } X X repeaterStart = out_data; X indexStart = *index; /* index on input packet */ X X repeaterCount = 0; X rl = repeaterList; X useful = FALSE; X while((int)length > 0){ X /* parse the name, value pair */ X rl->length = MAX_NAME_LEN; X data = snmp_parse_var_op(data, rl->name, &rl->length, X &var_val_type, &var_val_len, &var_val, X (int *)&length); X if (data == NULL) X return PARSE_ERROR; X /* now attempt to retrieve the variable on the local entity */ X statP = getStatPtr(rl->name, &rl->length, &statType, &statLen, X &acl, FALSE, &write_method, pi, &noSuchObject); X if (statP == NULL) X statType = SNMP_ENDOFMIBVIEW; X else X useful = TRUE; X X out_data_save = out_data; X out_length_save = out_length; X /* retrieve the value of the variable and place it into the X * outgoing packet */ X out_data = snmp_build_var_op(out_data, rl->name, &rl->length, X statType, statLen, statP, X &out_length); X if (out_data == NULL){ X out_data = out_data_save; X out_length = out_length_save; X full = TRUE; X } X (*index)++; X repeaterCount++; X rl++; X } X repeaterLength = out_data - repeaterStart; X if (!useful) X full = TRUE; X X for(repeatCount = 1; repeatCount < max_repetitions; repeatCount++){ X data = repeaterStart; X length = repeaterLength; X *index = indexStart; X repeaterStart = out_data; X useful = FALSE; X repeaterIndex = 0; X rl = repeaterList; X while((repeaterIndex++ < repeaterCount) > 0 && !full){ X /* parse the name, value pair */ #if 0 X var_name_len = MAX_NAME_LEN; X data = snmp_parse_var_op(data, var_name, &var_name_len, X &var_val_type, &var_val_len, &var_val, X (int *)&length); X if (data == NULL) X return PARSE_ERROR; #endif X /* now attempt to retrieve the variable on the local entity */ X statP = getStatPtr(rl->name, &rl->length, &statType, &statLen, X &acl, FALSE, &write_method, pi, &noSuchObject); X if (statP == NULL) X statType = SNMP_ENDOFMIBVIEW; X else X useful = TRUE; X X out_data_save = out_data; X out_length_save = out_length; X /* retrieve the value of the variable and place it into the X * Outgoing packet */ X out_data = snmp_build_var_op(out_data, rl->name, &rl->length, X statType, statLen, statP, X &out_length); X if (out_data == NULL){ X out_data = out_data_save; X out_length = out_length_save; X full = TRUE; X repeatCount = max_repetitions; X } X (*index)++; X rl++; X } X repeaterLength = out_data - repeaterStart; X if (!useful) X full = TRUE; X } X /* save a pointer to the end of the packet */ X pi->packet_end = out_data; X X /* Now rebuild header with the actual lengths */ X dummyLen = pi->packet_end - var_list_start; X if (asn_build_sequence(headerP, &dummyLen, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), dummyLen) == NULL){ X return SNMP_ERR_TOOBIG; /* bogus error ???? */ X } X *index = 0; X return SNMP_ERR_NOERROR; } X /* X * create a packet identical to the input packet, except for the error status X * and the error index which are set according to the input variables. X * Returns 1 upon success and 0 upon failure. X */ int create_identical(snmp_in, snmp_out, snmp_length, errstat, errindex, pi) X u_char *snmp_in; X u_char *snmp_out; X int snmp_length; X long errstat, errindex; X struct packet_info *pi; { X register u_char *data; X u_char type; X long dummy; X int length, messagelen, headerLength; X register u_char *headerPtr, *reqidPtr, *errstatPtr, X *errindexPtr, *varListPtr; X int packet_len; X struct partyEntry *tmp; X X length = snmp_length; X (void)asn_parse_header(snmp_in, &length, &type); X X length = snmp_length; X if (type == (ASN_SEQUENCE | ASN_CONSTRUCTOR)){ X /* authenticates message and returns length if valid */ X pi->community_len = COMMUNITY_MAX_LEN; X headerPtr = snmp_auth_parse(snmp_in, &length, X pi->community, &pi->community_len, X (long *)&pi->version); X } else if (type == (ASN_CONTEXT | ASN_CONSTRUCTOR | 1)){ X pi->srcPartyLength = sizeof(pi->srcParty)/sizeof(oid); X pi->dstPartyLength = sizeof(pi->dstParty)/sizeof(oid); X X /* authenticates message and returns length if valid */ X headerPtr = snmp_secauth_parse(snmp_in, &length, pi, X pi->srcParty, &pi->srcPartyLength, X pi->dstParty, &pi->dstPartyLength, X pi->context, &pi->contextLength, 0); X } else { X ERROR("unknown auth header type"); X return NULL; X } X if (pi->version == SNMP_VERSION_2){ X /* X * Swap source and destination party pointers for building the reply X * packet. X */ X tmp = pi->srcp; X pi->srcp = pi->dstp; X pi->dstp = tmp; X } X X if (headerPtr == NULL) X return 0; X messagelen = length; X reqidPtr = asn_parse_header(headerPtr, &length, (u_char *)&dummy); X if (reqidPtr == NULL) X return 0; X headerLength = length; X errstatPtr = asn_parse_int(reqidPtr, &length, &type, (long *)&dummy, X sizeof dummy); /* request id */ X if (errstatPtr == NULL) X return 0; X errindexPtr = asn_parse_int(errstatPtr, &length, &type, (long *)&dummy, X sizeof dummy); /* error status */ X if (errindexPtr == NULL) X return 0; X varListPtr = asn_parse_int(errindexPtr, &length, &type, (long *)&dummy, X sizeof dummy); /* error index */ X if (varListPtr == NULL) X return 0; X #if 0 X data = asn_build_header(headerPtr, &headerLength, GET_RSP_MSG, X headerLength); X if (data != reqidPtr) X return 0; #else X /* quick fix to solve the problem of different length encoding rules. X * The entire creat_identical routine should probably be excised from X * this code as a long-term solution (we should re-encode the error/set X * reply packet). X */ X *headerPtr = GET_RSP_MSG; #endif X X length = snmp_length; X type = (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER); X data = asn_build_int(errstatPtr, &length, type, &errstat, sizeof errstat); X if (data != errindexPtr) X return 0; X data = asn_build_int(errindexPtr, &length, type, &errindex, X sizeof errindex); X if (data != varListPtr) X return 0; X X dummy = snmp_length; X if (pi->version == SNMP_VERSION_1){ X data = snmp_auth_build(snmp_out, (int *)&dummy, X pi->community, &pi->community_len, X (long *)&pi->version, messagelen); X } else if (pi->version == SNMP_VERSION_2){ X data = snmp_secauth_build(snmp_out, (int *)&dummy, pi, messagelen, X pi->dstParty, pi->dstPartyLength, X pi->srcParty, pi->srcPartyLength, X pi->context, pi->contextLength, X &packet_len, 0); X } X if (data == NULL){ X ERROR("couldn't read_identical"); X return 0; X } X bcopy((char *)headerPtr, data, messagelen); X if (pi->version == SNMP_VERSION_2){ X dummy = snmp_length; X data = snmp_secauth_build(snmp_out, (int *)&dummy, pi, messagelen, X pi->dstParty, pi->dstPartyLength, X pi->srcParty, pi->srcPartyLength, X pi->context, pi->contextLength, X &packet_len, LAST_PASS); X if (data == NULL){ X ERROR("compute digest"); X return 0; X } X pi->packet_end = snmp_out + packet_len; X } else { X pi->packet_end = data + messagelen; X } X return 1; } X int create_toobig(snmp_out, snmp_length, reqid, pi) X u_char *snmp_out; X int snmp_length; X long reqid; X struct packet_info *pi; { X register u_char *data; X u_char type; X int errstat = SNMP_ERR_TOOBIG, errindex = 0; X int length; X register u_char *headerPtr, *reqidPtr; X int packet_len; X X length = snmp_length; X data = snmp_secauth_build(snmp_out, (int *)&length, pi, 16, X pi->dstParty, pi->dstPartyLength, X pi->srcParty, pi->srcPartyLength, X pi->context, pi->contextLength, X &packet_len, 0); X if (data == NULL) X return 0; X headerPtr = data; X data = asn_build_sequence(data, &length, GET_RSP_MSG, 16); X if (data == NULL) X return 0; X reqidPtr = data; X type = (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER); X data = asn_build_int(data, &length, type, &reqid, sizeof reqid); X if (data == NULL) X return 0; X data = asn_build_int(data, &length, type, &errstat, sizeof errstat); X if (data == NULL) X return 0; X data = asn_build_int(data, &length, type, &errindex, sizeof errindex); X if (data == NULL) X return 0; X X data = asn_build_sequence(data, &length, X (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); X if (data == NULL) X return 0; X X pi->packet_end = data; X data = asn_build_sequence(headerPtr, &length, GET_RSP_MSG, X data - reqidPtr); X if (data != reqidPtr) X return 0; X X data = snmp_secauth_build(snmp_out, (int *)&snmp_length, pi, X pi->packet_end - headerPtr, X pi->dstParty, pi->dstPartyLength, X pi->srcParty, pi->srcPartyLength, X pi->context, pi->contextLength, X &packet_len, LAST_PASS); X if (data == NULL && data != headerPtr){ X ERROR("compute digest"); X return 0; X } X X return 1; } X int snmp_access(acl, community, rw) X u_short acl; X int community; X int rw; { X /* X * Each group has 2 bits, the more significant one is for read access, X * the less significant one is for write access. X */ X X community <<= 1; /* multiply by two to shift two bits at a time */ X if (rw == READ){ X return (acl & (2 << community)); /* return the correct bit */ X } else { X return (acl & (1 << community)); X } } X int get_community(community, community_len) X u_char *community; X int community_len; { X int count; X X for(count = 0; count < NUM_COMMUNITIES; count++){ X if ((community_len == strlen(communities[count]) X && !bcmp(communities[count], (char *)community, community_len))) X break; X } X if (count == NUM_COMMUNITIES) X return -1; X return count + 1; } X int goodValue(inType, inLen, actualType, actualLen) X u_char inType, actualType; X int inLen, actualLen; { X if (inLen > actualLen) X return FALSE; X return (inType == actualType); } X setVariable(var_val, var_val_type, var_val_len, statP, statLen) X u_char *var_val; X u_char var_val_type; X int var_val_len; X u_char *statP; X int statLen; { X int buffersize = 1000; X X switch(var_val_type){ X case ASN_INTEGER: X asn_parse_int(var_val, &buffersize, &var_val_type, (long *)statP, statLen); X break; X case COUNTER: X case GAUGE: X case TIMETICKS: X asn_parse_unsigned_int(var_val, &buffersize, &var_val_type, (u_long *)statP, statLen); X break; X case COUNTER64: X asn_parse_unsigned_int64(var_val, &buffersize, &var_val_type, X (struct counter64 *)statP, statLen); X break; X case ASN_OCTET_STR: X case IPADDRESS: X case OPAQUE: X case NSAP: X asn_parse_string(var_val, &buffersize, &var_val_type, statP, &statLen); X break; X case ASN_OBJECT_ID: X asn_parse_objid(var_val, &buffersize, &var_val_type, (oid *)statP, &statLen); X break; X case ASN_BIT_STR: X asn_parse_bitstring(var_val, &buffersize, &var_val_type, statP, &statLen); X break; X } } X X SHAR_EOF echo 'File snmp2/agent/snmp_agent.c is complete' && $shar_touch -am 1015123693 'snmp2/agent/snmp_agent.c' && chmod 0644 'snmp2/agent/snmp_agent.c' || echo 'restore of snmp2/agent/snmp_agent.c failed' shar_count="`wc -c < 'snmp2/agent/snmp_agent.c'`" test 30229 -eq "$shar_count" || echo "snmp2/agent/snmp_agent.c: original size 30229, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/agent/snmp_var_route.c ============== if test -f 'snmp2/agent/snmp_var_route.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/agent/snmp_var_route.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/agent/snmp_var_route.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/agent/snmp_var_route.c' && /* X * snmp_var_route.c - return a pointer to the named variable. X * X * X */ /*********************************************************** X Copyright 1988, 1989 by Carnegie Mellon University X Copyright 1989 TGV, Incorporated 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 and TGV not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. X CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CMU OR TGV 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. ******************************************************************/ X #define GATEWAY /* MultiNet is always configured this way! */ X #ifdef VXWORKS #include #include "VXtime.h" #else #include #include #include #endif X #include X #include #ifdef VXWORKS #include #else #include #include #endif #include #define KERNEL /* to get routehash and RTHASHSIZ */ #include #undef KERNEL #define rt_unit rt_hash /* Reuse this field for device # */ X #ifdef VXWORKS #include #else #include #endif X #ifndef NULL #define NULL 0 #endif X #define CACHE_TIME (120) /* Seconds */ X #include "asn1.h" #include "snmp.h" #include "snmp_impl.h" #include "mib.h" #include "snmp_vars.h" X #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif X static struct rtentry **rthead=0; static int rtsize=0, rtalloc=0; X #define KNLookup(nl_which, buf, s) (klookup( nl[nl_which].n_value, buf, s)) X static struct nlist nl[] = { #define N_RTHOST 0 X { "_rthost" }, #define N_RTNET 1 X { "_rtnet" }, #define N_RTHASHSIZE 2 X { "_rthashsize" }, X 0, }; X extern write_rte(); X #ifdef VXWORKS_DEBUG unsigned long qsortCalled=0; unsigned long qsortCompareCalled=0; #endif X X u_char * var_ipRouteEntry(vp, name, length, exact, var_len, write_method) X register struct variable *vp; /* IN - pointer to variable entry that points here */ X register oid *name; /* IN/OUT - input name requested, output name found */ X register int *length; /* IN/OUT - length of input and output strings */ X int exact; /* IN - TRUE if an exact match was requested. */ X int *var_len; /* OUT - length of variable or 0 if function returned. */ X int (**write_method)(); /* OUT - pointer to function to set variable, otherwise 0 */ { X /* X * object identifier is of form: X * 1.3.6.1.2.1.4.21.1.1.A.B.C.D, where A.B.C.D is IP address. X * IPADDR starts at offset 10. X */ X register int Save_Valid, result, RtIndex; X static int saveNameLen=0, saveExact=0, saveRtIndex=0; X static oid saveName[14], Current[14]; X u_char *cp; X oid *op; X X X /* X * OPTIMIZATION: X * X * If the name was the same as the last name, with the possible X * exception of the [9]th token, then don't read the routing table X * X */ X X if ((saveNameLen == *length) && (saveExact == exact)) { X register int temp=name[9]; X name[9] = 0; X Save_Valid = (compare(name, *length, saveName, saveNameLen) == 0); X name[9] = temp; X } else Save_Valid = 0; X X if (Save_Valid) { X register int temp=name[9]; /* Fix up 'lowest' found entry */ X bcopy((char *) Current, (char *) name, 14 * sizeof(oid)); X name[9] = temp; X *length = 14; X RtIndex = saveRtIndex; X } else { X /* fill in object part of name for current (less sizeof instance part) */ X X bcopy((char *)vp->name, (char *)Current, (int)(vp->namelen) * sizeof(oid)); X #if 0 X /* X * Only reload if this is the start of a wildcard X */ X if (*length < 14) { X Route_Scan_Reload(); X } #else X Route_Scan_Reload(); #endif X for(RtIndex=0; RtIndex < rtsize; RtIndex++) { X cp = (u_char *)&(((struct sockaddr_in *) &(rthead[RtIndex]->rt_dst))->sin_addr.s_addr); X op = Current + 10; X *op++ = *cp++; X *op++ = *cp++; X *op++ = *cp++; X *op++ = *cp++; X X result = compare(name, *length, Current, 14); X if ((exact && (result == 0)) || (!exact && (result < 0))) X break; X } X if (RtIndex >= rtsize) return(NULL); X /* X * Save in the 'cache' X */ X bcopy((char *) name, (char *) saveName, *length * sizeof(oid)); X saveName[9] = '\0'; X saveNameLen = *length; X saveExact = exact; X saveRtIndex = RtIndex; X /* X * Return the name X */ X bcopy((char *) Current, (char *) name, 14 * sizeof(oid)); X *length = 14; X } X X *write_method = write_rte; X *var_len = sizeof(long_return); X X X X switch(vp->magic){ X case IPROUTEDEST: X return(u_char *) &((struct sockaddr_in *) &rthead[RtIndex]->rt_dst)->sin_addr.s_addr; X case IPROUTEIFINDEX: X long_return = (u_long)rthead[RtIndex]->rt_unit; X return (u_char *)&long_return; X case IPROUTEMETRIC1: X long_return = (rthead[RtIndex]->rt_flags & RTF_GATEWAY) ? 1 : 0; X return (u_char *)&long_return; X case IPROUTEMETRIC2: X long_return = -1; X return (u_char *)&long_return; X case IPROUTEMETRIC3: X long_return = -1; X return (u_char *)&long_return; X case IPROUTEMETRIC4: X long_return = -1; X return (u_char *)&long_return; X case IPROUTENEXTHOP: X return(u_char *) &((struct sockaddr_in *) &rthead[RtIndex]->rt_gateway)->sin_addr.s_addr; X case IPROUTETYPE: X long_return = (rthead[RtIndex]->rt_flags & RTF_GATEWAY) ? 4 : 3; X return (u_char *)&long_return; X case IPROUTEPROTO: X long_return = (rthead[RtIndex]->rt_flags & RTF_DYNAMIC) ? 4 : 2; X return (u_char *)&long_return; X case IPROUTEAGE: X long_return = 0; X return (u_char *)&long_return; X default: X ERROR(""); X } X return NULL; } X init_routes(){ X X nlist("/vmunix",nl); } X #if defined(mips) X static Route_Scan_Reload() { X struct rtentry **routehash, mb; X register struct rtentry *m; X struct ifnet ifnet; X struct rtentry *rt; X int i, table, qsort_compare(); X register char *cp; X char name[16], temp[16]; X static int Time_Of_Last_Reload=0; X struct timeval now; X int hashsize; X extern char *index(), *malloc(); X X gettimeofday(&now, (struct timezone *)0); X if (Time_Of_Last_Reload+CACHE_TIME > now.tv_sec) X return; X Time_Of_Last_Reload = now.tv_sec; X X /* X * Makes sure we have SOME space allocated for new routing entries X */ X if (!rthead) { X rthead = (struct rtentry **) malloc(100 * sizeof(struct rtentry *)); X if (!rthead) { X ERROR("malloc"); X return; X } X bzero((char *)rthead, 100 * sizeof(struct rtentry *)); X rtalloc = 100; X } X X for (table=N_RTHOST; table<=N_RTNET; table++) { X X KNLookup(N_RTHASHSIZE, (char *)&hashsize, sizeof(hashsize)); X routehash = (struct rtentry **)malloc(hashsize * sizeof(struct mbuf *)); X KNLookup( table, (char *)routehash, hashsize * sizeof(struct mbuf *)); X for (i = 0; i < hashsize; i++) { X if (routehash[i] == 0) X continue; X m = routehash[i]; X while (m) { X /* X * Dig the route out of the kernel... X */ X klookup(m , (char *)&mb, sizeof (mb)); X m = mb.rt_next; X X rt = &mb; X if (rt->rt_ifp != 0) { X klookup( rt->rt_ifp, (char *)&ifnet, sizeof (ifnet)); X klookup( ifnet.if_name, name, 16); X name[15] = '\0'; X cp = (char *) index(name, '\0'); X *cp++ = ifnet.if_unit + '0'; X *cp = '\0'; /* if (strcmp(name,"lo0") == 0) continue; */ X X X Interface_Scan_Init(); X while (Interface_Scan_Next((int *)&rt->rt_unit, temp, 0, 0) != 0) { X if (strcmp(name, temp) == 0) break; X } X } X /* X * Allocate a block to hold it and add it to the database X */ X if (rtsize >= rtalloc) { X rthead = (struct rtentry **) realloc((char *)rthead, 2 * rtalloc * sizeof(struct rtentry *)); X bzero((char *) &rthead[rtalloc], rtalloc * sizeof(struct rtentry *)); X rtalloc *= 2; X } X if (!rthead[rtsize]) X rthead[rtsize] = (struct rtentry *) malloc(sizeof(struct rtentry)); X /* X * Add this to the database X */ X bcopy((char *)rt, (char *)rthead[rtsize], sizeof(struct rtentry)); X rtsize++; X } X } X } X /* X * Sort it! X */ X qsort((char *)rthead,rtsize,sizeof(rthead[0]),qsort_compare); } X #else X static Route_Scan_Reload() { X struct mbuf **routehash, mb; X register struct mbuf *m; X struct ifnet ifnet; X struct rtentry *rt; X int i, table, qsort_compare(); X register char *cp; X char name[16], temp[16]; X static int Time_Of_Last_Reload=0; X struct timeval now; X int hashsize; X extern char *index(), *malloc(); X X gettimeofday(&now, (struct timezone *)0); X if (Time_Of_Last_Reload+CACHE_TIME > now.tv_sec) X return; X Time_Of_Last_Reload = now.tv_sec; X X /* X * Makes sure we have SOME space allocated for new routing entries X */ X if (!rthead) { X rthead = (struct rtentry **) malloc(100 * sizeof(struct rtentry *)); X if (!rthead) { X ERROR("malloc"); X return; X } X bzero((char *)rthead, 100 * sizeof(struct rtentry *)); X rtalloc = 100; X } X X for (table=N_RTHOST; table<=N_RTNET; table++) { X X #ifdef sunV3 X hashsize = RTHASHSIZ; #else X KNLookup( N_RTHASHSIZE, (char *)&hashsize, sizeof(hashsize)); #endif X routehash = (struct mbuf **)malloc(hashsize * sizeof(struct mbuf *)); X KNLookup( table, (char *)routehash, hashsize * sizeof(struct mbuf *)); X for (i = 0; i < hashsize; i++) { X if (routehash[i] == 0) X continue; X m = routehash[i]; X while (m) { X /* X * Dig the route out of the kernel... X */ X klookup( m , (char *)&mb, sizeof (mb)); X m = mb.m_next; X rt = mtod(&mb, struct rtentry *); X X if (rt->rt_ifp != 0) { X X klookup(rt->rt_ifp, (char *)&ifnet, sizeof (ifnet)); X klookup(ifnet.if_name, name, 16); X name[15] = '\0'; X cp = (char *) index(name, '\0'); X *cp++ = ifnet.if_unit + '0'; X *cp = '\0'; X if (strcmp(name,"lo0") == 0) continue; X X Interface_Scan_Init(); X while (Interface_Scan_Next((int *)&rt->rt_unit, temp, 0, 0) != 0) { X if (strcmp(name, temp) == 0) break; X } X } X /* X * Allocate a block to hold it and add it to the database X */ X if (rtsize >= rtalloc) { X rthead = (struct rtentry **) realloc((char *)rthead, 2 * rtalloc * sizeof(struct rtentry *)); X bzero((char *) &rthead[rtalloc], rtalloc * sizeof(struct rtentry *)); X rtalloc *= 2; X } X if (!rthead[rtsize]) X rthead[rtsize] = (struct rtentry *) malloc(sizeof(struct rtentry)); X /* X * Add this to the database X */ X bcopy((char *)rt, (char *)rthead[rtsize], sizeof(struct rtentry)); X rtsize++; X } X } X } X /* X * Sort it! X */ #ifdef VXWORKS_DEBUG X qsortCalled++; X #if 0 X printf ("calling qsort (%x, %d, %d, %x)\n", rthead, rtsize, sizeof(rthead[0]), qsort_compare); #endif /* 0 */ #endif /* VXWORKS DEBUG */ X X qsort((char *)rthead,rtsize,sizeof(rthead[0]),qsort_compare); } #endif X X X X /* X * Create a host table X */ static int qsort_compare(r1,r2) struct rtentry **r1, **r2; { X #ifdef VXWORKS_DEBUG X register u_long dst1; X register u_long dst2; X X qsortCompareCalled++; X #if 0 X printf ("qsort_compare (%x, %x)\n", r1, r2); #endif /* 0 */ X X dst1 = ntohl(((struct sockaddr_in *) &((*r1)->rt_dst))->sin_addr.s_addr); X dst2 = ntohl(((struct sockaddr_in *) &((*r2)->rt_dst))->sin_addr.s_addr); #else /* VXWORKS_DEBUG */ X register u_long dst1 = ntohl(((struct sockaddr_in *) &((*r1)->rt_dst))->sin_addr.s_addr); X register u_long dst2 = ntohl(((struct sockaddr_in *) &((*r2)->rt_dst))->sin_addr.s_addr); #endif /* VXWORKS_DEBUG */ X X X /* X * Do the comparison X */ X if (dst1 == dst2) return(0); X if (dst1 > dst2) return(1); X return(-1); } X X X X X X X X X X X X SHAR_EOF $shar_touch -am 1015123693 'snmp2/agent/snmp_var_route.c' && chmod 0644 'snmp2/agent/snmp_var_route.c' || echo 'restore of snmp2/agent/snmp_var_route.c failed' shar_count="`wc -c < 'snmp2/agent/snmp_var_route.c'`" test 12054 -eq "$shar_count" || echo "snmp2/agent/snmp_var_route.c: original size 12054, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/agent/snmp_vars_event.h ============== if test -f 'snmp2/agent/snmp_vars_event.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/agent/snmp_vars_event.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/agent/snmp_vars_event.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/agent/snmp_vars_event.h' && /* X * Definitions for SNMP (RFC 1067) agent variable finder. X * X */ /*********************************************************** X Copyright 1988, 1989 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. ******************************************************************/ X u_char *var_event(); u_char *getStatPtr(); X extern long long_return; extern u_char return_buf[]; X #define INST 0xFFFFFFFF /* used to fill out the instance field of the variables table */ X /* X * These are magic numbers for each variable. X */ X #define EVENTCLASS 0 #define EVENTINSTANCE 1 #define EVENTALARMTYPE 2 #define EVENTTIME 3 #define EVENTPROBCAUSE 4 #define EVENTSPECIFICPROBLEM 5 #define EVENTSEVERITY 6 #define EVENTBACKUPSTATUS 7 #define EVENTBACKUPINSTANCE 8 #define EVENTTREND 9 #define EVENTTHRESHOLD 10 #define EVENTTHRESHOLDLEVEL 11 #define EVENTTHRESHOLDOBSVALUE 12 #define EVENTID 13 #define EVENTCORRELATIONS 14 #define EVENTOPERSTATE 16 #define EVENTADMINSTATE 17 #define EVENTMONATTRIBUTES 18 #define EVENTREPAIRACTION 19 #define EVENTDATA 20 #define EVENTTEXT 21 #define EVENTCREDIBILITY 22 #define EVENTINDEX 23 #define EVENTSTATUS 24 X X struct variable { X oid name[26]; /* object identifier of variable */ X u_char namelen; /* length of above */ X char type; /* type of variable, INTEGER or (octet) STRING */ X u_char magic; /* passed to function as a hint */ X u_short acl; /* access control list for variable */ X u_char *(*findVar)(); /* function that finds variable */ }; SHAR_EOF $shar_touch -am 1015123693 'snmp2/agent/snmp_vars_event.h' && chmod 0444 'snmp2/agent/snmp_vars_event.h' || echo 'restore of snmp2/agent/snmp_vars_event.h failed' shar_count="`wc -c < 'snmp2/agent/snmp_vars_event.h'`" test 2525 -eq "$shar_count" || echo "snmp2/agent/snmp_vars_event.h: original size 2525, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/agent/snmp_vars_m2m.h ============== if test -f 'snmp2/agent/snmp_vars_m2m.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/agent/snmp_vars_m2m.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/agent/snmp_vars_m2m.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/agent/snmp_vars_m2m.h' && /* X * Definitions for SNMP (RFC 1067) agent variable finder. X * X */ /*********************************************************** SHAR_EOF : || echo 'restore of snmp2/agent/snmp_vars_m2m.h failed' fi echo 'End of snmp2 part 36' echo 'File snmp2/agent/snmp_vars_m2m.h is continued in part 37' echo 37 > _sharseq.tmp exit 0