Re: SNMP on 64bit platform

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 15/04/2008, Taymour A. El Erian <[email protected]> wrote:
>  I have printed the password in the log and it is printed ok but the len
>  is always 0.

Please read my reply.
I have just explained that 'len' is the length of the incoming SMUX
packet waiting to be processed.   It is *NOT* the length of the password.

   If the password is the last element (or the last element of this chunk),
then yes - len will always be 0.


>       I went and modified the code of smux_auth_peer to just
>  return 1 and of course this made the authentication succeed. I guess the
>  problem actually is in the string comparison in this function.

It's most likely in the list of OIDs and passwords that are being checked.

> Please  help as am not so familiar with snmp programming.

There's nothing particularly specific to SNMP about this bit.
It's simply a matter of checking exactly what is being compared.
Please find attached a patch (completely untested!), which ought
to provide some useful debugging information.

Dave

PS:  Please could you fix your mail system.
        It seemed to reject my earlier response as "unsolicited"!

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
smux.patch (text/x-patch, 1.4 KB)
Index: smux/smux.c
===================================================================
--- smux/smux.c	(revision 16884)
+++ smux/smux.c	(working copy)
@@ -922,10 +922,31 @@
 smux_auth_peer(oid * name, size_t namelen, char *passwd, int fd)
 {
     int             i;
+    oid             oid_name[MAX_OID_LEN];
+    char            passwd[SMUXMAXSTRLEN];
+    char            oid_print[SMUXMAXSTRLEN];
+    size_t          oid_name_len, string_len;
 
+
+    if (snmp_get_do_debugging()) {
+        snprint_objid(oid_print, sizeof(oid_print), name, namelen);
+        DEBUGMSGTL(("smux", "[smux_auth_peer] Authorizing: %s, %s\n",
+                    oid_print, passwd));
+    }
+
     for (i = 0; i < nauths; i++) {
+        if (snmp_get_do_debugging()) {
+            snprint_objid(oid_print, sizeof(oid_print),
+                          Auths[i]->sa_oid, Auths[i]->sa_oid_len);
+            DEBUGMSGTL(("smux", "[smux_auth_peer] Checking OID: %s (%d)\n",
+                    oid_print, i));
+        }
         if (snmp_oid_compare(Auths[i]->sa_oid, Auths[i]->sa_oid_len,
                              name, namelen) == 0) {
+            if (snmp_get_do_debugging()) {
+                DEBUGMSGTL(("smux", "[smux_auth_peer] Checking P/W: %s (%d)\n",
+                        Auths[i]->sa_passwd, Auths[i]->sa_active_fd));
+            }
             if (!(strcmp(Auths[i]->sa_passwd, passwd)) &&
                 (Auths[i]->sa_active_fd == -1)) {
                 /*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.