📄 usmdhuserkeytable_data_set.c
字号:
/*--------------------------------------------------------------------- * SNMP-USER-BASED-SM-MIB::usmUserEntry.usmUserName * usmUserName is subid 2 of usmUserEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.6.3.15.1.2.2.1.2 * Description:A human readable string representing the name of the user. This is the (User-based Security) Model dependent security ID. * * Attributes: * accessible 0 isscalar 0 enums 0 hasdefval 0 * readable 0 iscolumn 1 ranges 1 hashint 1 * settable 0 * hint: 255t * * Ranges: 1 - 32; * * Its syntax is SnmpAdminString (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length. (Max 32) * * * * NOTE: NODE usmUserName IS NOT ACCESSIBLE * * *//* * TODO:440:M: Implement usmDHUserKeyTable node value checks. * TODO:450:M: Implement usmDHUserKeyTable undo functions. * TODO:460:M: Implement usmDHUserKeyTable set functions. * TODO:480:M: Implement usmDHUserKeyTable commit functions. *//*--------------------------------------------------------------------- * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserAuthKeyChange * usmDHUserAuthKeyChange is subid 1 of usmDHUserKeyEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.3.101.1.1.2.1.1 * Description:The object used to change any given user's Authentication Key using a Diffie-Hellman key exchange. The right-most n bits of the shared secret 'sk', where 'n' is the number of bits required for the protocol defined by usmUserAuthProtocol, are installed as the operational authentication key for this row after a successful SET. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * * Its syntax is DHKeyChange (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length. (Max 32) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx * Pointer to the row request context. * @param usmDHUserAuthKeyChange_val_ptr * A char containing the new value. * @param usmDHUserAuthKeyChange_val_ptr_len * The size (in bytes) of the data pointed to by usmDHUserAuthKeyChange_val_ptr * * @retval MFD_SUCCESS : incoming value is legal * @retval MFD_NOT_VALID_NOW : incoming value is not valid now * @retval MFD_NOT_VALID_EVER : incoming value is never valid * * This is the place to check for requirements that are not * expressed in the mib syntax (for example, a requirement that * is detailed in the description for an object). * * You should check that the requested change between the undo value and the * new value is legal (ie, the transistion from one value to another * is legal). * *@note * This check is only to determine if the new value * is \b potentially valid. This is the first check of many, and * is one of the simplest ones. * *@note * this is not the place to do any checks for values * which depend on some other value in the mib. Those * types of checks should be done in the * usmDHUserKeyTable_check_dependencies() function. * * The following checks have already been done for you: * The syntax is ASN_OCTET_STR * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intusmDHUserAuthKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx, char *usmDHUserAuthKeyChange_val_ptr, size_t usmDHUserAuthKeyChange_val_ptr_len){ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_check_value", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); netsnmp_assert(NULL != usmDHUserAuthKeyChange_val_ptr); /* * TODO:441:o: |-> Check for valid usmDHUserAuthKeyChange value. */ return usmDHUserCheckValue(rowreq_ctx->data, 1, usmDHUserAuthKeyChange_val_ptr, usmDHUserAuthKeyChange_val_ptr_len);} /* usmDHUserAuthKeyChange_check_value *//** * Save old value information * * @param rowreq_ctx * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error. set will fail. * * This function will be called after the table level undo setup function * usmDHUserKeyTable_undo_setup has been called. * *@note * this function will only be called if a new value is set for this column. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in this function, so it * won't be done unless it is necessary. */intusmDHUserAuthKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx){ struct usmUser *undouser; DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_undo_setup", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:455:o: |-> Setup usmDHUserAuthKeyChange undo. */ /* * copy usmDHUserAuthKeyChange and usmDHUserAuthKeyChange_len data * set rowreq_ctx->undo->usmDHUserAuthKeyChange from rowreq_ctx->data->usmDHUserAuthKeyChange */ undouser = rowreq_ctx->undo; undouser->authKeyLen = rowreq_ctx->data->authKeyLen; memdup(&undouser->authKey, rowreq_ctx->data->authKey, rowreq_ctx->data->authKeyLen); return MFD_SUCCESS;} /* usmDHUserAuthKeyChange_undo_setup *//** * Set the new value. * * @param rowreq_ctx * Pointer to the users context. You should know how to * manipulate the value from this object. * @param usmDHUserAuthKeyChange_val_ptr * A char containing the new value. * @param usmDHUserAuthKeyChange_val_ptr_len * The size (in bytes) of the data pointed to by usmDHUserAuthKeyChange_val_ptr */intusmDHUserAuthKeyChange_set(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx, char *usmDHUserAuthKeyChange_val_ptr, size_t usmDHUserAuthKeyChange_val_ptr_len){ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_set", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); netsnmp_assert(NULL != usmDHUserAuthKeyChange_val_ptr); /* * TODO:461:M: |-> Set usmDHUserAuthKeyChange value. * set usmDHUserAuthKeyChange value in rowreq_ctx->data */ usmDHSetKey(rowreq_ctx->data, 1, usmDHUserAuthKeyChange_val_ptr, usmDHUserAuthKeyChange_val_ptr_len); return MFD_SUCCESS;} /* usmDHUserAuthKeyChange_set *//** * undo the previous set. * * @param rowreq_ctx * Pointer to the users context. */intusmDHUserAuthKeyChange_undo(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx){ struct usmUser *undouser; DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_undo", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:456:o: |-> Clean up usmDHUserAuthKeyChange undo. */ /* * copy usmDHUserAuthKeyChange and usmDHUserAuthKeyChange_len data * set rowreq_ctx->data->usmDHUserAuthKeyChange from rowreq_ctx->undo->usmDHUserAuthKeyChange */ undouser = rowreq_ctx->undo; undouser->authKeyLen = rowreq_ctx->data->authKeyLen; SNMP_FREE(rowreq_ctx->data->authKey); rowreq_ctx->data->authKey = undouser->authKey; undouser->authKey = NULL; return MFD_SUCCESS;} /* usmDHUserAuthKeyChange_undo *//*--------------------------------------------------------------------- * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserOwnAuthKeyChange * usmDHUserOwnAuthKeyChange is subid 2 of usmDHUserKeyEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.3.101.1.1.2.1.2 * Description:The object used to change the agents own Authentication Key using a Diffie-Hellman key exchange. The right-most n bits of the shared secret 'sk', where 'n' is the number of bits required for the protocol defined by usmUserAuthProtocol, are installed as the operational authentication key for this row after a successful SET. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * * Its syntax is DHKeyChange (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length. (Max 32) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx * Pointer to the row request context. * @param usmDHUserOwnAuthKeyChange_val_ptr * A char containing the new value. * @param usmDHUserOwnAuthKeyChange_val_ptr_len * The size (in bytes) of the data pointed to by usmDHUserOwnAuthKeyChange_val_ptr * * @retval MFD_SUCCESS : incoming value is legal * @retval MFD_NOT_VALID_NOW : incoming value is not valid now * @retval MFD_NOT_VALID_EVER : incoming value is never valid * * This is the place to check for requirements that are not * expressed in the mib syntax (for example, a requirement that * is detailed in the description for an object). * * You should check that the requested change between the undo value and the * new value is legal (ie, the transistion from one value to another * is legal). * *@note * This check is only to determine if the new value * is \b potentially valid. This is the first check of many, and * is one of the simplest ones. * *@note * this is not the place to do any checks for values * which depend on some other value in the mib. Those * types of checks should be done in the * usmDHUserKeyTable_check_dependencies() function. * * The following checks have already been done for you: * The syntax is ASN_OCTET_STR * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intusmDHUserOwnAuthKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx, char *usmDHUserOwnAuthKeyChange_val_ptr, size_t usmDHUserOwnAuthKeyChange_val_ptr_len){ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_check_value", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); netsnmp_assert(NULL != usmDHUserOwnAuthKeyChange_val_ptr); /* * TODO:441:o: |-> Check for valid usmDHUserOwnAuthKeyChange value. */ return usmDHUserAuthKeyChange_check_value(rowreq_ctx, usmDHUserOwnAuthKeyChange_val_ptr, usmDHUserOwnAuthKeyChange_val_ptr_len);} /* usmDHUserOwnAuthKeyChange_check_value *//** * Save old value information * * @param rowreq_ctx * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error. set will fail. * * This function will be called after the table level undo setup function * usmDHUserKeyTable_undo_setup has been called. * *@note * this function will only be called if a new value is set for this column. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in this function, so it * won't be done unless it is necessary. */intusmDHUserOwnAuthKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_undo_setup", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:455:o: |-> Setup usmDHUserOwnAuthKeyChange undo. */ /* * copy usmDHUserOwnAuthKeyChange and usmDHUserOwnAuthKeyChange_len data * set rowreq_ctx->undo->usmDHUserOwnAuthKeyChange from rowreq_ctx->data->usmDHUserOwnAuthKeyChange */ return usmDHUserAuthKeyChange_undo_setup(rowreq_ctx);} /* usmDHUserOwnAuthKeyChange_undo_setup *//** * Set the new value. * * @param rowreq_ctx * Pointer to the users context. You should know how to * manipulate the value from this object. * @param usmDHUserOwnAuthKeyChange_val_ptr * A char containing the new value. * @param usmDHUserOwnAuthKeyChange_val_ptr_len * The size (in bytes) of the data pointed to by usmDHUserOwnAuthKeyChange_val_ptr */intusmDHUserOwnAuthKeyChange_set(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx, char *usmDHUserOwnAuthKeyChange_val_ptr, size_t usmDHUserOwnAuthKeyChange_val_ptr_len){ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_set", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); netsnmp_assert(NULL != usmDHUserOwnAuthKeyChange_val_ptr); /* * TODO:461:M: |-> Set usmDHUserOwnAuthKeyChange value. * set usmDHUserOwnAuthKeyChange value in rowreq_ctx->data */ return usmDHUserAuthKeyChange_set(rowreq_ctx, usmDHUserOwnAuthKeyChange_val_ptr, usmDHUserOwnAuthKeyChange_val_ptr_len);} /* usmDHUserOwnAuthKeyChange_set *//** * undo the previous set. * * @param rowreq_ctx * Pointer to the users context. */intusmDHUserOwnAuthKeyChange_undo(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_undo", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:456:o: |-> Clean up usmDHUserOwnAuthKeyChange undo. */ /* * copy usmDHUserOwnAuthKeyChange and usmDHUserOwnAuthKeyChange_len data * set rowreq_ctx->data->usmDHUserOwnAuthKeyChange from rowreq_ctx->undo->usmDHUserOwnAuthKeyChange */ return usmDHUserAuthKeyChange_undo(rowreq_ctx);} /* usmDHUserOwnAuthKeyChange_undo *//*--------------------------------------------------------------------- * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserPrivKeyChange * usmDHUserPrivKeyChange is subid 3 of usmDHUserKeyEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.3.101.1.1.2.1.3 * Description:The object used to change any given user's Privacy Key using
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -