|
Hi All, I have a doubt about the below function 1. Does [ user nanoName[] = "" ] is valid user name ? 2. If not why does it is assigned it to "name" ? 3. I think if "char *name" received as NULL, Then instead of assigning to null character and looping , It will better to return like : if (name == NULL || NULL == engineID || NULL == puserList) return NULL; 4. I got a CRASH Here once while doing snmpwalk But it is very INCONSISTENT. So please varify. Thanks and Regards, Sanjay FILE: snmplib/snmpusm.c struct usmUser * usm_get_user_from_list(u_char * engineID, size_t engineIDLen, char *name, struct usmUser *puserList, int use_default) { struct usmUser *ptr; #if 0 /*Original Code*/ char noName[] = ""; if (name == NULL) name = noName; #endif #if 1 /*Modified Code*/ if (name == NULL || NULL == engineID || NULL == puserList) return NULL; #endif for (ptr = puserList; ptr != NULL; ptr = ptr->next) { if (ptr->name && !strcmp(ptr->name, name)) { DEBUGMSGTL(("usm", "match on user %s\n", ptr->name)); if (ptr->engineIDLen == engineIDLen && ((ptr->engineID == NULL && engineID == NULL) || (ptr->engineID != NULL && engineID != NULL && memcmp(ptr->engineID, engineID, engineIDLen) == 0))) return ptr; DEBUGMSGTL(("usm", "no match on engineID (")); DEBUGMSGHEX(("usm", engineID, engineID /* * return "" user used to facilitate engineID discovery */ /* Sanjay Here "" character has been taken care but even then why NEED to LOOP with "" character */ if (use_default && !strcmp(name, "")) return noNameUser; return NULL; } |
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
