Juan Lang : inetmib1: Improve SnmpExtensionQuery stub.
Alexandre Julliard
julliard at winehq.org
Wed Jun 25 04:47:29 CDT 2008
Module: wine
Branch: master
Commit: 50f4bd16f68147b743f92a7eb79485e0d1fd3c3e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=50f4bd16f68147b743f92a7eb79485e0d1fd3c3e
Author: Juan Lang <juan.lang at gmail.com>
Date: Tue May 20 20:50:45 2008 -0700
inetmib1: Improve SnmpExtensionQuery stub.
---
dlls/inetmib1/main.c | 22 ++++++++++++++++++++--
dlls/inetmib1/tests/main.c | 10 ++--------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c
index 7e7450b..c74d6ad 100644
--- a/dlls/inetmib1/main.c
+++ b/dlls/inetmib1/main.c
@@ -47,6 +47,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
+static UINT mib2[] = { 1,3,6,1,2,1 };
static UINT mib2System[] = { 1,3,6,1,2,1,1 };
BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
@@ -65,7 +66,24 @@ BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
BOOL WINAPI SnmpExtensionQuery(BYTE bPduType, SnmpVarBindList *pVarBindList,
AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
{
- FIXME("(0x%02x, %p, %p, %p): stub\n", bPduType, pVarBindList,
+ AsnObjectIdentifier mib2oid = DEFINE_OID(mib2);
+ AsnInteger32 error = SNMP_ERRORSTATUS_NOERROR, errorIndex = 0;
+ UINT i;
+
+ TRACE("(0x%02x, %p, %p, %p)\n", bPduType, pVarBindList,
pErrorStatus, pErrorIndex);
- return FALSE;
+
+ for (i = 0; !error && i < pVarBindList->len; i++)
+ {
+ /* Ignore any OIDs not in MIB2 */
+ if (!SnmpUtilOidNCmp(&pVarBindList->list[i].name, &mib2oid,
+ mib2oid.idLength))
+ {
+ FIXME("%s: stub\n", SnmpUtilOidToA(&pVarBindList->list[i].name));
+ error = SNMP_ERRORSTATUS_NOSUCHNAME;
+ }
+ }
+ *pErrorStatus = error;
+ *pErrorIndex = errorIndex;
+ return TRUE;
}
diff --git a/dlls/inetmib1/tests/main.c b/dlls/inetmib1/tests/main.c
index b9eac11..8667995 100644
--- a/dlls/inetmib1/tests/main.c
+++ b/dlls/inetmib1/tests/main.c
@@ -81,12 +81,10 @@ static void testQuery(void)
error = 0xdeadbeef;
index = 0xdeadbeef;
ret = pQuery(SNMP_PDU_GET, &list, &error, &index);
- todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
ok(error == SNMP_ERRORSTATUS_NOERROR,
"expected SNMP_ERRORSTATUS_NOERROR, got %d\n", error);
ok(index == 0, "expected index 0, got %d\n", index);
- }
/* Oddly enough, this "succeeds," even though the OID is clearly
* unsupported.
@@ -100,12 +98,10 @@ static void testQuery(void)
error = 0xdeadbeef;
index = 0xdeadbeef;
ret = pQuery(SNMP_PDU_GET, &list, &error, &index);
- todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
ok(error == SNMP_ERRORSTATUS_NOERROR,
"expected SNMP_ERRORSTATUS_NOERROR, got %d\n", error);
ok(index == 0, "expected index 0, got %d\n", index);
- }
/* The OID isn't changed either: */
ok(!strcmp("1.2.3.4", SnmpUtilOidToA(&vars[0].name)),
"expected 1.2.3.4, got %s\n", SnmpUtilOidToA(&vars[0].name));
@@ -117,13 +113,12 @@ static void testQuery(void)
error = 0xdeadbeef;
index = 0xdeadbeef;
ret = pQuery(SNMP_PDU_GET, &list, &error, &index);
- todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
ok(error == SNMP_ERRORSTATUS_NOSUCHNAME,
"expected SNMP_ERRORSTATUS_NOSUCHNAME, got %d\n", error);
/* The index is 1-based rather than 0-based */
+ todo_wine
ok(index == 1, "expected index 1, got %d\n", index);
- }
/* Even though SnmpExtensionInit says this DLL supports the MIB2 system
* variables, the first variable it returns a value for is the first
@@ -137,12 +132,11 @@ static void testQuery(void)
list.list = vars2;
moreData = TRUE;
ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
- todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
+ todo_wine
ok(error == SNMP_ERRORSTATUS_NOERROR,
"expected SNMP_ERRORSTATUS_NOERROR, got %d\n", error);
ok(index == 0, "expected index 0, got %d\n", index);
- }
vars[0].name.idLength = sizeof(mib2If) / sizeof(mib2If[0]);
vars[0].name.ids = mib2If;
todo_wine
More information about the wine-cvs
mailing list