PDA

View Full Version : ionED [Enable/Disable]


mr_F_2
01-28-2004, 07:24 PM
little script I wrote, i like being able to disable or enable single users.

site command syntax:

site enable <user>
-or-
site disable <user>

adds a flag "X" to the users flags when they are disabled.


Example:

Connected to mr_Fs_site
220 edited sitename :D
USER testusr
530 Login failed, account [testusr] is disabled



site enable
200---[site enable/disable]--
200-usage : site enable <user>
200-usage : site disable <user>
200 Command successful.



get it from http://nrscripts.staghosting.com/io-scripts.htm

source code in C is there too, so if you want you can modify the output of the program or whatever you want to.

< mr_F >

Xn3t
01-29-2004, 10:32 AM
works fine! good job. Only one req, when i type site enable/disable of an user that it doesn't exist in site, script sends the same msg. If user doesn't exist must reply me 'user doesn't exist' for example.

thx m8 :)

hot_pit
01-29-2004, 04:13 PM
good work dude :D

mr_F_2
01-29-2004, 04:57 PM
your wish is my command :)

script updated, same link

default output is:

<commandline_here> command failed, user [<username_here>] doesn't exist


peace

--- mr_F

Xn3t
01-29-2004, 05:21 PM
thxxxx :)

Mr_X
01-29-2004, 08:28 PM
I installed your script like explain in readme.txt and I restarted ioFTPD. After, I tried to login but it freezes just my ftp client sent USER.
I think I also found 2 bugs in function getflags. I put in attachment source code with my comments (This is the latest version, I checked source code and binary after your update).

mr_F_2
01-29-2004, 10:37 PM
hey Mr_X

you didn't modify the latest version (however I still see your suggestions on the getflags function and will implement them in the next 10 minutes).

As for it not working, I don't know what to say. Considering there's really no set-up it's not like it could be that. Just be sure that you entered everything CaSe sensitively. & make sure in your ..\etc\ioftpd.env file contains:

USER=%[$user]

i'll update the readme to notify of this.
other than that it should work

also
which FTP client you using?

seems that ioFTPD doesn't kill the connection, but rather the FTP client needs to notice it's dead. i'm gonna ask d1 about this.

pz

EwarWoo
01-30-2004, 02:03 AM
Alternatively
Allowed_Users = !F *
site change username flags +F

Good work anyways m8, keep it up :)

Mr_X
01-30-2004, 11:13 AM
I'm using flash fxp 2.2 beta build 961. It's not a client bug because if I disable your script it works. My client send USER and then it freezes and server don't send me anything, and there's a connection timeout.
Everything is ok in ioftpd.env
If you need some files of my config, I can sent you them.

fobban
01-30-2004, 11:44 AM
Mr_X:
The client (FFXP) hangs if it doesn't get a response message (like 550 Could not login blabla) or if you have set the path to pre-user wrong (ie it tries to run the script but can't find it = hangs)

Mr_X
01-30-2004, 11:55 AM
The client don't get any messages. It wait for a message. The server (script) should send a 530 (If account is disabled. That couldn't be possible because i installed script and make a restart of io and then try to login) or a 331 but don't send anything. I also tested it in DOS with ftp command (Win2K), I got same freezing.
I checked also path before posting and if there was a missing EXEC or something else. I don't know why it's freezing.

toki
01-30-2004, 12:14 PM
Originally posted by EwarWoo
Alternatively
Allowed_Users = !F *
site change username flags +F

but anybody who should be able to enable or disable users must have site change flags permission for that.

with ed script that is not needed. simple two cmds must be allowd for desired enablers/disablers... u can also set more people to disable then to reenable a user i think *g*

nice script!!!

Mouton
01-30-2004, 04:42 PM
remark on alternative: F is reserved flag for fxp denied... use something else or u'll have surprises! ;)

mr_F_2
01-30-2004, 05:42 PM
Originally posted by Mr_X
The client don't get any messages. It wait for a message. The server (script) should send a 530 (If account is disabled. That couldn't be possible because i installed script and make a restart of io and then try to login) or a 331 but don't send anything. I also tested it in DOS with ftp command (Win2K), I got same freezing.
I checked also path before posting and if there was a missing EXEC or something else. I don't know why it's freezing.

I don't know what to tell you :( It should work, unless you modified the source. Do you have any other scripts on Pre User? that could be screwing it up.

