Mark

Security
Aptilis 1

Mark(String)

Mark marks the current directory with a password of your choice.
To mark another directory, use changeDirectory.
The password you choose is encrypted and written in file called 'passw', so you must be careful not to erase this file.
Use checkMark to check a password.
The main use of this fairly low level and weak feature is to allow you to ask someone a password before you might allow them to read or write in a given directory, especially from a web script.
This scheme is independant from the usual UNIX security mechanisms. Someone with the necessary login/password could still write in a marked directory. If security is paramount for your application, you should envisage other ways to do it and possibly discard Aptilis.

Return value:
0 if the directory has been marked correctly, -1 otherwise.
The most likely error will happen under UNIX, if do not have write permissions in the directory you're trying to mark, check _errno to be sure. In case of problems, you must refer to your sys-admin.

Example:

// We are marking the current directory
mark("motDePasse")

// this one will work
v1 = checkmark("motDePasse")

// but this one won't...
v2 = checkmark("I don't know the password")

print(v1, "\n", v2)

Result:
0.0000
-1.0000