git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SPDX: Mass-update to GPL-2.0-or-later
[exim.git]
/
src
/
src
/
lookups
/
oracle.c
diff --git
a/src/src/lookups/oracle.c
b/src/src/lookups/oracle.c
index c37503048351abe5285fb75b9125e4e6800560e0..d0604c2452d9a0ddee873a4ecdccb3df68155afc 100644
(file)
--- a/
src/src/lookups/oracle.c
+++ b/
src/src/lookups/oracle.c
@@
-2,8
+2,10
@@
* Exim - an Internet mail transport agent *
*************************************************/
* Exim - an Internet mail transport agent *
*************************************************/
+/* Copyright (c) The Exim Maintainers 2020 - 2022 */
/* Copyright (c) University of Cambridge 1995 - 2015 */
/* See the file NOTICE for conditions of use and distribution. */
/* Copyright (c) University of Cambridge 1995 - 2015 */
/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Interface to an Oracle database. This code was originally supplied by
Paul Kelly, but I have hacked it around for various reasons, and tried to add
/* Interface to an Oracle database. This code was originally supplied by
Paul Kelly, but I have hacked it around for various reasons, and tried to add
@@
-305,8
+307,8
@@
if (!cn)
/* Get store for a new connection, initialize it, and connect to the server */
/* Get store for a new connection, initialize it, and connect to the server */
- oracle_handle = store_get(sizeof(struct cda_def),
FALSE
);
- hda = store_get(HDA_SIZE,
FALSE
);
+ oracle_handle = store_get(sizeof(struct cda_def),
GET_UNTAINTED
);
+ hda = store_get(HDA_SIZE,
GET_UNTAINTED
);
memset(hda,'\0',HDA_SIZE);
/*
memset(hda,'\0',HDA_SIZE);
/*
@@
-329,7
+331,7
@@
if (!cn)
/* Add the connection to the cache */
/* Add the connection to the cache */
- cn = store_get(sizeof(oracle_connection),
FALSE
);
+ cn = store_get(sizeof(oracle_connection),
GET_UNTAINTED
);
cn->server = server_copy;
cn->handle = oracle_handle;
cn->next = oracle_connections;
cn->server = server_copy;
cn->handle = oracle_handle;
cn->next = oracle_connections;
@@
-348,7
+350,7
@@
else
/* We have a connection. Open a cursor and run the query */
/* We have a connection. Open a cursor and run the query */
-cda = store_get(sizeof(Cda_Def),
FALSE
);
+cda = store_get(sizeof(Cda_Def),
GET_UNTAINTED
);
if (oopen(cda, oracle_handle, (text *)0, -1, -1, (text *)0, -1) != 0)
{
if (oopen(cda, oracle_handle, (text *)0, -1, -1, (text *)0, -1) != 0)
{
@@
-369,8
+371,8
@@
if (oparse(cda, (text *)query, (sb4) -1,
/* Find the number of fields returned and sort out their types. If the number
is one, we don't add field names to the data. Otherwise we do. */
/* Find the number of fields returned and sort out their types. If the number
is one, we don't add field names to the data. Otherwise we do. */
-def = store_get(sizeof(Ora_Define)*MAX_SELECT_LIST_SIZE,
FALSE
);
-desc = store_get(sizeof(Ora_Describe)*MAX_SELECT_LIST_SIZE,
FALSE
);
+def = store_get(sizeof(Ora_Define)*MAX_SELECT_LIST_SIZE,
GET_UNTAINTED
);
+desc = store_get(sizeof(Ora_Describe)*MAX_SELECT_LIST_SIZE,
GET_UNTAINTED
);
if ((num_fields = describe_define(cda,def,desc)) == -1)
{
if ((num_fields = describe_define(cda,def,desc)) == -1)
{
@@
-509,13
+511,12
@@
oracle_find(void * handle, const uschar * filename, uschar * query, int length,
int sep = 0;
uschar *server;
uschar *list = oracle_servers;
int sep = 0;
uschar *server;
uschar *list = oracle_servers;
-uschar buffer[512];
do_cache = do_cache; /* Placate picky compilers */
DEBUG(D_lookup) debug_printf_indent("ORACLE query: %s\n", query);
do_cache = do_cache; /* Placate picky compilers */
DEBUG(D_lookup) debug_printf_indent("ORACLE query: %s\n", query);
-while ((server = string_nextinlist(&list, &sep,
buffer, sizeof(buffer)
)))
+while ((server = string_nextinlist(&list, &sep,
NULL, 0
)))
{
BOOL defer_break;
int rc = perform_oracle_search(query, server, result, errmsg, &defer_break);
{
BOOL defer_break;
int rc = perform_oracle_search(query, server, result, errmsg, &defer_break);
@@
-543,27
+544,25
@@
messages, since that isn't likely to be treated as a pattern of any kind.
Arguments:
s the string to be quoted
opt additional option text or NULL if none
Arguments:
s the string to be quoted
opt additional option text or NULL if none
+ idx lookup type index
Returns: the processed string or NULL for a bad option
*/
static uschar *
Returns: the processed string or NULL for a bad option
*/
static uschar *
-oracle_quote(uschar *
s, uschar *opt
)
+oracle_quote(uschar *
s, uschar * opt, unsigned idx
)
{
{
-register int c;
-int count = 0;
-uschar *t = s;
-uschar *quoted;
+int c, count = 0;
+uschar * t = s, * quoted;
-if (opt
!= NULL
) return NULL; /* No options are recognized */
+if (opt) return NULL; /* No options are recognized */
-while ((c = *t++)
!= 0
)
+while ((c = *t++))
if (strchr("\n\t\r\b\'\"\\", c) != NULL) count++;
if (strchr("\n\t\r\b\'\"\\", c) != NULL) count++;
-if (count == 0) return s;
-t = quoted = store_get((int)strlen(s) + count + 1, is_tainted(s));
+t = quoted = store_get_quoted((int)Ustrlen(s) + count + 1, s, idx);
-while ((c = *s++)
!= 0
)
+while ((c = *s++))
{
if (strchr("\n\t\r\b\'\"\\", c) != NULL)
{
{
if (strchr("\n\t\r\b\'\"\\", c) != NULL)
{
@@
-598,12
+597,13
@@
return quoted;
#include "../version.h"
#include "../version.h"
-void
-oracle_version_report(
FILE *f
)
+gstring *
+oracle_version_report(
gstring * g
)
{
#ifdef DYNLOOKUP
{
#ifdef DYNLOOKUP
-
fprintf(f
, "Library version: Oracle: Exim version %s\n", EXIM_VERSION_STR);
+
g = string_fmt_append(g
, "Library version: Oracle: Exim version %s\n", EXIM_VERSION_STR);
#endif
#endif
+return g;
}
}