it's weird that it doesn't even work in the console. I just updated the version, get it below:: hopefully that fixes it

also mentioned about the !F * method, (or the !X * method, whatever letter you use) cunhell is right, this requires giving any users "disable/enable" functionality to have access to "site change". that's no good... therefore site enable/disable makes a nice little pack that you can give power to whoever you want on your ftp without consiquence of site change passwd ...etc being avail.
and also what he said, you can give enable or disable permissions to whoever you want to :) Gadmin can maybe disable users, but only Siteop or Master can enable.. :) it's up to you

Mouton
01-31-2004, 09:23 AM
other remark: SITE CHANGE permissions are atomic... ie u can give access to SITE CHANGE ... FLAGS and not to any other SITE CHANGE ... XXX

[Change_Permissions]
...
flags = 1MX
...

toki
02-03-2004, 03:26 AM
possible to add a config to choose which flag is the disable flag? i do not use X flag atm for other things but maybe dynamic seeting in a cfg file would be useful.

toki
02-03-2004, 04:08 AM
but user can then change flags of any other user... i think that is not a good solution... @ mouton

toki
02-03-2004, 07:37 AM
220 ready
USER xxxxx
USER command failed, user [xxxxx] doesn't exist
331 Password required for xxxxx.
PASS (hidden)
230-Welcome to ioFTPD server (registered version 5.6.3r)
.
.
.


and so on... so login works here with smartftp but i get user doesnt exist?

disabled ionED and message was gone.

suggestions?

mr_F_2
02-03-2004, 08:30 AM
cunhell, this is the sourecode for that section:


if (flags==NULL)
{
printf("%s command failed, user [%s] doesn't exist\n",argv[1],user);
return 0;
}

so i assume your user has absolutely no flags? that's kind of odd

also you can change the flag in the source code (source is available at my website).
I could throw in an ini reading routine, but that would be such a waste of milliseconds for reading only 1 key

toki
02-03-2004, 08:33 AM
u got 100 points...

mr_F_2
02-03-2004, 08:39 AM
Originally posted by cunhell
u got 100 points...

lol
why would you give a user no flags? the poor *******, give him something :D

if you think this is problem tho i'll change it.
let me know

also read above ^^ about changing the flag

peace

toki
02-03-2004, 08:43 AM
hmm... maybe for any possible flag conf it might be fixed in rls... and hex edit :o) lets see *g* maybe i will compile source on my own

toki
02-03-2004, 08:50 AM
compiling works... what if i delete that comparison? any need for this "no flag" check?

mr_F_2
02-03-2004, 05:45 PM
*sigh*

i changed it, for you. i dont know why your users don't have flags tho, that scares me like a scarecrow scares corn

added code to getflags function:


if (usrfile[0]==0)
{
printf("command failed, user [%s] doesn't exist\n",ofuser);
exit(0);
}

so if no userfile is found that warrents a user not existing. no flags now just means no flags.

source : http://nrscripts.staghosting.com/src/io/ionED.c
binary : http://nrscripts.staghosting.com/dl/io/ionED.zip

typhon|wk
02-04-2004, 05:55 AM
work fine

but when 1 disabled user try to login my cpu work at 100%, and continue to work so for about 15 secs for each re-try from flashfxp

so if disabled user hammer the ftp the pc can crash.

if it is possible add a customizable choice for flag to disable users

fix it and ur script 'll be wonderfull

thx

:)

Xn3t
02-04-2004, 06:15 AM
works fine m8 ;)

good job!

mr_F_2
02-04-2004, 10:53 AM
Originally posted by typhon|wk
work fine

but when 1 disabled user try to login my cpu work at 100%, and continue to work so for about 15 secs for each re-try from flashfxp

so if disabled user hammer the ftp the pc can crash.

if it is possible add a customizable choice for flag to disable users

fix it and ur script 'll be wonderfull

thx

:)

CPU always jumps when a user logs in no matter what. I don't have the problem about it going to 100% ... I'll run vtune on it and make it faster, but really, there's not much to optimize here, it's really simple code.

I'm not adding an ini reader (for customized flag) as it would slow down the application runtime and it's totally not worth it for reading just 1 key

it's not hard to edit the source code and compile it, so if you want a different flag you'll have to do it yourself.

toki
02-04-2004, 11:32 AM
jepp compilining with new flag is easy. affirmative