Hello,

Currently it is required to add a dummy ".number" to make smux with password working. It is because there are two bugs:

- smux_parse_peer_auth() calls read_objid() with "OID PASSWORD" string, not with "OID" alone. When read_objid parses such OID - eg. "1.2.3.4.5 abc", it is able to parse 1, 2, 3 and 4 and stores such data in sa_oid/sa_oid_len, but breaks at "5 abc" and returns an error.

- smux_parse_peer_auth() does not check return code from read_objid() and does not know that such oid is reported as invalid.

Attached patch fixes this.

Best regards,

                        Krzysztof Olędzki
--- net-snmp-5.4.2.1-orig/agent/mibgroup/smux/smux.c    2008-03-21 
18:55:26.000000000 +0100
+++ net-snmp-5.4.2.1/agent/mibgroup/smux/smux.c 2009-01-02 12:37:00.000000000 
+0100
@@ -139,7 +139,7 @@
 {
     smux_peer_auth *aptr;
     char           *password_cptr;
-    int             cptr_len;
+    int            rv;
 
     if ((aptr =
          (smux_peer_auth *) calloc(1, sizeof(smux_peer_auth))) == NULL) {
@@ -151,30 +151,29 @@
        return;
     }
 
+    password_cptr = strchr(cptr, ' ');
+    if (password_cptr)
+       *(password_cptr++) = '\0';
+
     /*
      * oid 
      */
     aptr->sa_active_fd = -1;
     aptr->sa_oid_len = MAX_OID_LEN;
-    read_objid( cptr, aptr->sa_oid, &aptr->sa_oid_len );
-    DEBUGMSGTL(("smux_conf", "parsing registration for: %s\n", cptr));
+    rv = read_objid(cptr, aptr->sa_oid, &aptr->sa_oid_len);
 
-    password_cptr = strchr(cptr, ' ');
-    cptr_len = strlen(cptr);
+    if (!rv)
+       config_perror("Error parsing smux oid");
 
     if (password_cptr != NULL) {    /* Do we have a password or not? */
-        *password_cptr = 0x0;
-       if ((&password_cptr - &cptr + 1) < cptr_len) {
-           cptr = ++password_cptr;
-           DEBUGMSGTL(("smux_conf", "password is: %s\n",
-                       SNMP_STRORNULL(cptr)));
-       }
+
+       DEBUGMSGTL(("smux_conf", "password is: %s\n", 
SNMP_STRORNULL(password_cptr)));
 
         /*
          * password 
          */
-        if (cptr)
-            strcpy(aptr->sa_passwd, cptr);
+        if (*password_cptr)
+            strcpy(aptr->sa_passwd, password_cptr);
     } else {
         /*
          * null passwords OK 
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to