2001-05-03 16:32:13 +04:00
|
|
|
--
|
|
|
|
-- PostgreSQL code for CHKPASS.
|
|
|
|
-- Written by D'Arcy J.M. Cain
|
|
|
|
-- darcy@druid.net
|
|
|
|
-- http://www.druid.net/darcy/
|
|
|
|
--
|
2002-10-18 22:41:22 +04:00
|
|
|
-- $Header: /cvsroot/pgsql/contrib/chkpass/chkpass.sql.in,v 1.3 2002/10/18 18:41:19 momjian Exp $
|
2001-08-23 20:50:33 +04:00
|
|
|
--
|
2001-05-03 16:32:13 +04:00
|
|
|
-- best viewed with tabs set to 4
|
|
|
|
--
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Input and output functions and the type itself:
|
|
|
|
--
|
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
-- Adjust this setting to control where the objects get created.
|
|
|
|
SET search_path = public;
|
2001-05-03 16:32:13 +04:00
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
SET autocommit TO 'on';
|
2001-05-03 16:32:13 +04:00
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE FUNCTION chkpass_in(cstring)
|
|
|
|
RETURNS chkpass
|
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION chkpass_out(chkpass)
|
|
|
|
RETURNS cstring
|
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE TYPE chkpass (
|
2001-05-03 16:32:13 +04:00
|
|
|
internallength = 16,
|
|
|
|
externallength = 13,
|
|
|
|
input = chkpass_in,
|
|
|
|
output = chkpass_out
|
|
|
|
);
|
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE FUNCTION raw(chkpass)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME', 'chkpass_rout'
|
|
|
|
LANGUAGE 'c';
|
2001-05-03 16:32:13 +04:00
|
|
|
|
|
|
|
--
|
|
|
|
-- The various boolean tests:
|
|
|
|
--
|
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE FUNCTION eq(chkpass, text)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME', 'chkpass_eq'
|
|
|
|
LANGUAGE 'c';
|
2001-05-03 16:32:13 +04:00
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE FUNCTION ne(chkpass, text)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME', 'chkpass_ne'
|
|
|
|
LANGUAGE 'c';
|
2001-05-03 16:32:13 +04:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Now the operators. Note how some of the parameters to some
|
|
|
|
-- of the 'create operator' commands are commented out. This
|
|
|
|
-- is because they reference as yet undefined operators, and
|
|
|
|
-- will be implicitly defined when those are, further down.
|
|
|
|
--
|
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE OPERATOR = (
|
2001-05-03 16:32:13 +04:00
|
|
|
leftarg = chkpass,
|
|
|
|
rightarg = text,
|
|
|
|
commutator = =,
|
|
|
|
-- negator = <>,
|
|
|
|
procedure = eq
|
|
|
|
);
|
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE OPERATOR <> (
|
2001-05-03 16:32:13 +04:00
|
|
|
leftarg = chkpass,
|
|
|
|
rightarg = text,
|
|
|
|
negator = =,
|
|
|
|
procedure = ne
|
|
|
|
);
|
|
|
|
|
2001-08-10 22:57:42 +04:00
|
|
|
COMMENT ON TYPE chkpass IS 'password type with checks';
|
2001-05-03 16:32:13 +04:00
|
|
|
|
|
|
|
--
|
|
|
|
-- eof
|
|
|
|
--
|