/** * Extract the current value of the usmDHUserOwnPrivKeyChange data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param usmDHUserOwnPrivKeyChange_val_ptr_ptr * Pointer to storage for a char variable * @param usmDHUserOwnPrivKeyChange_val_ptr_len_ptr * Pointer to a size_t. On entry, it will contain the size (in bytes) * pointed to by usmDHUserOwnPrivKeyChange. * On exit, this value should contain the data size (in bytes). * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error * * @note If you need more than (*usmDHUserOwnPrivKeyChange_val_ptr_len_ptr) bytes of memory, * allocate it using malloc() and update usmDHUserOwnPrivKeyChange_val_ptr_ptr. * <b>DO NOT</b> free the previous pointer. * The MFD helper will release the memory you allocate. * * @remark If you call this function yourself, you are responsible * for checking if the pointer changed, and freeing any * previously allocated memory. (Not necessary if you pass * in a pointer to static memory, obviously.) */ int usmDHUserOwnPrivKeyChange_get(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx, char **usmDHUserOwnPrivKeyChange_val_ptr_ptr, size_t *usmDHUserOwnPrivKeyChange_val_ptr_len_ptr) { /** we should have a non-NULL pointer and enough storage */ netsnmp_assert((NULL != usmDHUserOwnPrivKeyChange_val_ptr_ptr) && (NULL != *usmDHUserOwnPrivKeyChange_val_ptr_ptr)); netsnmp_assert(NULL != usmDHUserOwnPrivKeyChange_val_ptr_len_ptr); DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnPrivKeyChange_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the usmDHUserOwnPrivKeyChange data. * copy (* usmDHUserOwnPrivKeyChange_val_ptr_ptr ) data and (* usmDHUserOwnPrivKeyChange_val_ptr_len_ptr ) from rowreq_ctx->data */ if (!rowreq_ctx || !usmDHUserOwnPrivKeyChange_val_ptr_len_ptr || !usmDHUserOwnPrivKeyChange_val_ptr_ptr || !*usmDHUserOwnPrivKeyChange_val_ptr_ptr) { return MFD_ERROR; } return usmDHGetUserKeyChange(rowreq_ctx->data, 0, usmDHUserOwnPrivKeyChange_val_ptr_ptr, usmDHUserOwnPrivKeyChange_val_ptr_len_ptr); } /* usmDHUserOwnPrivKeyChange_get */
int usmDHUserCheckValue(struct usmUser *user, int for_auth_key, u_char *val, size_t val_len) { /* * The set value must be composed of 2 parts, the first being the * current value */ u_char *current_value; size_t current_value_len; DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserCheckValue", "called\n")); usmDHGetUserKeyChange(user, for_auth_key, ¤t_value, ¤t_value_len); if (!current_value) return MFD_ERROR; if (val_len != current_value_len * 2) return MFD_NOT_VALID_NOW; if (memcmp(current_value, val, current_value_len) != 0) return SNMP_ERR_WRONGVALUE; /* mandated error string */ return MFD_SUCCESS; }