Checkmark

Security
Aptilis 1

Checkmark(String)

CheckMark allows you to check that a password against a marked directory. You can mark a directory with mark

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.
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 passwords match, -1 otherwise.
Note that if there is no passw file (ie. the directory has not been marked) in the directory you're checking, the return will also be -1.

Example:

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

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

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

print(v1, "\n", v2)

Result:
0.0000
-1.0000