Skip to Content.
Sympa Menu

freetds - Re: [freetds] Proposed patch to datacopy to allow passwords to be read from stdin

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Proposed patch to datacopy to allow passwords to be read from stdin
  • Date: Sun, 16 Sep 2012 09:42:44 +0100

2012/8/16 PublicMailbox AT benslade.com <PublicMailbox AT benslade.com>:
> The patch below would permit the datacopy utility to use a dash for the
> password in the source or destination server parameter to mean "read from
> standard in". For example:
>
> datacopy -Smyserver/myusername/-/mydatabase/mytable ...
>
> Upon finding a dash for the password, datacopy would prompt for the
> password and read it in.
>
> Using a dash for a parameter to specify "read from stdin" is a typical
> style for many Unix/Linux utilities.
>
> This feature is needed to prevent the security violation of putting a
> password on the command line (which makes it visible to ps -f in
> Unix/Linux). For batch (non-interactive)
> jobs in an enterprise environment, this is a mandatory requirement.
> Using kerberos might be better, but that's a much harder change.
>
> Ben Slade
> DBA @ NCBI.NLM.NIH.gov
>
>
>> diff -u datacopy.c.orig datacopy.c
> --- datacopy.c.orig 2011-05-16 04:51:40.000000000 -0400
> +++ datacopy.c 2012-08-16 11:18:55.583213000 -0400
> @@ -246,6 +246,10 @@
> if (!tok)
> return FALSE;
> pdata->spass = strdup(tok);
> + if( strcmp(pdata->spass,"-") == 0
> ) {
> + printf("Enter Source Password :
> ");
> + pdata->spass = gets_alloc();
> + }
>
> tok = strtok(NULL, "/");
> if (!tok)
> @@ -277,6 +281,10 @@
> if (!tok)
> return FALSE;
> pdata->dpass = strdup(tok);
> + if( strcmp(pdata->dpass,"-") == 0
> ) {
> + printf("Enter Destination
> Password : ");
> + pdata->dpass = gets_alloc();
> + }
>
> tok = strtok(NULL, "/");
> if (!tok)
>
>

Applied (modified).

https://gitorious.org/freetds/freetds/commit/9dc94619e6772b07932172e751f2d2d6ae5417d0

Current code support Kerberos too (see change
https://gitorious.org/freetds/freetds/commit/a8f2145344f1b9017a9453a2ac29467f5e56d58e)

Frediano



  • Re: [freetds] Proposed patch to datacopy to allow passwords to be read from stdin, Frediano Ziglio, 09/16/2012

Archive powered by MHonArc 2.6.24.

Top of Page