postgresql password manager release 1.0.0

Поиск
Список
Период
Сортировка
От joseph speigle
Тема postgresql password manager release 1.0.0
Дата
Msg-id 20031218213102.GA19470@www.sirfsup.com
обсуждение исходный текст
Список pgsql-novice
novices!

I have succeeded in making accessing my www passwords easy from the shell.  I store the passwords in a postgresql
table,and use the bash shell; for anybody who has these and uses the net a lot and use different passwords this may
comein handy for them too.  It is also my first sql function.  The pieces are a password table, a data type (for the
function),the sql-function, and two bash functions to call the sql function and insert values into the table.  The
sourcefor the pieces in that order are: 

============================================
psql commands
-------------
create sequence passwd_id_seq start 1 increment 1

CREATE TABLE passwd (  "id" int4 default nextval('passwd_id_seq') not null,  "uname" varchar(30) NOT NULL default '',
"pass"varchar(30) NOT NULL default '',  "location" varchar(255) default NULL,  "email" varchar(30) default NULL,
"category"varchar(25) default NULL,  "notes" varchar(255) default NULL,  PRIMARY KEY  (id)); 


create  type getpass_type as
(
username character varying(30),
password character varying(30),
location character varying(255)
);

CREATE or replace FUNCTION getpass(text)
returns setof getpass_type AS
-- retrieves user and pass by matching against a partial location
'
    SELECT uname,pass,location FROM passwd WHERE location like ''%'' || $1 || ''%''
' LANGUAGE 'sql';

============================================
.bashrc
-------
function getpass ()
{
        psql -d database_name -c "select * from getpass('$1');"
}
function setpass ()
{
        psql -d database_name -c "insert into passwd (uname,pass,location) values ('$1','$2','$3');"
}

the function was overkill, but a good lesson.  I wish I could do the same for the setpass function.
============================================

use like this:
# setpass yahoo_user yahoo_pass mail.yahoo.com
# getpass yahoo

(you may need to change database_name above to your database where you put the passwd table)
--
joe speigle

В списке pgsql-novice по дате отправления:

Предыдущее
От: Bruno LEVEQUE
Дата:
Сообщение: Re: Can't create lock file /tmp/.s.PGSQL.5432.lock
Следующее
От: "Sergio L. Garza M."
Дата:
Сообщение: Upgrading from v7.1.3 to v7.4