Dnia poniedziałek, 9 października 2006 18:58, ML napisał:

> So, this looks like some Windows-specific issue - I had some time to
> experiment and it not only fails to run properly using 5.3.1 "official"
> version from windows installer, but also on my own, private build built
> with MS VC++ Express 2005.
>
> Are there any easy ways to debug a binary part of a perl module (maybe
> except for poor man's debugging, i.e. printf() ;))?

Having nothing else, I tried the poor man's debug, and here's what I found 
out.
It looks like there's some strange variable visibility problem here 
(threads?). I'm not sure of the exact cause of this, because I don't know the 
architecture of Net-SNMP as a whole, but the following dirty-hacky patch 
allows the Perl module to work for us.

---8<---
--- SNMP.xs.orig        2006-10-10 18:55:47.894372444 +0200
+++ SNMP.xs     2006-10-10 19:00:19.851368694 +0200
@@ -2700,6 +2700,10 @@
 /*             u_char context_eng_id_buf[ENG_ID_BUF_SIZE]; */
           SnmpSession session = {0};
           SnmpSession *ss = NULL;
+
+          oid mySHAOID[10] = { 1, 3, 6, 1, 6, 3, 10, 1, 1, 3 };
+          oid myAESOID[10] = { 1, 3, 6, 1, 6, 3, 10, 1, 2, 4 };
+
            int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));

            __libraries_init("perl");
@@ -2742,7 +2746,7 @@
 #endif
                if (!strcmp(auth_proto, "SHA")) {
                session.securityAuthProto =
-                   snmp_duplicate_objid(usmHMACSHA1AuthProtocol,
+                   snmp_duplicate_objid(/*usmHMACSHA1AuthProtocol*/ mySHAOID,
                                         USM_AUTH_PROTO_SHA_LEN);
               session.securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN;
            } else if (!strcmp(auth_proto, "DEFAULT")) {
@@ -2792,7 +2796,7 @@
 #endif
                if (!strncmp(priv_proto, "AES", 3)) {
               session.securityPrivProto =
-                  snmp_duplicate_objid(usmAESPrivProtocol,
+                  snmp_duplicate_objid(/*usmAESPrivProtocol*/ myAESOID,
                                        USM_PRIV_PROTO_AES_LEN);
               session.securityPrivProtoLen = USM_PRIV_PROTO_AES_LEN;
            } else if (!strcmp(priv_proto, "DEFAULT")) {
---8<---

(we were only interested in SHA and AES)
Without this, usm... variables are pure garbage, and that's the reason why 
generate_Ku fails (actually, it's snmp_oid_compare() causing the fault).
This may have something to do with ActiveState's Perl - if I get this right, 
Perl is loading SNMP.dll when it needs something what SNMP.pm needs. And 
usm... variables apparently are in netsnmp.dll and they are using the very 
dll's stack (?), and they cannot be accessed from SNMP.dll (? right?).
Anyway, I'm sure that would be a very straightforward fix for you knowing how 
Net-SNMP is structured. Please keep me informed about any news.

-- 
best regards,
ML

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to