logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Launching a program under different authority
Author
Swifty



Joined: 07 Jan 2015
Posts: 2
Location: England, Alton

PostPosted: Thu 08 Jan '15 8:54    Post subject: Launching a program under different authority Reply with quote

If one of my CGI scripts launches a program from my system (Windows 7 Ultimate x64) then it runs under userid SYSTEM (presumably because httpd is running as a service) and with a "sparse" environment, specifically a blank %PATH% variable.

I know why this is so, and understand the concerns. However, this is my system, and I'd like to be able to launch the program under my ID (Steve) and with my environment variables...

This will require something sneaky/arcane, I suspect. So far, all I've come up with is this:

My CGI script creates a file, in a specific folder, used for nothing else. It contains a command, such as "dir c:\".

A program, running under my "Steve" userid, loops until it spots the file. It reads the command, runs it, captures the STDOUT/STDERR and writes that back to a different file, then erases the file created by the CGI.
This allows the CGI to wait until the command completes. It knows this when the file the CGI created disappears.

The only problem with this is that I'm loath to leave a task running all the time, when it would be used very rarely. It's a hack. But I haven't come up with anytyhing better, yet.

The reason for all this lies in a program called get_iplayer, which allows me to download stuff from the BBC iPlayer. When I run get_iplayer from a command prompt, it works fine. When I run it from inside a CGI script, then bizarre things happen. For example, run with no parameters, get_iplayer displays the index of available TV programmes. When run like this from a CGI, it displays the same data, but the data is different, perhaps out of date...
I've tried all sorts of tricks to make get_iplayer work properly under CGI, but since I don't know why it is malfunctioning, I'm groping in the dark.

Any ideas?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Thu 08 Jan '15 18:05    Post subject: Reply with quote

if that servers runs only for you, you can run the apache service with your user.

On a *nix based system I would use suExec. However windows doesn't have that option.

There is an older topic about that https://www.apachelounge.com/viewtopic.php?p=8353
Back to top


Reply to topic   Topic: Launching a program under different authority View previous topic :: View next topic
Post new topic   Forum Index -> Other Software