Skip to content

Commit 5fae5f1

Browse files
committed
more parameters
1 parent b499781 commit 5fae5f1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

passivessl.sql

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ ALTER FUNCTION public.tlshc(text,text) OWNER TO postgres;
293293
-- ddl-end --
294294

295295
-- object: public.tlsht | type: FUNCTION --
296-
-- DROP FUNCTION IF EXISTS public.tlsht(IN text,IN text,IN int4,int4) CASCADE;
297-
CREATE FUNCTION public.tlsht (IN filter text, IN hash text, IN threshold int4, maxrows int4)
296+
-- DROP FUNCTION IF EXISTS public.tlsht(IN text,IN text,IN int4,IN int4) CASCADE;
297+
CREATE FUNCTION public.tlsht (IN filter text, IN hash text, IN threshold int4, IN maxrows int4)
298298
RETURNS SETOF public.fuzzy_hash
299299
LANGUAGE plpython3u
300300
IMMUTABLE LEAKPROOF
@@ -304,19 +304,16 @@ CREATE FUNCTION public.tlsht (IN filter text, IN hash text, IN threshold int4,
304304
ROWS 1000
305305
AS $$
306306
import tlsh
307-
param = ["TLSH"]
308-
#param[0] = filter
309-
#plan = plpy.prepare("SELECT * FROM fuzzy_hash WHERE type <> $1", ["text"])
310-
#rv = plan.execute(param, maxrows)
311-
rv = plpy.execute("SELECT * FROM fuzzy_hash", 1000)
307+
plan = plpy.prepare("SELECT * FROM fuzzy_hash WHERE type <> $1", ["text"])
308+
rv = plan.execute(["filter"], maxrows)
312309
r = []
313310
for x in rv:
314-
if tlsh.diff(x["value"], hash) < threshold:
311+
if tlsh.diff(x["value"], hash) > threshold:
315312
r.append(x)
316313
return r
317314
$$;
318315
-- ddl-end --
319-
ALTER FUNCTION public.tlsht(IN text,IN text,IN int4,int4) OWNER TO postgres;
316+
ALTER FUNCTION public.tlsht(IN text,IN text,IN int4,IN int4) OWNER TO postgres;
320317
-- ddl-end --
321318

322319

0 commit comments

Comments
 (0)