Page 1 of 1 1
Topic Options
#153260 - 2005-12-12 09:13 PM trouble writing to a file
pfarrelli Offline
Fresh Scripter

Registered: 2005-11-16
Posts: 46
I have the following code ...

$Choice = messagebox ($message1,'CAS Computing Antivirus Removal Tool', 4)
if $choice = 6
.... $openstatus = Open(1, "v:\NAVUP-10-TOOLS\nav-report.txt")
.... at (4,1) $openstatus
.... IF $openstatus = 0
.........WriteLine(1, "testing" )
.........at (5,1) "Wrote to file ..."

HOWEVER .....

$openstatus is equal to 0 but writeline returns a -4 .. which means file is not open ..

what is up?

Paul

Top
#153261 - 2005-12-12 09:40 PM Re: trouble writing to a file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nah, the error actually is, "can't write to a file which is opened only for read access"

see kixtart manual for open() syntax.
hint, there is a third parameter.
_________________________
!

download KiXnet

Top
#153262 - 2005-12-12 10:10 PM Re: trouble writing to a file
pfarrelli Offline
Fresh Scripter

Registered: 2005-11-16
Posts: 46
Adding a 4 as the thrid parameter worked great. I thought that was an optional parameter.

I would like the users to not be able to read or open the file from an Explorer window. Write and ONLY write. Is that possible? I have been chasing my tail with perms.

Paul

Top
#153263 - 2005-12-12 10:18 PM Re: trouble writing to a file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Anything they can do in the script, they can also do from Explorer.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153264 - 2005-12-12 10:25 PM Re: trouble writing to a file
pfarrelli Offline
Fresh Scripter

Registered: 2005-11-16
Posts: 46
I guess maybe restrict privs initially .. elevate privs in script, then write to file, then de-elevate in script?

possible?

Top
#153265 - 2005-12-12 10:49 PM Re: trouble writing to a file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, you could embed UserID and pwd in the script to connect to a specific share if yuo don't mind the security risk.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153266 - 2005-12-12 11:10 PM Re: trouble writing to a file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
in windows world user can't have write access without read access.
and read access requires execution, or was it that execution requires read access.
_________________________
!

download KiXnet

Top
#153267 - 2005-12-12 11:55 PM Re: trouble writing to a file
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Well I wouldn't say it's a WINDOWS issue as it can be dealt with by custom applcations. Netware is a good example where they take control of things and manipulate what can be seen or acted upon.

Many programs do this by using an Administrator account and place a database of rights on a program that then interfaces with Windows and determines what a user can or can not do.

But yes, out of the box no special software Windows users don't have that much granular control.
 

Top
#153268 - 2005-12-13 10:15 AM Re: trouble writing to a file
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Hmm...

IIRC some of the security levels (B2? C2?) require that you can write a file but not read it, so it should be possible.

You could try adding group "CREATOR OWNER" to the directory and explicitly deny read access. This will allow the user to create the file, but the permissions when applied will deny read access.

I've just started using "CREATOR OWNER" on a share where I want everyone to have access to the data and to be able to read and write their own files but not change or remove anyone elses files.

Top
#153269 - 2005-12-13 02:41 PM Re: trouble writing to a file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, maybe so, but "v:\NAVUP-10-TOOLS\nav-report.txt" does not look like an individual creator owner kind of file.
Another approach might be to use a database instead of a flat file or to write to the event log instead.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 484 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.094 seconds in which 0.061 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org