diff options
author | skv <skv@FreeBSD.org> | 2005-03-15 01:58:17 +0800 |
---|---|---|
committer | skv <skv@FreeBSD.org> | 2005-03-15 01:58:17 +0800 |
commit | 12f8280eaff203d49e566db5e6a46364e939e06d (patch) | |
tree | b6fb7dbf0a81683612a3c564237c5ee4de9400e1 /databases | |
parent | 908ed215f7b4b7d4a5bac9538aa34b923380ea8b (diff) | |
download | freebsd-ports-gnome-12f8280eaff203d49e566db5e6a46364e939e06d.tar.gz freebsd-ports-gnome-12f8280eaff203d49e566db5e6a46364e939e06d.tar.zst freebsd-ports-gnome-12f8280eaff203d49e566db5e6a46364e939e06d.zip |
Import latest changes from project's repository:
* better error handling for blobs
* prevent a possible buffer overflow in date handling
* don't accept blob bind param for SELECT statement
* remove pointless 'ib_cursorname' attribute. DBD does it automatically
Also switch MASTER_SITE to use SourceForge (by mystical reason this module
was disappeared from CPAN).
Diffstat (limited to 'databases')
-rw-r--r-- | databases/p5-DBD-InterBase/Makefile | 5 | ||||
-rw-r--r-- | databases/p5-DBD-InterBase/files/patch-dbdimp.c | 162 | ||||
-rw-r--r-- | databases/p5-DBD-InterBase/files/patch-dbdimp.h | 18 | ||||
-rw-r--r-- | databases/p5-DBD-InterBase/pkg-descr | 3 |
4 files changed, 171 insertions, 17 deletions
diff --git a/databases/p5-DBD-InterBase/Makefile b/databases/p5-DBD-InterBase/Makefile index a7e013a3c644..80fc48c3164e 100644 --- a/databases/p5-DBD-InterBase/Makefile +++ b/databases/p5-DBD-InterBase/Makefile @@ -7,9 +7,10 @@ PORTNAME= DBD-InterBase PORTVERSION= 0.43 +PORTREVISION= 1 CATEGORIES= databases perl5 -MASTER_SITES= ${MASTER_SITE_PERL_CPAN} -MASTER_SITE_SUBDIR= DBD +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= dbi-interbase PKGNAMEPREFIX= p5- MAINTAINER= skv@FreeBSD.org diff --git a/databases/p5-DBD-InterBase/files/patch-dbdimp.c b/databases/p5-DBD-InterBase/files/patch-dbdimp.c index bcbe93e2b2d9..81b372f60d10 100644 --- a/databases/p5-DBD-InterBase/files/patch-dbdimp.c +++ b/databases/p5-DBD-InterBase/files/patch-dbdimp.c @@ -1,13 +1,109 @@ ---- dbdimp.c 2004/02/25 04:38:03 1.105 -+++ dbdimp.c 2004/03/03 11:26:48 1.106 -@@ -1,5 +1,5 @@ - /* -- $Id: dbdimp.c,v 1.105 2004/02/25 04:38:03 edpratomo Exp $ -+ $Id: dbdimp.c,v 1.106 2004/03/03 11:26:48 edpratomo Exp $ - - Copyright (c) 1999-2004 Edwin Pratomo - Portions Copyright (c) 2001-2003 Daniel Ritz -@@ -2185,7 +2185,7 @@ +--- dbdimp.c.old Wed Feb 25 07:38:03 2004 ++++ dbdimp.c Mon Mar 14 20:23:19 2005 +@@ -1002,9 +1002,6 @@ + { + D_imp_dbh_from_sth; + ISC_STATUS status[ISC_STATUS_LENGTH]; +- char stmt_info[1], count_info[1]; +- char info_buffer[20], count_buffer[33]; +- char *p; + int result = -2; + int row_count = 0; + +@@ -1543,7 +1540,10 @@ + blob_info_buffer); + + if (ib_error_check(sth, status)) ++ { ++ isc_cancel_blob(status, &blob_handle); + return FALSE; ++ } + + /* Get the information out of the info buffer. */ + for (p = blob_info_buffer; *p != isc_info_end; ) +@@ -1590,7 +1590,7 @@ + if ((DBIc_LongReadLen(imp_sth) < (unsigned long) total_length) && + (! DBIc_is(imp_dbh, DBIcf_LongTruncOk))) + { +- isc_cancel_blob(status, &blob_handle); ++ isc_close_blob(status, &blob_handle); + do_error(sth, 1, "Not enough LongReadLen buffer."); + return FALSE; + break; +@@ -1603,7 +1603,7 @@ + sv_setpvn(sv, "** Blob exceeds maximum safe length **", 38); + + /* I deliberately don't set FAILURE based on this. */ +- isc_cancel_blob(status, &blob_handle); ++ isc_close_blob(status, &blob_handle); + if (ib_error_check(sth, status)) + return FALSE; + break; +@@ -1620,12 +1620,15 @@ + (short) BLOB_SEGMENT, + blob_segment_buffer); + ++ if (status[1] == isc_segstr_eof) ++ break; ++ + if (status[1] != isc_segment) + if (ib_error_check(sth, status)) ++ { ++ isc_cancel_blob(status, &blob_handle); + return FALSE; +- +- if (status[1] == isc_segstr_eof) +- break; ++ } + + if (seg_length > DBIc_LongReadLen(imp_sth)) + break; +@@ -1744,11 +1747,7 @@ + DBI_TRACE(2, (DBILOGFP, "dbd_st_destroy\n")); + + /* freeing cursor name */ +- if (imp_sth->cursor_name != NULL) +- { +- safefree(imp_sth->cursor_name); +- imp_sth->cursor_name = NULL; +- } ++ FREE_SETNULL(imp_sth->cursor_name); + + /* freeing in_sqlda */ + if (imp_sth->in_sqlda) +@@ -1955,31 +1954,6 @@ + + DBI_TRACE(2, (DBILOGFP, "dbd_st_STORE - %s\n", key)); + +- if ((kl == 13) && (strcmp(key, "ib_cursorname") == 0)) +- { +- if (DBIc_ACTIVE(imp_sth)) +- { +- do_error(sth, 1, "Can't modify active statement cursor name."); +- return FALSE; +- } +- else +- { +- STRLEN vl; +- char *value = SvPV(valuesv, vl); +- +- if (imp_sth->cursor_name != NULL) +- { +- safefree(imp_sth->cursor_name); +- imp_sth->cursor_name = NULL; +- } +- imp_sth->cursor_name = (char *)safemalloc(vl + 1); +- +- if (imp_sth->cursor_name != NULL) +- strcpy(imp_sth->cursor_name, value); +- else +- return FALSE; +- } +- } + return FALSE; + } + +@@ -2185,7 +2159,7 @@ DBI_TRACE(1, (DBILOGFP, "ib_fill_isqlda: SQL_VARYING\n")); { char buf[25]; /* long long can have max 20 chars. */ @@ -16,7 +112,7 @@ if (ivar->sqldata == (char *) NULL) { if ((ivar->sqldata = (char *)safemalloc( -@@ -2204,7 +2204,7 @@ +@@ -2204,7 +2178,7 @@ tmp = buf; len = sprintf(tmp, "%ld", SvNV(value)); } @@ -25,7 +121,15 @@ len = SvCUR(value); tmp = SvPV_nolen(value); } -@@ -2261,7 +2261,7 @@ +@@ -2249,7 +2223,6 @@ + { + do_error(sth, 2, "Cannot allocate buffer for TEXT input parameter \n"); + retval = FALSE; +- safefree(tmp); + break; + } + } +@@ -2261,7 +2234,7 @@ tmp = buf; len = sprintf(tmp, "%ld", SvNV(value)); } @@ -34,3 +138,37 @@ len = SvCUR(value); tmp = SvPV_nolen(value); } +@@ -2579,6 +2552,12 @@ + + ivar->sqltype = SQL_TEXT | (ivar->sqltype & 1); + ++ /* prevent overflow */ ++ if (len > 100) { ++ do_error(sth, 2, "DATE input parameter too long, but will try...\n"); ++ len = 100; ++ } ++ + /* workaround for date problem (bug #429820) */ + ivar->sqlsubtype = 0x77; /* (0x77 is a random value) */ + +@@ -2696,8 +2675,18 @@ + case SQL_BLOB: + DBI_TRACE(1, (DBILOGFP, "ib_fill_isqlda: SQL_BLOB\n")); + +- /* we have an extra function for this */ +- retval = ib_blob_write(sth, imp_sth, ivar, value); ++ /* SELECT's can't have a blob as in_sqlda. */ ++ if ((imp_sth->type == isc_info_sql_stmt_select) || ++ (imp_sth->type == isc_info_sql_stmt_select_for_upd)) ++ { ++ do_error(sth, 2, "BLOB as an input param for SELECT is not allowed.\n"); ++ retval = FALSE; ++ break; ++ } ++ else ++ /* we have an extra function for this */ ++ retval = ib_blob_write(sth, imp_sth, ivar, value); ++ + break; + + /**********************************************************************/ diff --git a/databases/p5-DBD-InterBase/files/patch-dbdimp.h b/databases/p5-DBD-InterBase/files/patch-dbdimp.h new file mode 100644 index 000000000000..e183678d89bf --- /dev/null +++ b/databases/p5-DBD-InterBase/files/patch-dbdimp.h @@ -0,0 +1,18 @@ +--- dbdimp.h.old Tue Feb 24 10:49:01 2004 ++++ dbdimp.h Mon Mar 14 20:22:52 2005 +@@ -252,6 +252,7 @@ + #define dbd_init ib_init + #define dbd_discon_all ib_discon_all + #define dbd_db_login ib_db_login ++#define dbd_db_login6 ib_db_login6 + #define dbd_db_do ib_db_do + #define dbd_db_commit ib_db_commit + #define dbd_db_rollback ib_db_rollback +@@ -283,6 +284,7 @@ + int ib_commit_transaction (SV *h, imp_dbh_t *imp_dbh); + int ib_rollback_transaction(SV *h, imp_dbh_t *imp_dbh); + long ib_rows(SV *xxh, isc_stmt_handle *h_stmt, char count_type); ++void ib_cleanup_st_prepare (imp_sth_t *imp_sth); + + SV* dbd_db_quote(SV* dbh, SV* str, SV* type); + diff --git a/databases/p5-DBD-InterBase/pkg-descr b/databases/p5-DBD-InterBase/pkg-descr index 293912cd3a59..eee1bf6a7d75 100644 --- a/databases/p5-DBD-InterBase/pkg-descr +++ b/databases/p5-DBD-InterBase/pkg-descr @@ -2,6 +2,3 @@ DBD::InterBase is a Perl module which works with the DBI module to provide access to InterBase databases. WWW: http://search.cpan.org/dist/DBD-InterBase/ - --- Sergey Skvortsov -skv@FreeBSD.org |