Running as Administrator on Windows 9.3 vs. 9.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I stumbled over a little thing, that I thought might make sense to share - maybe only for having this in the archvies.

I have a little batch file to quickly create a new Postgres cluster for testing purposes, something like this:

--- snip 
  set pgdir=%~dp0
  set datadir=%pgdir%datadir
  set bindir=%pgdir%pgsql\bin
  set pwfile=%pgdir%password_for_postgres_db_user.txt
  echo secret> %pwfile%

  %bindir%\initdb -D "%datadir%" --lc-messages=English -U postgres --pwfile="%pwfile%"  -E UTF8 -A md5

--- snip 

It assumes the ZIP distribution (provided by EnterpriseDB) is unzipped into the same directory.

This works without any problems, even when the current user is a local Administrator 
because initdb, just like pg_ctl, drops the admin privileges. 

Now for some reason the following small change crept into my batch file:

  "%bindir%"\initdb -D "%datadir%" --lc-messages=English -U postgres --pwfile="%pwfile%"  -E UTF8 -A md5

The difference is "%bindir%"\initdb vs. %bindir%\initdb

In this case 9.4 initdb fails with the message: 

  Execution of PostgreSQL by a user with administrative permissions is not permitted.

Apparently the code that tries to lose the admin privileges stumbles over the quotes around the path but not the .exe

The error message in 9.3 was a bit "better" - at least it gave a better hint on where the problem might be:

  initdb: could not re-execute with restricted token: error code 3
  Execution of PostgreSQL by a user with administrative permissions is not permitted.

I don't really consider this a problem, but I was thinking if it makes sense to enhance the error message in 9.4. 
(I also don't know if there are other ways to make re-executing the binary fail) 

But then again, maybe the use-case is so uncommon that it doesn't warrant a change at all. 

Regards
Thomas
 



-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux