summaryrefslogtreecommitdiff
path: root/contrib/chkpass
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-01-29 22:35:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-01-29 22:35:02 +0000
commitb7d236d663b127d6b5674011a3b7940f165f060e (patch)
tree20f6372cd3096c0a25dee7ae9381bf65541b1752 /contrib/chkpass
parent750d9171f6f758e9aa30b905c884d53da15a0b87 (diff)
downloadpostgresql-b7d236d663b127d6b5674011a3b7940f165f060e.tar.gz
Make sure contrib C functions are marked strict where needed.
Kris Jurka
Diffstat (limited to 'contrib/chkpass')
-rw-r--r--contrib/chkpass/chkpass.c19
-rw-r--r--contrib/chkpass/chkpass.sql.in12
2 files changed, 8 insertions, 23 deletions
diff --git a/contrib/chkpass/chkpass.c b/contrib/chkpass/chkpass.c
index 0832993bd7..8dda0bc4ad 100644
--- a/contrib/chkpass/chkpass.c
+++ b/contrib/chkpass/chkpass.c
@@ -4,7 +4,7 @@
* darcy@druid.net
* http://www.druid.net/darcy/
*
- * $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.12 2003/11/29 22:39:18 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.13 2005/01/29 22:35:01 tgl Exp $
* best viewed with tabs set to 4
*/
@@ -82,14 +82,10 @@ chkpass_in(PG_FUNCTION_ARGS)
}
if (verify_pass(str) != 0)
- {
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),
errmsg("password \"%s\" is weak", str)));
- PG_RETURN_POINTER(NULL);
- }
-
result = (chkpass *) palloc(sizeof(chkpass));
mysalt[0] = salt_chars[random() & 0x3f];
@@ -112,9 +108,6 @@ chkpass_out(PG_FUNCTION_ARGS)
chkpass *password = (chkpass *) PG_GETARG_POINTER(0);
char *result;
- if (password == NULL)
- PG_RETURN_POINTER(NULL);
-
if ((result = (char *) palloc(16)) != NULL)
{
result[0] = ':';
@@ -134,10 +127,7 @@ Datum
chkpass_rout(PG_FUNCTION_ARGS)
{
chkpass *password = (chkpass *) PG_GETARG_POINTER(0);
- text *result = NULL;
-
- if (password == NULL)
- PG_RETURN_POINTER(NULL);
+ text *result;
if ((result = (text *) palloc(VARHDRSZ + 16)) != NULL)
{
@@ -162,9 +152,6 @@ chkpass_eq(PG_FUNCTION_ARGS)
char str[10];
int sz = 8;
- if (!a1 || !a2)
- PG_RETURN_BOOL(0);
-
if (a2->vl_len < 12)
sz = a2->vl_len - 4;
strncpy(str, a2->vl_dat, sz);
@@ -181,8 +168,6 @@ chkpass_ne(PG_FUNCTION_ARGS)
char str[10];
int sz = 8;
- if (!a1 || !a2)
- PG_RETURN_BOOL(0);
if (a2->vl_len < 12)
sz = a2->vl_len - 4;
strncpy(str, a2->vl_dat, sz);
diff --git a/contrib/chkpass/chkpass.sql.in b/contrib/chkpass/chkpass.sql.in
index 501edbdc9b..68cd1e2765 100644
--- a/contrib/chkpass/chkpass.sql.in
+++ b/contrib/chkpass/chkpass.sql.in
@@ -4,7 +4,7 @@
-- darcy@druid.net
-- http://www.druid.net/darcy/
--
--- $PostgreSQL: pgsql/contrib/chkpass/chkpass.sql.in,v 1.5 2003/11/29 19:51:19 pgsql Exp $
+-- $PostgreSQL: pgsql/contrib/chkpass/chkpass.sql.in,v 1.6 2005/01/29 22:35:01 tgl Exp $
--
-- best viewed with tabs set to 4
--
@@ -19,12 +19,12 @@ SET search_path = public;
CREATE FUNCTION chkpass_in(cstring)
RETURNS chkpass
AS 'MODULE_PATHNAME'
- LANGUAGE 'c';
+ LANGUAGE C STRICT;
CREATE FUNCTION chkpass_out(chkpass)
RETURNS cstring
AS 'MODULE_PATHNAME'
- LANGUAGE 'c';
+ LANGUAGE C STRICT;
CREATE TYPE chkpass (
internallength = 16,
@@ -36,7 +36,7 @@ CREATE TYPE chkpass (
CREATE FUNCTION raw(chkpass)
RETURNS text
AS 'MODULE_PATHNAME', 'chkpass_rout'
- LANGUAGE 'c';
+ LANGUAGE C STRICT;
--
-- The various boolean tests:
@@ -45,12 +45,12 @@ CREATE FUNCTION raw(chkpass)
CREATE FUNCTION eq(chkpass, text)
RETURNS bool
AS 'MODULE_PATHNAME', 'chkpass_eq'
- LANGUAGE 'c';
+ LANGUAGE C STRICT;
CREATE FUNCTION ne(chkpass, text)
RETURNS bool
AS 'MODULE_PATHNAME', 'chkpass_ne'
- LANGUAGE 'c';
+ LANGUAGE C STRICT;
--
-- Now the operators. Note how some of the parameters to some