Re: FW: Initdb patch - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: FW: Initdb patch
Date
Msg-id 200407120134.i6C1YHM15886@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Patch applied.  Thanks.

I had to manually apply your patch, and I adjusted how you set
effective_user.

---------------------------------------------------------------------------


Magnus Hagander wrote:
> Here you go.
>
> >  -----Original Message-----
> > From:     Dave Page [mailto:dpage@vale-housing.co.uk]
> > Sent:    den 8 juli 2004 15:14
> > To:    Magnus Hagander
> > Subject:    Initdb patch
> >
> >  <<initdb.patch>>

Content-Description: initdb.patch

[ Attachment, skipping... ]

--
  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/initdb/initdb.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/initdb/initdb.c,v
retrieving revision 1.41
diff -c -c -r1.41 initdb.c
*** src/bin/initdb/initdb.c    1 Jul 2004 00:51:36 -0000    1.41
--- src/bin/initdb/initdb.c    12 Jul 2004 01:29:19 -0000
***************
*** 1137,1143 ****
      PG_CMD_OPEN;

      if (fprintf(pg,
!           "ALTER USER \"%s\" WITH PASSWORD '%s';\n", username, pwd1) < 0)
      {
          /* write failure */
          exit_nicely();
--- 1137,1143 ----
      PG_CMD_OPEN;

      if (fprintf(pg,
!           "ALTER USER \"%s\" WITH PASSWORD '%s';\n", effective_user, pwd1) < 0)
      {
          /* write failure */
          exit_nicely();
***************
*** 1433,1439 ****
      PG_CMD_OPEN;

      priv_lines = replace_token(privileges_setup,
!                                "$POSTGRES_SUPERUSERNAME", username);
      for (line = priv_lines; *line != NULL; line++)
          PG_CMD_PUTLINE;

--- 1433,1439 ----
      PG_CMD_OPEN;

      priv_lines = replace_token(privileges_setup,
!                                "$POSTGRES_SUPERUSERNAME", effective_user);
      for (line = priv_lines; *line != NULL; line++)
          PG_CMD_PUTLINE;

***************
*** 2002,2010 ****
          exit(1);
      }

!     effective_user = get_id();
!     if (!strlen(username))
!         username = effective_user;

      if (strlen(encoding))
          encodingid = get_encoding_id(encoding);
--- 2002,2011 ----
          exit(1);
      }

!     if (strlen(username))
!         effective_user = username;
!     else
!         effective_user = get_id();

      if (strlen(encoding))
          encodingid = get_encoding_id(encoding);
***************
*** 2033,2039 ****
                  PG_VERSION,
                  pg_data, share_path, bin_path,
                  encoding, encodingid,
!                 username, bki_file,
                  desc_file, conf_file,
                  hba_file, ident_file);
          if (show_setting)
--- 2034,2040 ----
                  PG_VERSION,
                  pg_data, share_path, bin_path,
                  encoding, encodingid,
!                 effective_user, bki_file,
                  desc_file, conf_file,
                  hba_file, ident_file);
          if (show_setting)

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Updated ALTER TABLE ... SET TABLESPACE patch
Next
From: Tom Lane
Date:
Subject: Re: Updated ALTER TABLE ... SET TABLESPACE patch