in reply to Creating .cgi Scripts On the fly
You were looking for chmod. What you weren't looking for but still need is a general critique of whatever it is that you're doing. Unfortunately you didn't provide enough information to be helpful for this concern. The long and short of it is that your proposition scares the begeezus out of me. I'm very concerned that you either aren't going to take the nessessary care to do this safely or that you aren't aware of all the issues. Would you post more about what you're doing that requires you to create new executables?
Added: I reviewed your posting history and I'm guessing that you are writing some sort of game. Perhaps as a means for learning perl. If so bravo! Doubleplus bravo for find perlmonks.org, hanging around and asking questions. At this point I'm primarily concerned with two issues - malicious code injection and file locking. The first one is why I started this response in the place.
I don't know how you are generating the contents of these scripts or what their filenames are but you must be particularly careful to prevent user-supplied data from getting into these. Where it's not possible to prevent user-supplied data from going here you must be extra vigilant that it's vetted to be ok. This is where perlsec and taint becomes your friend. Once you've assured yourself of those requirements then you need to start looking at file locking. Your use of open(FILE,'>file.txt') is prone to clobbering and loss of data.
If you start posting your code then you can get some actually helpful help. Mostly this response just exists to let you know that there are serious problems with your approach and that I'd like to help but don't have enough information.
Seeking Green geeks in Minnesota
|
|---|