[PHP] IMAP patch needing testing
To those of you reading this, I'd like to submit the following patch for testing by the general public. It should add a few bug fixes to the IMAP quota system, and some new features. Unfortunately I cannot test this out, as my local machine cannot build cclient (for some unknown reason), and the IMAP server I have access to does not have quota capabilities turned on. First off this should fix a bug in the imap_get_quota, where only the last values are consider for the usage and limit. It will now return an array of arrays that looks like so: [NAME] => usage => limit [NAME2] => usage => limit ... etc ... The rest of this function works exactly the same as manual page describes. Secondly this should add the functionality of imap_get_quotaroot to PHP. As I haven't been able to get a result back, I'm not sure if the return array looks decent or not. But this should work fairly similiar to imap_get_quota, only there is no need to be the mailadmin user to view quota settings. If those of you using IMAP can test these functions out and tell me how they work, I would appriciate it. Or if you can give me access to an IMAP server with quota services, that would be just as good. This patch was made against 4.2.1, but there is no reason it shouldn't work against 4.2.2. Thanks for your time, and please cc me in any comments, I'm not subsribed to the list. >-------< Dan Kalowsky"A little less conversation, http://www.deadmime.org/~danka little more action." [EMAIL PROTECTED] - "A Little Less Conversation", [EMAIL PROTECTED] Elvis Presley Only in imap: .deps Only in imap: .libs Only in imap: Makefile Only in imap: libimap.la Only in imap: libs.mk diff -u imap-orig/php_imap.c imap/php_imap.c --- imap-orig/php_imap.cWed Apr 24 11:30:16 2002 +++ imap/php_imap.c Mon Jul 22 16:19:10 2002 @@ -22,6 +22,7 @@ | Andrew Skalski <[EMAIL PROTECTED]> | | Hartmut Holzgraefe <[EMAIL PROTECTED]>| | Jani Taskinen <[EMAIL PROTECTED]> | + | Daniel R. Kalowsky <[EMAIL PROTECTED]> | | PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> | +--+ */ @@ -132,6 +133,7 @@ #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) PHP_FE(imap_get_quota, NULL) + PHP_FE(imap_get_quotaroot, NULL) PHP_FE(imap_set_quota, NULL) PHP_FE(imap_setacl, NULL) #endif @@ -371,12 +373,22 @@ { TSRMLS_FETCH(); - /* this should only be run through once */ - for (; qlist; qlist = qlist->next) - { - IMAPG(quota_usage) = qlist->usage; - IMAPG(quota_limit) = qlist->limit; - } + IMAPG(quota_return) = qlist; + +} +/* }}} */ + +/* {{{ mail_getquotaroot + * + * Mail GET_QUOTAROOT callback + * Called via the mail_parameter function in c-client:src/c-client/mail.c + * Author DRK + */ +void mail_getquotaroot(MAILSTREAM *stream, char *mbx, STRINGLIST *qroot) +{ + TSRMLS_FETCH(); + + IMAPG(quotaroot_return) = qroot; } /* }}} */ #endif @@ -396,6 +408,10 @@ imap_globals->imap_folder_objects = NIL; imap_globals->imap_sfolder_objects = NIL; imap_globals->folderlist_style = FLIST_ARRAY; +#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) + imap_globals->quota_return = NIL; + imap_globals->quotaroot_return = NIL; +#endif } /* }}} */ @@ -1016,7 +1032,10 @@ PHP_FUNCTION(imap_get_quota) { zval **streamind, **qroot; + zval *quota_map; + char *quota_name; pils *imap_le_struct; + QUOTALIST *qlist; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &qroot) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); @@ -1037,9 +1056,63 @@ php_error(E_WARNING, "Unable to allocate array memory"); RETURN_FALSE; } - - add_assoc_long(return_value, "usage", IMAPG(quota_usage)); - add_assoc_long(return_value, "limit", IMAPG(quota_limit)); + + qlist = IMAPG(quota_return); + + for (; qlist; qlist = qlist->next) { + if (array_init(quota_map) == FAILURE) { + php_error(E_WARNING, "Unable to allocate array
[PHP-CVS] cvs: php4 /ext/imap config.m4 php_imap.c php_imap.h
kalowskySat Feb 24 20:41:19 2001 EDT Modified files: /php4/ext/imap config.m4 php_imap.c php_imap.h Log: Updating the IMAP client to include quota support via the imap c-client2000 libraries. # Y2K support is good... Removes the SA_QUOTA and SA_QUOTA_ALL defines # After speaking with Mark Crispin, it is believed these never existed. Cleans up the imap_status() function to remove notion of quotas in a status message. # There is no quota setting in a STATUS message from c-client. Changes the config.m4 to support the client.h include # This should include all the approriate headers for c-client (as defined by # c-client maintainers) such as mail.h, and rfc822.h. Changed the directory search order for the include files as well. # Place the /usr/local/include last, and searched the # /usr/local/include/{c-client|imap} directories first (PHP imap_get_quota) Added (PHP imap_set_quota) Added @- IMAP quota support (imap_set_quota, imap_get_quota) enabled/added via @ c-client2000 PR: Submitted by: Reviewed by: Obtained from: Index: php4/ext/imap/config.m4 diff -u php4/ext/imap/config.m4:1.22 php4/ext/imap/config.m4:1.23 --- php4/ext/imap/config.m4:1.22Mon Oct 2 15:16:53 2000 +++ php4/ext/imap/config.m4 Sat Feb 24 20:41:18 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.22 2000/10/02 22:16:53 rasmus Exp $ +dnl $Id: config.m4,v 1.23 2001/02/25 04:41:18 kalowsky Exp $ AC_DEFUN(IMAP_INC_CHK,[if test -r $i$1/rfc822.h; then IMAP_DIR=$i; IMAP_INC_DIR=$i$1]) @@ -41,9 +41,9 @@ if test "$PHP_IMAP" != "no"; then for i in /usr/local /usr $PHP_IMAP; do IMAP_INC_CHK() - el[]IMAP_INC_CHK(/include) - el[]IMAP_INC_CHK(/include/imap) el[]IMAP_INC_CHK(/include/c-client) + el[]IMAP_INC_CHK(/include/imap) + el[]IMAP_INC_CHK(/include) el[]IMAP_INC_CHK(/imap) el[]IMAP_INC_CHK(/c-client) fi Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.57 php4/ext/imap/php_imap.c:1.58 --- php4/ext/imap/php_imap.c:1.57 Wed Feb 21 12:33:46 2001 +++ php4/ext/imap/php_imap.cSat Feb 24 20:41:18 2001 @@ -25,7 +25,7 @@ | PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> | +--+ */ -/* $Id: php_imap.c,v 1.57 2001/02/21 20:33:46 thies Exp $ */ +/* $Id: php_imap.c,v 1.58 2001/02/25 04:41:18 kalowsky Exp $ */ #define IMAP41 @@ -101,6 +101,8 @@ PHP_FE(imap_createmailbox, NULL) PHP_FE(imap_renamemailbox, NULL) PHP_FE(imap_deletemailbox, NULL) + PHP_FE(imap_get_quota, NULL) + PHP_FE(imap_set_quota, NULL) PHP_FALIAS(imap_listmailbox, imap_list, NULL) PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL) PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL) @@ -355,6 +357,20 @@ sizeof(MESSAGELIST)); } +/* Mail GET_QUOTA callback + * Called via the mail_parameter function in c-client:src/c-client/mail.c + * Author DRK + */ +void mail_getquota(MAILSTREAM *stream, char *qroot,QUOTALIST *qlist) +{ + /* this should only be run through once */ + for (; qlist; qlist = qlist->next) + { + IMAPG(quota_usage) = qlist->usage; + IMAPG(quota_limit) = qlist->limit; + } +} + /* Mail garbage collect MESSAGELIST * Accepts: pointer to MESSAGELIST pointer * Author: CJH @@ -532,16 +548,12 @@ REGISTER_MAIN_LONG_CONSTANT("SA_UIDVALIDITY",SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); /* UID validity value */ -#ifdef SA_QUOTA - sa_all |= SA_QUOTA; -REGISTER_MAIN_LONG_CONSTANT("SA_QUOTA",SA_QUOTA , CONST_PERSISTENT | CONST_CS); + sa_all |= GET_QUOTA; +REGISTER_MAIN_LONG_CONSTANT("GET_QUOTA",GET_QUOTA , CONST_PERSISTENT | +CONST_CS); /* Disk space taken up by mailbox. */ -#endif -#ifdef SA_QUOTA_ALL - sa_all |= SA_QUOTA_ALL; -REGISTER_MAIN_LONG_CONSTANT("SA_QUOTA_ALL",SA_QUOTA_ALL , CONST_PERSISTENT | CONST_CS); + sa_all |= GET_QUOTAROOT; +REGISTER_MAIN_LONG_CONSTANT("GET_QUOTAROOT",GET_QUOTAROOT , CONST_PERSISTENT +| CONST_CS); /* Disk space taken up by all mailboxes owned by user. */ -#endif REGISTER_MAIN_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); /* get all status information */ @@ -1000,6 +1012,80 @@ /* }}} */ +/* {{{ proto array imap_get_quota(int stream_id, string qroot) + Returns the quota set to the mailbox account qroot */ +PHP_FUNCTION(imap_get_quota) +{ + zval **streamind, **qroot; + + int ind, ind_type; + pils *imap_le_struct; + + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &qroot) == +FAILURE) { + ZEND_WRONG_PARAM_COUNT(); + } + +
[PHP-CVS] cvs: php4 /ext/imap config.m4 php_imap.c php_imap.h
kalowskyMon Feb 26 07:17:12 2001 EDT Modified files: /php4/ext/imap config.m4 php_imap.c php_imap.h Log: Correctly checks for the proper header files, and excludes the QUOTA functions from non-imap2000 systems (unavailable for testing at this time). # anyone willing to test this out on non-imap2000? PR: Submitted by: Reviewed by: Sascha Schumann Obtained from: Index: php4/ext/imap/config.m4 diff -u php4/ext/imap/config.m4:1.23 php4/ext/imap/config.m4:1.24 --- php4/ext/imap/config.m4:1.23Sat Feb 24 20:41:18 2001 +++ php4/ext/imap/config.m4 Mon Feb 26 07:17:12 2001 @@ -1,6 +1,14 @@ -dnl $Id: config.m4,v 1.23 2001/02/25 04:41:18 kalowsky Exp $ +dnl $Id: config.m4,v 1.24 2001/02/26 15:17:12 kalowsky Exp $ -AC_DEFUN(IMAP_INC_CHK,[if test -r $i$1/rfc822.h; then IMAP_DIR=$i; IMAP_INC_DIR=$i$1]) +AC_DEFUN(IMAP_INC_CHK,[if test -r "$i$1/c-client.h"; then + AC_DEFINE(HAVE_IMAP2000, 1, [ ]) + IMAP_DIR=$i + IMAP_INC_DIR=$i$1 + elif test -r "$i$1/rfc822.h"; then + IMAP_DIR=$i; + IMAP_INC_DIR=$i$1 + +]) AC_DEFUN(IMAP_LIB_CHK,[ str="$IMAP_DIR/$1/lib$lib.*" Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.59 php4/ext/imap/php_imap.c:1.60 --- php4/ext/imap/php_imap.c:1.59 Sun Feb 25 22:06:58 2001 +++ php4/ext/imap/php_imap.cMon Feb 26 07:17:12 2001 @@ -25,7 +25,7 @@ | PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> | +--+ */ -/* $Id: php_imap.c,v 1.59 2001/02/26 06:06:58 andi Exp $ */ +/* $Id: php_imap.c,v 1.60 2001/02/26 15:17:12 kalowsky Exp $ */ #define IMAP41 @@ -101,8 +101,10 @@ PHP_FE(imap_createmailbox, NULL) PHP_FE(imap_renamemailbox, NULL) PHP_FE(imap_deletemailbox, NULL) +#ifdef HAVE_IMAP2000 PHP_FE(imap_get_quota, NULL) PHP_FE(imap_set_quota, NULL) +#endif PHP_FALIAS(imap_listmailbox, imap_list, NULL) PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL) PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL) @@ -357,6 +359,7 @@ sizeof(MESSAGELIST)); } +#ifdef HAVE_IMAP2000 /* Mail GET_QUOTA callback * Called via the mail_parameter function in c-client:src/c-client/mail.c * Author DRK @@ -370,6 +373,7 @@ IMAPG(quota_limit) = qlist->limit; } } +#endif /* Mail garbage collect MESSAGELIST * Accepts: pointer to MESSAGELIST pointer @@ -547,12 +551,13 @@ /* next UID to be assigned */ REGISTER_MAIN_LONG_CONSTANT("SA_UIDVALIDITY",SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); /* UID validity value */ - +#ifdef HAVE_IMAP2000 sa_all |= GET_QUOTA; REGISTER_MAIN_LONG_CONSTANT("GET_QUOTA",GET_QUOTA , CONST_PERSISTENT | CONST_CS); /* Disk space taken up by mailbox. */ sa_all |= GET_QUOTAROOT; REGISTER_MAIN_LONG_CONSTANT("GET_QUOTAROOT",GET_QUOTAROOT , CONST_PERSISTENT | CONST_CS); +#endif /* Disk space taken up by all mailboxes owned by user. */ REGISTER_MAIN_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); /* get all status information */ @@ -1011,7 +1016,7 @@ } /* }}} */ - +#ifdef HAVE_IMAP2000 /* {{{ proto array imap_get_quota(int stream_id, string qroot) Returns the quota set to the mailbox account qroot */ PHP_FUNCTION(imap_get_quota) @@ -1053,7 +1058,6 @@ } /* }}} */ - /* {{{ proto int imap_set_quota(int stream_id, string qroot, int mailbox_size) Will set the quota for qroot mailbox */ PHP_FUNCTION(imap_set_quota) @@ -1084,6 +1088,7 @@ RETURN_LONG(imap_setquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot), &limits)); } /* }}} */ +#endif /* {{{ proto int imap_expunge(int stream_id) Index: php4/ext/imap/php_imap.h diff -u php4/ext/imap/php_imap.h:1.6 php4/ext/imap/php_imap.h:1.7 --- php4/ext/imap/php_imap.h:1.6Sat Feb 24 20:41:18 2001 +++ php4/ext/imap/php_imap.hMon Feb 26 07:17:12 2001 @@ -6,12 +6,15 @@ #include "build-defs.h" #endif -/* +#ifdef HAVE_IMAP2000 + /* these are used for quota support */ + #include "c-client.h" /* includes mail.h and rfc822.h */ + #include "imap4r1.h" /* location of c-client quota functions */ +#else #include "mail.h" #include "rfc822.h" -*/ -#include "c-client.h" -#include "imap4r1.h" /* used for the imap_setquota function */ +#endif + #include "modules.h" extern zend_module_entry imap_module_entry; @@ -104,8 +107,10 @@ PHP_FUNCTION(imap_deletemailbox); PHP_FUNCTION(imap_listmailbox); PHP_FUNCTION(imap_scanmailbox); +#ifdef HAVE_IMAP2000 PHP_FUNCTION(imap_get_quota); PHP_FUNCTION(imap_set_quota); +#endif PHP_FUNCTION(imap_subscribe); PHP_FUNCTION(imap_unsubscribe); PHP_FUNCTION(imap_append); @@ -162,8 +16
[PHP-CVS] cvs: php4 / NEWS
kalowskyMon Feb 26 07:20:53 2001 EDT Modified files: /php4 NEWS Log: #Just adding in proper id (forgot to do it on the initial) PR: Submitted by: Reviewed by: Obtained from: Index: php4/NEWS diff -u php4/NEWS:1.599 php4/NEWS:1.600 --- php4/NEWS:1.599 Sun Feb 25 18:09:11 2001 +++ php4/NEWS Mon Feb 26 07:20:53 2001 @@ -3,7 +3,7 @@ ?? ??? 200?, Version 4.0.5 - IMAP quota support (imap_set_quota, imap_get_quota) enabled/added via - c-client2000 + c-client2000 (kalowsky) - Upgraded PCRE to version 3.4. (Andrei) - Added array_search which works similar to in_array but returns the key instead of a boolean. ([EMAIL PROTECTED]) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
kalowskyMon Feb 26 08:36:08 2001 EDT Modified files: /php4/ext/imap php_imap.c Log: # Bad patch job on the last commit by me. I take the BAD_CODER award for # the day. Removes two unnecessary REGISTER_MAIN_LONG_CONSTANT's. # what should be done about the PHP_MINFO_FUNCTION Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.60 php4/ext/imap/php_imap.c:1.61 --- php4/ext/imap/php_imap.c:1.60 Mon Feb 26 07:17:12 2001 +++ php4/ext/imap/php_imap.cMon Feb 26 08:36:08 2001 @@ -25,7 +25,7 @@ | PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> | +--+ */ -/* $Id: php_imap.c,v 1.60 2001/02/26 15:17:12 kalowsky Exp $ */ +/* $Id: php_imap.c,v 1.61 2001/02/26 16:36:08 kalowsky Exp $ */ #define IMAP41 @@ -551,14 +551,6 @@ /* next UID to be assigned */ REGISTER_MAIN_LONG_CONSTANT("SA_UIDVALIDITY",SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); /* UID validity value */ -#ifdef HAVE_IMAP2000 - sa_all |= GET_QUOTA; -REGISTER_MAIN_LONG_CONSTANT("GET_QUOTA",GET_QUOTA , CONST_PERSISTENT | CONST_CS); - /* Disk space taken up by mailbox. */ - sa_all |= GET_QUOTAROOT; -REGISTER_MAIN_LONG_CONSTANT("GET_QUOTAROOT",GET_QUOTAROOT , CONST_PERSISTENT | CONST_CS); -#endif - /* Disk space taken up by all mailboxes owned by user. */ REGISTER_MAIN_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); /* get all status information */ @@ -1042,12 +1034,13 @@ /* set the callback for the GET_QUOTA function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); - if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) { php_error(E_WARNING, "c-client imap_getquota failed"); RETURN_FALSE; } + /* MAKE_STD_ZVAL(quota_array); */ + /* if (array_init(quota_array) != SUCCESS) { */ if (array_init(return_value) == FAILURE) { php_error(E_WARNING, "Unable to allocate array memory"); RETURN_FALSE; @@ -1058,6 +1051,7 @@ } /* }}} */ + /* {{{ proto int imap_set_quota(int stream_id, string qroot, int mailbox_size) Will set the quota for qroot mailbox */ PHP_FUNCTION(imap_set_quota) @@ -1085,7 +1079,7 @@ php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - RETURN_LONG(imap_setquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot), &limits)); + RETURN_LONG(imap_setquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot), +&limits)); } /* }}} */ #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/imap CREDITS
kalowskyTue Feb 27 17:02:48 2001 EDT Modified files: /php4/ext/imap CREDITS Log: #adding name to credits. nothing to see here, keep moving. PR: Submitted by: Reviewed by: Obtained from: Index: php4/ext/imap/CREDITS diff -u php4/ext/imap/CREDITS:1.1 php4/ext/imap/CREDITS:1.2 --- php4/ext/imap/CREDITS:1.1 Mon Nov 20 02:31:24 2000 +++ php4/ext/imap/CREDITS Tue Feb 27 17:02:48 2001 @@ -1,2 +1,2 @@ IMAP -Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch +Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus +Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4(PHP_4_0_5) /ext/imap php_imap.c
kalowskyFri Mar 16 05:24:06 2001 EDT Modified files: (Branch: PHP_4_0_5) /php4/ext/imap php_imap.c Log: This is to correct bug #9762, patch submitted by Bug reporter. Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.62 php4/ext/imap/php_imap.c:1.62.2.1 --- php4/ext/imap/php_imap.c:1.62 Wed Feb 28 23:06:54 2001 +++ php4/ext/imap/php_imap.cFri Mar 16 05:24:06 2001 @@ -22,10 +22,11 @@ | Andrew Skalski <[EMAIL PROTECTED]> | | Hartmut Holzgraefe <[EMAIL PROTECTED]>| | Jani Taskinen <[EMAIL PROTECTED]> | + | Daniel R Kalowsky <[EMAIL PROTECTED]> | | PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> | +--+ */ -/* $Id: php_imap.c,v 1.62 2001/03/01 07:06:54 chagenbu Exp $ */ +/* $Id: php_imap.c,v 1.62.2.1 2001/03/16 13:24:06 kalowsky Exp $ */ #define IMAP41 @@ -366,6 +367,8 @@ */ void mail_getquota(MAILSTREAM *stream, char *qroot,QUOTALIST *qlist) { + IMAPLS_FETCH(); + /* this should only be run through once */ for (; qlist; qlist = qlist->next) { @@ -1021,6 +1024,8 @@ int ind, ind_type; pils *imap_le_struct; + + IMAPLS_FETCH(); if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &qroot) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/odbc php_odbc.c
kalowskyMon Apr 16 19:02:36 2001 EDT Modified files: /php4/ext/odbc php_odbc.c Log: This change seems to fix bugs 7158, 7807, 8531, and 8636. After asking why this patch was applied no one seemed to respond with anything useful. If you find this change in error, sorry, I tested it on as many systems as I could. Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.77 php4/ext/odbc/php_odbc.c:1.78 --- php4/ext/odbc/php_odbc.c:1.77 Tue Apr 10 09:26:27 2001 +++ php4/ext/odbc/php_odbc.cMon Apr 16 19:02:36 2001 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.77 2001/04/10 16:26:27 kevin Exp $ */ +/* $Id: php_odbc.c,v 1.78 2001/04/17 02:02:36 kalowsky Exp $ */ #include "php.h" #include "php_globals.h" @@ -2435,11 +2435,7 @@ ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); -#ifndef HAVE_DBMAKER - if ((*pv_onoff)) { -#else if (pv_onoff && (*pv_onoff)) { -#endif convert_to_long_ex(pv_onoff); rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, ((*pv_onoff)->value.lval) ? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-CVS] cvs: php4 /ext/odbc php_odbc.c
> This should be breaking something, no? > > Either way an "if" statement is started therefore it needs to be finished. it's there, it's just the next line down (didn't make it into the cvs diff as i didn't change it) honest! it should be seen in the file as: rc = SQLSetConnectOption(conn->hdbc, SQLAUTOCOMMIT, ((*pv_onoff)->value.lval) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF); >-------< Dan Kalowsky http://www.deadmime.org/~dank DEADmime INTERnational, http://www.deadmime.org Project Lead -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/odbc php_odbc.c
kalowskyWed Apr 18 19:31:23 2001 EDT Modified files: /php4/ext/odbc php_odbc.c Log: corrects bug #7488, patch supplied by submitter ([EMAIL PROTECTED]). quick local tests show it to work. Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.78 php4/ext/odbc/php_odbc.c:1.79 --- php4/ext/odbc/php_odbc.c:1.78 Mon Apr 16 19:02:36 2001 +++ php4/ext/odbc/php_odbc.cWed Apr 18 19:31:23 2001 @@ -15,11 +15,12 @@ | Authors: Stig Sæther Bakken <[EMAIL PROTECTED]>| | Andreas Karajannis <[EMAIL PROTECTED]> | | Frank M. Kromann <[EMAIL PROTECTED]> Support for DB/2 CLI | - | Kevin N. Shallow <[EMAIL PROTECTED]> Velocis Support | + | Kevin N. Shallow <[EMAIL PROTECTED]> Velocis Support | + | Daniel R. Kalowsky <[EMAIL PROTECTED]> + | +--+ */ -/* $Id: php_odbc.c,v 1.78 2001/04/17 02:02:36 kalowsky Exp $ */ +/* $Id: php_odbc.c,v 1.79 2001/04/19 02:31:23 kalowsky Exp $ */ #include "php.h" #include "php_globals.h" @@ -64,7 +65,7 @@ #define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0)) -static unsigned char a3_arg3_force_ref[] = { 3, BYREF_NONE, BYREF_ALLOW, BYREF_FORCE }; +static unsigned char a3_arg3_and_3_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, +BYREF_FORCE }; function_entry odbc_functions[] = { PHP_FE(odbc_error, NULL) @@ -85,7 +86,7 @@ PHP_FE(odbc_prepare, NULL) PHP_FE(odbc_execute, NULL) PHP_FE(odbc_fetch_row, NULL) - PHP_FE(odbc_fetch_into, a3_arg3_force_ref) + PHP_FE(odbc_fetch_into, a3_arg3_and_3_force_ref) PHP_FE(odbc_field_len, NULL) PHP_FE(odbc_field_scale, NULL) PHP_FE(odbc_field_name, NULL) @@ -1363,7 +1364,8 @@ break; case 3: if (zend_get_parameters_ex(3, &pv_res, &pv_row, &pv_res_arr) == FAILURE) - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; + SEPARATE_ZVAL(pv_row); convert_to_long_ex(pv_row); rownum = (*pv_row)->value.lval; break; @@ -1380,11 +1382,6 @@ WRONG_PARAM_COUNT; } #endif - - if (!ParameterPassedByReference(ht, numArgs)) { - php_error(E_WARNING, "Array not passed by reference in call to odbc_fetch_into()"); - RETURN_FALSE; - } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); @@ -1922,7 +1919,11 @@ return FALSE; } } -#ifdef HAVE_EMPRESS +/* Possible fix for bug # + * Needs testing on UnixODBC < 2.0.5 though. + * #if defined(HAVE_EMPRESS) || defined(HAVE_UNIXODBC) + * Uncomment the line above, and comment line below to fully test */ +#ifdef HAVE_EMPRESS { int direct = 0; chardsnbuf[300]; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/odbc php_odbc.c
kalowskyThu Apr 19 12:55:05 2001 EDT Modified files: /php4/ext/odbc php_odbc.c Log: appling patch for joey since he has no ODBC karma. this is for bug #10252 Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.80 php4/ext/odbc/php_odbc.c:1.81 --- php4/ext/odbc/php_odbc.c:1.80 Wed Apr 18 21:16:27 2001 +++ php4/ext/odbc/php_odbc.cThu Apr 19 12:55:05 2001 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.80 2001/04/19 04:16:27 andi Exp $ */ +/* $Id: php_odbc.c,v 1.81 2001/04/19 19:55:05 kalowsky Exp $ */ #include "php.h" #include "php_globals.h" @@ -1929,6 +1929,7 @@ chardsnbuf[300]; short dsnbuflen; char*ldb = 0; + int ldb_len = 0; if (strstr((char*)db, ";")) { direct = 1; @@ -1937,8 +1938,9 @@ ldb = (char*)emalloc(strlen(db) + strlen(uid) + strlen(pwd) + 12); sprintf(ldb, "%s;UID=%s;PWD=%s", db, uid, pwd); } else { - ldb = (char*)emalloc(strlen(db) + 1); - strcat(ldb, db); + ldb_len = (strlen(db)+1); + ldb = (char*)emalloc(ldb_len); + strlcpy(ldb, db, ldb_len); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/odbc php_odbc.c
kalowskyTue Mar 27 06:17:53 2001 EDT Modified files: /php4/ext/odbc php_odbc.c Log: Fix for Bug #9272, as submitted by marc boeren ([EMAIL PROTECTED]). Applied by me, due to apparently a lack of cvs access to ext/odbc for him. Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.73 php4/ext/odbc/php_odbc.c:1.74 --- php4/ext/odbc/php_odbc.c:1.73 Fri Mar 9 15:44:55 2001 +++ php4/ext/odbc/php_odbc.cTue Mar 27 06:17:52 2001 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.73 2001/03/09 23:44:55 fmk Exp $ */ +/* $Id: php_odbc.c,v 1.74 2001/03/27 14:17:52 kalowsky Exp $ */ #include "php.h" #include "php_globals.h" @@ -2157,15 +2157,15 @@ int i; int type; int is_pconn = 0; + int found_resource_type = le_conn; ODBCLS_FETCH(); if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) { WRONG_PARAM_COUNT; } - conn = (odbc_connection *) zend_fetch_resource(pv_conn, -1, "ODBC-Link", NULL, 1, le_conn); - if(!conn){ - ZEND_FETCH_RESOURCE(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_pconn); + conn = (odbc_connection *) zend_fetch_resource(pv_conn, -1, "ODBC-Link", +found_resource_type, 2, le_conn, le_pconn); + if (found_resource_type==le_pconn) { is_pconn = 1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/odbc php_odbc.c
kalowskyTue Mar 27 07:46:27 2001 EDT Modified files: /php4/ext/odbc php_odbc.c Log: The last fix was missing a &, Marc Boeren either made the patch wrong, or I applied it improperly. Anyways, Sebastian Bergmann discovered it, and supposedly is fixed with this. Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.74 php4/ext/odbc/php_odbc.c:1.75 --- php4/ext/odbc/php_odbc.c:1.74 Tue Mar 27 06:17:52 2001 +++ php4/ext/odbc/php_odbc.cTue Mar 27 07:46:27 2001 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.74 2001/03/27 14:17:52 kalowsky Exp $ */ +/* $Id: php_odbc.c,v 1.75 2001/03/27 15:46:27 kalowsky Exp $ */ #include "php.h" #include "php_globals.h" @@ -2164,7 +2164,7 @@ WRONG_PARAM_COUNT; } - conn = (odbc_connection *) zend_fetch_resource(pv_conn, -1, "ODBC-Link", found_resource_type, 2, le_conn, le_pconn); + conn = (odbc_connection *) zend_fetch_resource(pv_conn, -1, "ODBC-Link", +&found_resource_type, 2, le_conn, le_pconn); if (found_resource_type==le_pconn) { is_pconn = 1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]