Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-29 Thread Tom Lane
Andrew Dunstan writes: > On 11/29/2013 06:43 PM, Tom Lane wrote: >> I've committed this patch. I added a make_native_path() call to fix the >> slashes-versus-backslashes issue noted by Christian Ullrich, since that >> was an easy one-line addition. > I don't mind changing this, but IMNSHO it's n

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-29 Thread Andrew Dunstan
On 11/29/2013 06:43 PM, Tom Lane wrote: Rajeev rastogi writes: OK. Then I am moving it to "ready for committer". I've committed this patch. I added a make_native_path() call to fix the slashes-versus-backslashes issue noted by Christian Ullrich, since that was an easy one-line addition. I

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-29 Thread Tom Lane
Rajeev rastogi writes: > OK. Then I am moving it to "ready for committer". I've committed this patch. I added a make_native_path() call to fix the slashes-versus-backslashes issue noted by Christian Ullrich, since that was an easy one-line addition. I didn't do anything about the relative-path-

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-27 Thread Rajeev rastogi
On 27 November 2013, Naoya Anzai wrote: > Hi, Rajeev > > > > I tested the latest patch. My observation is: > > > If we give relative data directory path while registering the > > > service, then service start fails. > > > But same works if the data directory is absolute path. > > > > > > Loo

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-27 Thread Naoya Anzai
Hi, Rajeev > > I tested the latest patch. My observation is: > > If we give relative data directory path while registering the > > service, then service start fails. > > But same works if the data directory is absolute path. > > > > Looks like an existing issue. May be we need to inte

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-26 Thread Rajeev rastogi
On 25 November 2013, Rajeev Rastogi Wrote: > > > One suggestion: > > > Instead of using sizeof(cmdLine), > > > a. Can't we use strlen (hence small 'for' loop). > > > b. Or use memmove to move one byte. > > > > I looked at this patch a bit. I agree that we need to fix > > pgwin32_CommandLine t

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-25 Thread Rajeev rastogi
On 24 November 2013, Tom Lane Wrote: > > One suggestion: > > Instead of using sizeof(cmdLine), > > a. Can't we use strlen (hence small 'for' loop). > > b. Or use memmove to move one byte. > > I looked at this patch a bit. I agree that we need to fix > pgwin32_CommandLine to double-quote

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-23 Thread Tom Lane
Rajeev rastogi writes: > One suggestion: > Instead of using sizeof(cmdLine), > a. Can't we use strlen (hence small 'for' loop). > b. Or use memmove to move one byte. I looked at this patch a bit. I agree that we need to fix pgwin32_CommandLine to double-quote the executable name, b

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-22 Thread Rajeev rastogi
ON 11 November 2013, Naoya Anzai Wrote: >> >> Hi Amit, >> > > I have uploaded your patch for next commit fest, hope you can support > > it if there is any feedback for your patch by reviewer/committer. > Thanks! Okay, I will support you. 1. Patch applies cleanly to master HEAD. 2. No Compilatio

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-10 Thread Naoya Anzai
Hi Amit, > I have uploaded your patch for next commit fest, hope you can support > it if there is any feedback for your patch by reviewer/committer. Thanks! Okay, I will support you. Best Regards, Naoya > Hi Naoya, > > On Thu, Oct 31, 2013 at 5:42 PM, Robert Haas wrote: > > On Thu, Oct 31, 201

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-11-09 Thread Amit Kapila
Hi Naoya, On Thu, Oct 31, 2013 at 5:42 PM, Robert Haas wrote: > On Thu, Oct 31, 2013 at 1:44 AM, Asif Naeem wrote: >> On Thu, Oct 31, 2013 at 10:17 AM, Amit Kapila >> wrote: >>> >>> On Tue, Oct 29, 2013 at 12:46 PM, Naoya Anzai >>> wrote: >>> > Hi Sandeep >>> > >>> >> I think, you should chang

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-31 Thread Robert Haas
On Thu, Oct 31, 2013 at 1:44 AM, Asif Naeem wrote: > On Thu, Oct 31, 2013 at 10:17 AM, Amit Kapila > wrote: >> >> On Tue, Oct 29, 2013 at 12:46 PM, Naoya Anzai >> wrote: >> > Hi Sandeep >> > >> >> I think, you should change the subject line to "Unquoted service path >> >> containing space is vu

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-30 Thread Sandeep Thakkar
Services are started with the system privileges. If somebody is able to place that .exe in the specified directory, then it will be executed on service start. So, yes, I too agree with Asif that it is an important issue and should be fixed in the code at the earliest. On Thu, Oct 31, 2013 at 11:1

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-30 Thread Asif Naeem
On Thu, Oct 31, 2013 at 10:17 AM, Amit Kapila wrote: > On Tue, Oct 29, 2013 at 12:46 PM, Naoya Anzai > wrote: > > Hi Sandeep > > > >> I think, you should change the subject line to "Unquoted service path > containing space is vulnerable and can be exploited on Windows" to get the > attention..

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-30 Thread Amit Kapila
On Tue, Oct 29, 2013 at 12:46 PM, Naoya Anzai wrote: > Hi Sandeep > >> I think, you should change the subject line to "Unquoted service path >> containing space is vulnerable and can be exploited on Windows" to get the >> attention.. :) > Thank you for advice! > I'll try to post to pgsql-bugs

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-29 Thread Naoya Anzai
Hi Sandeep > I think, you should change the subject line to "Unquoted service path > containing space is vulnerable and can be exploited on Windows" to get the > attention.. :) Thank you for advice! I'll try to post to pgsql-bugs again. > BTW, in your case, the file "Program" should be an exe

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Sandeep Thakkar
Hi Naoya I think, you should change the subject line to "Unquoted service path containing space is vulnerable and can be exploited on Windows" to get the attention.. :) BTW, in your case, the file "Program" should be an exe and not just any other file to exploit this vulnerability. Right? On

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Naoya Anzai
Hi,Sandeep Thanks. Sorry, There was a mistake in what I said. I said > Not only "pg_ctl.exe" but "postgres.exe" also have the same problem. but, to say it correctly, "postgres.exe" does not have the problem. Source that contains the problem is only "pg_ctl.c". > So, this is not an instal

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Asif Naeem
Yes. It should not be installer issue as installer is using pg_ctl to register and run the service on Windows. Thanks. Best Regards, Muhammad Asif Naeem On Tue, Oct 29, 2013 at 9:57 AM, Sandeep Thakkar < sandeep.thak...@enterprisedb.com> wrote: > So, this is not an installer issue. Is this bug

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Sandeep Thakkar
So, this is not an installer issue. Is this bug raised to the PostgreSQL community? If yes, you should submit the patch there. On Tue, Oct 29, 2013 at 6:23 AM, Naoya Anzai wrote: > Hi, Asif > > Thank you for providing my patch (pg_ctl.c.patch) to Sandeep on my behalf. > > > Good finding. I have

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Naoya Anzai
Hi, Asif Thank you for providing my patch (pg_ctl.c.patch) to Sandeep on my behalf. > Good finding. I have attached another version of patch > (pg_ctl.c_windows_vulnerability.patch) attached that has fewer lines of code > changes, can you please take a look ?. Thanks. I think your patch is not

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Asif Naeem
Hi Sandeep, PFA Naoya's patch (pg_ctl.c.patch). Hi Naoya, Good finding. I have attached another version of patch (pg_ctl.c_windows_vulnerability.patch) attached that has fewer lines of code changes, can you please take a look ?. Thanks. Best Regards, Asif Naeem On Mon, Oct 28, 2013 at 4:46 PM

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Sandeep Thakkar
Hi Dave We register the service using pg_ctl. When I manually executed the following on the command prompt, I saw that the service path of the registered service did not have the pg_ctl.exe path in quotes. May be it should be handled in the pg_ctl code. *c:\Users\Sandeep Thakkar\Documents>*"c:\Pr

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Dave Page
Sandeep, can you look at this please? Thanks. On Mon, Oct 28, 2013 at 8:18 AM, Asif Naeem wrote: > It is related to windows unquoted service path vulnerability in the the > installer that creates service path without quotes that make service.exe to > look for undesirable path for executable. > >

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Asif Naeem
It is related to windows unquoted service path vulnerability in the the installer that creates service path without quotes that make service.exe to look for undesirable path for executable. postgresql-9.3 service path : C:/Users/asif/Desktop/Program files/9.3/bin/pg_ctl.exe runservice -N "postgres

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-28 Thread Naoya Anzai
Hi, Asif. Thank you for response. > C:\Users\asif\Desktop\Program files\9.3>"bin\pg_ctl" -D > "C:\Users\asif\Desktop\Program files\9.3\data1" -l logfile start > server starting This failure does not occur by the command line. PostgreSQL needs to start by Windows Service. Additiona

Re: [HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-27 Thread Asif Naeem
Hi Naoya, I am not able to reproduce the problem. Do you mean pg windows service installed by installer is not working or bin\pg_ctl binary is not accepting spaces in the patch ?. Following worked for me i.e. C:\Users\asif\Desktop\Program files\9.3>"bin\pg_ctl" -D > "C:\Users\asif\Desktop\Program

[HACKERS] PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"

2013-10-27 Thread Naoya Anzai
Hi All, I have found a case that PostgreSQL Service does not start. When it happens, the following error appears. "is not a valid Win32 application" This failure occurs when the following conditions are true. 1. There is "postgres.exe" in any directory that contains a space, such as "Progra