Created
August 15, 2017 10:01
-
-
Save KalleZ/2cea919fe1e8f4e1d1d8cbfd2afe0c43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c | |
index efc8dc1..c75c698 100644 | |
--- a/ext/pdo_dblib/dblib_driver.c | |
+++ b/ext/pdo_dblib/dblib_driver.c | |
@@ -375,6 +375,8 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options) | |
,{ "dbname", NULL, 0 } | |
,{ "secure", NULL, 0 } /* DBSETLSECURE */ | |
,{ "version", NULL, 0 } /* DBSETLVERSION */ | |
+ ,{ "user", NULL, 0 } | |
+ ,{ "password", NULL, 0 } | |
}; | |
nvars = sizeof(vars)/sizeof(vars[0]); | |
@@ -432,12 +434,20 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options) | |
} | |
} | |
+ if (!dbh->username && vars[6].optval) { | |
+ dbh->username = vars[6].optval; | |
+ } | |
+ | |
if (dbh->username) { | |
if(FAIL == DBSETLUSER(H->login, dbh->username)) { | |
goto cleanup; | |
} | |
} | |
+ if (!dbh->password && vars[7].optval) { | |
+ dbh->password = vars[7].optval; | |
+ } | |
+ | |
if (dbh->password) { | |
if(FAIL == DBSETLPWD(H->login, dbh->password)) { | |
goto cleanup; | |
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c | |
index 83203d7..d3ff9b3 100644 | |
--- a/ext/pdo_firebird/firebird_driver.c | |
+++ b/ext/pdo_firebird/firebird_driver.c | |
@@ -617,14 +617,24 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* | |
struct pdo_data_src_parser vars[] = { | |
{ "dbname", NULL, 0 }, | |
{ "charset", NULL, 0 }, | |
- { "role", NULL, 0 } | |
+ { "role", NULL, 0 }, | |
+ { "user", NULL, 0 }, | |
+ { "password", NULL, 0 } | |
}; | |
int i, ret = 0; | |
short buf_len = 256, dpb_len; | |
pdo_firebird_db_handle *H = dbh->driver_data = pecalloc(1,sizeof(*H),dbh->is_persistent); | |
- php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 3); | |
+ php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 5); | |
+ | |
+ if (!dbh->username && vars[3].optval) { | |
+ dbh->username = vars[3].optval; | |
+ } | |
+ | |
+ if (!dbh->password && vars[4].optval) { | |
+ dbh->password = vars[4].optval; | |
+ } | |
do { | |
static char const dpb_flags[] = { | |
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c | |
index 60205a8..904fdbe 100644 | |
--- a/ext/pdo_oci/oci_driver.c | |
+++ b/ext/pdo_oci/oci_driver.c | |
@@ -591,10 +591,12 @@ static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ * | |
int i, ret = 0; | |
struct pdo_data_src_parser vars[] = { | |
{ "charset", NULL, 0 }, | |
- { "dbname", "", 0 } | |
+ { "dbname", "", 0 }, | |
+ { "user", NULL, 0 }, | |
+ { "password", NULL, 0 } | |
}; | |
- php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 2); | |
+ php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 4); | |
H = pecalloc(1, sizeof(*H), dbh->is_persistent); | |
dbh->driver_data = H; | |
@@ -658,6 +660,10 @@ static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ * | |
} | |
/* username */ | |
+ if (!dbh->username && vars[2].optval) { | |
+ dbh->username = vars[2].optval; | |
+ } | |
+ | |
if (dbh->username) { | |
H->last_err = OCIAttrSet(H->session, OCI_HTYPE_SESSION, | |
dbh->username, (ub4) strlen(dbh->username), | |
@@ -669,6 +675,10 @@ static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ * | |
} | |
/* password */ | |
+ if (!dbh->password && vars[3].optval) { | |
+ dbh->password = vars[3].optval; | |
+ } | |
+ | |
if (dbh->password) { | |
H->last_err = OCIAttrSet(H->session, OCI_HTYPE_SESSION, | |
dbh->password, (ub4) strlen(dbh->password), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment