diff options
author | Mikhail Teterin <mi@FreeBSD.org> | 2002-01-21 20:06:05 +0000 |
---|---|---|
committer | Mikhail Teterin <mi@FreeBSD.org> | 2002-01-21 20:06:05 +0000 |
commit | 0474c49222bee98896eaa1a2b0190804875d03b1 (patch) | |
tree | f533b79eb079cd1b0ba7dc2b34e1aad2271db7b7 /security/pam-pgsql/files | |
parent | 344c076cdec1cf6c189253c821213b9c411d3418 (diff) | |
download | ports-0474c49222bee98896eaa1a2b0190804875d03b1.tar.gz ports-0474c49222bee98896eaa1a2b0190804875d03b1.zip |
Notes
Diffstat (limited to 'security/pam-pgsql/files')
-rw-r--r-- | security/pam-pgsql/files/pqescape.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/security/pam-pgsql/files/pqescape.c b/security/pam-pgsql/files/pqescape.c deleted file mode 100644 index c13304e0a204..000000000000 --- a/security/pam-pgsql/files/pqescape.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * PQescapeString implementation is from - * <URL:http://cert.uni-stuttgart.de/doc/postgresql/escape/> - * It will be available in a later release of PostGreSQL. - */ -#if !defined(HAVE_PQESCAPESTRING) -#include <sys/types.h> - -/* Quoting strings before inclusion in queries. */ -size_t PQescapeString (char *to, const char *from, size_t length); - -/* --------------- - * Escaping arbitrary strings to get valid SQL strings/identifiers. - * - * Replaces "\\" with "\\\\", "\0" with "\\0", and "'" with "''". - * length is the length of the buffer pointed to by - * from. The buffer at to must be at least 2*length + 1 characters - * long. A terminating NUL character is written. - * --------------- - */ - -size_t -PQescapeString (char *to, const char *from, size_t length) -{ - const char *source = from; - char *target = to; - unsigned int remaining = length; - - while (remaining > 0) { - switch (*source) { - case '\0': - *target = '\\'; - target++; - *target = '0'; - /* target and remaining are updated below. */ - break; - - case '\\': - *target = '\\'; - target++; - *target = '\\'; - /* target and remaining are updated below. */ - break; - - case '\'': - *target = '\''; - target++; - *target = '\''; - /* target and remaining are updated below. */ - break; - - default: - *target = *source; - /* target and remaining are updated below. */ - } - source++; - target++; - remaining--; - } - - /* Write the terminating NUL character. */ - *target = '\0'; - - return target - to; -} -#endif /* !defined(HAVE_PQESCAPESTRING) */ |