SNMP: fix insertion of first entry in SNMP Users UAT
when using the GUI to add the first entry, num_ueas is still 0. Change-Id: Iea03495a2e5e39b71391a01454aec5fb6e2b05eb Reviewed-on: https://code.wireshark.org/review/20191 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
parent
1089211c0b
commit
52ce1b03e0
|
@ -1369,35 +1369,31 @@ snmp_users_update_cb(void* p _U_, char** err)
|
|||
|
||||
*err = NULL;
|
||||
|
||||
if (num_ueas == 0)
|
||||
/* Nothing to update */
|
||||
return FALSE;
|
||||
|
||||
if (! ue->user.userName.len)
|
||||
if (! ue->user.userName.len) {
|
||||
g_string_append_printf(es,"no userName\n");
|
||||
|
||||
for (i=0; i<num_ueas-1; i++) {
|
||||
snmp_ue_assoc_t* u = &(ueas[i]);
|
||||
|
||||
} else if ((ue->engine.len > 0) && (ue->engine.len < 5 || ue->engine.len > 32)) {
|
||||
/* RFC 3411 section 5 */
|
||||
if ((u->engine.len > 0) && (u->engine.len < 5 || u->engine.len > 32)) {
|
||||
g_string_append_printf(es, "Invalid engineId length (%u). Must be between 5 and 32 (10 and 64 hex digits)\n", u->engine.len);
|
||||
}
|
||||
g_string_append_printf(es, "Invalid engineId length (%u). Must be between 5 and 32 (10 and 64 hex digits)\n", ue->engine.len);
|
||||
} else if (num_ueas) {
|
||||
for (i=0; i<num_ueas-1; i++) {
|
||||
snmp_ue_assoc_t* u = &(ueas[i]);
|
||||
|
||||
if ( u->user.userName.len == ue->user.userName.len
|
||||
&& u->engine.len == ue->engine.len && (u != ue)) {
|
||||
|
||||
if ( u->user.userName.len == ue->user.userName.len
|
||||
&& u->engine.len == ue->engine.len && (u != ue)) {
|
||||
|
||||
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
/* XXX: make a string for the engineId */
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s')\n",ue->user.userName.data);
|
||||
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
/* XXX: make a string for the engineId */
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s')\n",ue->user.userName.data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (u->engine.len == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
|
||||
if (u->engine.len == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1471,35 +1471,31 @@ snmp_users_update_cb(void* p _U_, char** err)
|
|||
|
||||
*err = NULL;
|
||||
|
||||
if (num_ueas == 0)
|
||||
/* Nothing to update */
|
||||
return FALSE;
|
||||
|
||||
if (! ue->user.userName.len)
|
||||
if (! ue->user.userName.len) {
|
||||
g_string_append_printf(es,"no userName\n");
|
||||
|
||||
for (i=0; i<num_ueas-1; i++) {
|
||||
snmp_ue_assoc_t* u = &(ueas[i]);
|
||||
|
||||
} else if ((ue->engine.len > 0) && (ue->engine.len < 5 || ue->engine.len > 32)) {
|
||||
/* RFC 3411 section 5 */
|
||||
if ((u->engine.len > 0) && (u->engine.len < 5 || u->engine.len > 32)) {
|
||||
g_string_append_printf(es, "Invalid engineId length (%u). Must be between 5 and 32 (10 and 64 hex digits)\n", u->engine.len);
|
||||
}
|
||||
g_string_append_printf(es, "Invalid engineId length (%u). Must be between 5 and 32 (10 and 64 hex digits)\n", ue->engine.len);
|
||||
} else if (num_ueas) {
|
||||
for (i=0; i<num_ueas-1; i++) {
|
||||
snmp_ue_assoc_t* u = &(ueas[i]);
|
||||
|
||||
if ( u->user.userName.len == ue->user.userName.len
|
||||
&& u->engine.len == ue->engine.len && (u != ue)) {
|
||||
|
||||
if ( u->user.userName.len == ue->user.userName.len
|
||||
&& u->engine.len == ue->engine.len && (u != ue)) {
|
||||
|
||||
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
/* XXX: make a string for the engineId */
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s')\n",ue->user.userName.data);
|
||||
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
/* XXX: make a string for the engineId */
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s')\n",ue->user.userName.data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (u->engine.len == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
|
||||
if (u->engine.len == 0) {
|
||||
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
|
||||
g_string_append_printf(es,"Duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3051,7 +3047,7 @@ static int dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, prot
|
|||
|
||||
|
||||
/*--- End of included file: packet-snmp-fn.c ---*/
|
||||
#line 1846 "./asn1/snmp/packet-snmp-template.c"
|
||||
#line 1842 "./asn1/snmp/packet-snmp-template.c"
|
||||
|
||||
|
||||
guint
|
||||
|
@ -3868,7 +3864,7 @@ void proto_register_snmp(void) {
|
|||
NULL, HFILL }},
|
||||
|
||||
/*--- End of included file: packet-snmp-hfarr.c ---*/
|
||||
#line 2398 "./asn1/snmp/packet-snmp-template.c"
|
||||
#line 2394 "./asn1/snmp/packet-snmp-template.c"
|
||||
};
|
||||
|
||||
/* List of subtrees */
|
||||
|
@ -3908,7 +3904,7 @@ void proto_register_snmp(void) {
|
|||
&ett_snmp_RReqPDU_U,
|
||||
|
||||
/*--- End of included file: packet-snmp-ettarr.c ---*/
|
||||
#line 2414 "./asn1/snmp/packet-snmp-template.c"
|
||||
#line 2410 "./asn1/snmp/packet-snmp-template.c"
|
||||
};
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_snmp_failed_decrypted_data_pdu, { "snmp.failed_decrypted_data_pdu", PI_MALFORMED, PI_WARN, "Failed to decrypt encryptedPDU", EXPFILL }},
|
||||
|
|
Loading…
Reference in New Issue