-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,

I've done some small work to add support for specifying wheter to use snmp 
version 1 or 2c in snmp_get and snmp_walk.

It's an optional argument that is defaulted to version 1 ( for not wrecking 
any code that is using snmp_get or walk ).

Is this the correct place to send patches for php extensions, if not could you 
point me in a direction ?.

Anyway, here is the diff:

- --- php-4.3.7.orig/ext/snmp/snmp.c    Tue Feb  3 15:44:17 2004
+++ php-4.3.7/ext/snmp/snmp.c   Tue Jun  8 10:41:00 2004
@@ -524,6 +524,7 @@
        struct snmp_session session;
        long timeout=SNMP_DEFAULT_TIMEOUT;
        long retries=SNMP_DEFAULT_RETRIES;
+       long version=SNMP_VERSION_1;
        int myargc = ZEND_NUM_ARGS();
        char type = (char) 0;
        char *value = (char *) 0;
@@ -570,6 +571,15 @@
                        convert_to_long_ex(a5);
                        retries = Z_LVAL_PP(a5);
                }
+               
+               if(myargc > 5) {
+                       convert_to_string_ex(a6);
+                       if ( strcmp(Z_STRVAL_PP(a6),"2c") == 0 ) {
+                               version = SNMP_VERSION_2c;
+                       }
+               }
+                               
+                       
        }
 
        snmp_sess_init(&session);
@@ -580,7 +590,7 @@
 
        session.peername = hostname;
        session.remote_port = remote_port;
- -     session.version = SNMP_VERSION_1;
+       session.version = version;
        /*
        * FIXME: potential memory leak
        * This is a workaround for an "artifact" (Mike Slifcak)



Cheers
Anders

- -- 
SongNetworks
[EMAIL PROTECTED]
CDTT (Certified Duct Tape Technician)

Programming today is a race between software engineers striving to build 
bigger and better idiot-proof programs, and the Universe trying to produce 
bigger and better idiots. So far, the Universe is winning. - Rich Cook
 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAyE4vi30A6pYsr0wRApwxAJsEOvea6jO/Wb8RSAfRTPxlHb6AZQCdFPNa
5f1vnejWJ68Cltl24BcSXnI=
=lsu1
-----END PGP SIGNATURE-----

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to