PDA

View Full Version : username password regex


gastonramirez
03-25-2010, 05:03 AM
HI there, I use ioftpd as home server for a while now.

And i want now to automate user registration through a php interface.

And Im "stop" cause I don't know which characters are allowed or not for username/password.
so I try to find it into the different files which make ioftpd but I don't find/see what I want.
If someone may help me for that will be cool.

Yil
03-26-2010, 10:25 AM
The validation function is called IsName() in RemoteAdmin.c. To save you looking it up, here are the rules:

+-= are disallowed when used as the first character of a group or user name but are otherwise ok.

|"*:\/?.<> and spaces are disallowed in user/group names anywhere.

A web based PHP script that logs into the server and issues "site adduser/gadduser" would be easy enough to do. Or you could use the shared memory interface. As an interesting aside you may want to check out the OnUnknownLogin feature. From the ChangeLog:

90) New ioFTPD.ini event (OnUnknownLogin under [Events]). If the USER command
entered by the user during login refers to an unknown user name then this
event will be called. If it returns true, which normally would indicate
an error, the user lookup is performed again. The addition of this event
should allow the dynamic creation of new user accounts which may be useful
if there are thousands of them stored in an Active Directory or other 3rd
party database and waiting to import them until they have been referenced
makes sense. Also useful in conjunction with a shared user module that
doesn't expect every account to use the server. Default is undefined.