Re: [HACKERS] TODO list updated

From: Karl DeBisschop <kdebisschop(at)range(dot)infoplease(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgman(at)candle(dot)pha(dot)pa(dot)us, peter_e(at)gmx(dot)net, scrappy(at)hub(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] TODO list updated
Date: 2000-01-13 16:58:26
Message-ID: 200001131658.LAA22497@skillet.infoplease.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> What I am starting to think is that we do need a C program. However,
> it could be very small; it shouldn't try to do all of what initdb does.
> All it needs to do is fetch the password from stdin and then echo it
> to stdout in an ALTER USER command. The invocation in initdb would
> look something like
>
> securepassword $SUPERUSERNAME | standalone-backend ...
>
> and the code would be on the order of
>
> fprintf(stderr, "Please enter password for %s: ", argv[1]);
> fgets(stdin, password);
> printf("ALTER USER %s PASSWORD '%s'\n", argv[1], password);

Why not something like:

#include <libpq-fe.h>
char *pghost;
char *pgport;
char *pgoptions;
char *pgtty;
char *dbName;
char *user;
char *password;
char *query;
PGconn *conn;
PGresult *res;

fprintf(stderr, "Please enter password for %s: ", argv[1]);
fgets(stdin, password);
pgoptions = NULL; /* special options to start up the backend server */
pgtty = NULL; /* debugging tty for the backend server */
conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
sprintf(query,"ALTER USER postgres SET PASSWORD='%s'",password)
PGresult= PQexec(conn,query);
PQfinish(conn);

--
Karl DeBisschop <kdebisschop(at)alert(dot)infoplease(dot)com>
617.832.0332 (Fax: 617.956.2696)

Information Please - your source for FREE online reference
http://www.infoplease.com - Your Ultimate Fact Finder
http://kids.infoplease.com - The Great Homework Helper

Netsaint Plugins Development
http://netsaintplug.sourceforge.net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-13 16:58:34 Re: initdb (Re: [HACKERS] TODO list updated)
Previous Message Tom Lane 2000-01-13 16:47:56 Re: [HACKERS] TODO list updated