Re: [PATCHES] psql patch for displaying the username when asking password

2005-07-27 Thread Bruce Momjian
Adrian Maier wrote:
 On 6/30/05, Peter Eisentraut [EMAIL PROTECTED] wrote:
  Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:
   The attached patch modifies the message displayed by psql
   when asking the password Password: 
   to include the username as well:  Password for user postgres : .
 
  I can't decode your attachment so I don't know if this is a typo or
  actually  in the patch, but there shouldn't be a space after the user name.
 
 There was a space there.  I've removed the space between
 username and colons.The space after the colons is ok,  I hope ?
 
 I'm attaching the modified patch.

I made this adjustment in the applied version.  Thanks.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [PATCHES] psql patch for displaying the username when asking password

2005-07-25 Thread Bruce Momjian

Patch adjusted slightly, attached, and applied.  Thanks.

---

Adrian Maier wrote:
 On 6/30/05, Peter Eisentraut [EMAIL PROTECTED] wrote:
  Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:
   The attached patch modifies the message displayed by psql
   when asking the password Password: 
   to include the username as well:  Password for user postgres : .
 
  I can't decode your attachment so I don't know if this is a typo or
  actually  in the patch, but there shouldn't be a space after the user name.
 
 There was a space there.  I've removed the space between
 username and colons.The space after the colons is ok,  I hope ?
 
 I'm attaching the modified patch.
 
 Cheers,
 Adrian Maier

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 7: don't forget to increase your free space map settings

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
Index: src/bin/psql/command.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.150
diff -c -c -r1.150 command.c
*** src/bin/psql/command.c  18 Jul 2005 20:57:53 -  1.150
--- src/bin/psql/command.c  25 Jul 2005 17:13:42 -
***
*** 911,916 
--- 911,917 
const char *dbparam = NULL;
const char *userparam = NULL;
const char *pwparam = NULL;
+   char   *password_prompt = NULL;
char   *prompted_password = NULL;
boolneed_pass;
boolsuccess = false;
***
*** 930,938 
else
userparam = new_user;
  
/* need to prompt for password? */
if (pset.getPassword)
!   pwparam = prompted_password = simple_prompt(Password: , 100, 
false);
  
/*
 * Use old password (if any) if no new one given and we are
--- 931,948 
else
userparam = new_user;
  
+   if (userparam == NULL) 
+   password_prompt = strdup(Password: );
+   else
+   {
+   password_prompt = malloc(strlen(Password for user %s: ) - 2 +
+
strlen(userparam) + 1);
+   sprintf(password_prompt,Password for user %s: , userparam);
+   }
+ 
/* need to prompt for password? */
if (pset.getPassword)
!   pwparam = prompted_password = simple_prompt(password_prompt, 
100, false);
  
/*
 * Use old password (if any) if no new one given and we are
***
*** 956,966 
need_pass = true;
free(prompted_password);
prompted_password = NULL;
!   pwparam = prompted_password = simple_prompt(Password: 
, 100, false);
}
} while (need_pass);
  
free(prompted_password);
  
/*
 * If connection failed, try at least keep the old one. That's
--- 966,977 
need_pass = true;
free(prompted_password);
prompted_password = NULL;
!   pwparam = prompted_password = 
simple_prompt(password_prompt, 100, false);
}
} while (need_pass);
  
free(prompted_password);
+   free(password_prompt);
  
/*
 * If connection failed, try at least keep the old one. That's
Index: src/bin/psql/startup.c
===
RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.119
diff -c -c -r1.119 startup.c
*** src/bin/psql/startup.c  14 Jul 2005 08:42:37 -  1.119
--- src/bin/psql/startup.c  25 Jul 2005 17:13:42 -
***
*** 106,111 
--- 106,112 
  
char   *username = NULL;
char   *password = NULL;
+   char   *password_prompt = NULL;
boolneed_pass;
  
set_pglocale_pgservice(argv[0], psql);
***
*** 188,195 
username = pg_strdup(options.username);
}
  
if (pset.getPassword)
!   password = simple_prompt(Password: , 100, false);
  
/* loop until we have a password if requested by backend */
do
--- 189,205 
username = pg_strdup(options.username);
}
  
+   if (options.username == NULL)
+   password_prompt = strdup(Password: );
+   else
+   {
+   password_prompt = malloc(strlen(Password for user %s: ) - 2 +
+

Re: [PATCHES] psql patch for displaying the username when asking password

2005-06-30 Thread Peter Eisentraut
Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:
 The attached patch modifies the message displayed by psql
 when asking the password Password: 
 to include the username as well:  Password for user postgres : .

I can't decode your attachment so I don't know if this is a typo or actually 
in the patch, but there shouldn't be a space after the user name.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] psql patch for displaying the username when asking password

2005-06-30 Thread Adrian Maier
On 6/30/05, Peter Eisentraut [EMAIL PROTECTED] wrote:
 Am Donnerstag, 30. Juni 2005 09:34 schrieb Adrian Maier:
  The attached patch modifies the message displayed by psql
  when asking the password Password: 
  to include the username as well:  Password for user postgres : .

 I can't decode your attachment so I don't know if this is a typo or
 actually  in the patch, but there shouldn't be a space after the user name.

There was a space there.  I've removed the space between
username and colons.The space after the colons is ok,  I hope ?

I'm attaching the modified patch.

Cheers,
Adrian Maier


psql_password_prompt_v2.diff.gz
Description: GNU Zip compressed data

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings