[LNET] FTP Authenticate return true each time lazarus / 5-Lazarus Extra Components ---------------------------------------------------------------------- vexal · 2008-12-15 16:21 Hi, I installed lnet 0.6.2 and i try to send a file by FTP. The connection is ok but the authentification method return true all the time even if i put a wrong password/user. so i cannot send a file. Do you have an idea ? I am using the non visual component ---------------------------------------------------------------------- Almindor · 2008-12-16 17:22 Are you using CallAction properly? Btw. FTP.AnyMethod will return RIGHT AWAY with the result indicating if the given command was SENT succesfully (or queued), not executed. Execution of commands is aynchronous and is done via the OnSuccess and OnFailure handlers. Make sure to set your StatusSet properly too so you receive confirmation of results for what you need. ---------------------------------------------------------------------- vexal · 2008-12-17 10:02 Hi, Thank you for your answer. You are right, i did not use the onsuccess and onfailure handlers. Now i am connected but not authenticate. Here is a part of my code. can you tell me what is wrong with it please ? Code: [Select] Create =>   BoCancel := false;   FTPConnected := False;   FTPClient := TLFTPClient.Create(nil);   FTPClient.Timeout := 50;   FTPClient.Binary := true;   FTPClient.PipeLine:= false;   FTPClient.StatusSet:= [fsUser, fsPass];   FTPClient.TransferMethod:=ftPassive   FTPClient.OnConnect := @FTPOnConnect;   FTPClient.OnReceive := @FTPOnReceive;   FTPClient.OnControl := @FTPOnControl;   FTPClient.OnSent := @FTPOnSent;   FTPClient.OnError := @FTPOnError;   FTPClient.OnSuccess := @FTPOnSuccess;   FTPClient.OnFailure := @FTPOnFailure;   FTPFile := nil;   FTPGetting := False; ------------------------------------------------------- FTPOnConnect =>   FTPConnected := True; ------------------------------------------------------- FTPOnSuccess =>   EnStatus := 1; ------------------------------------------------------- FTPOnFailure =>   EnStatus := -1; ------------------------------------------------------- Connection =>   FTPClient.Connect(ChFtpServeur, EnFtpPort);   repeat     FTPClient.CallAction;   until (BoCancel or FTPConnected);   EnStatus := 0;   FTPClient.Authenticate(ChFTPUtilisateur, ChFtpMdp);   repeat     FTPClient.CallAction;   until (BoCancel or (EnStatus <> 0)); ---------------------------------------------------------------------- Almindor · 2008-12-20 11:00 Are you using .CallAction properly? If you're not using the visual components, you must integrate .CallAction into your main loop, or a thread of its own. ---------------------------------------------------------------------- vexal · 2009-01-05 07:58 As you can see in my code above, i use CallAction but is it the good way ? maybe i miss something ? I used the smtp et telnet part of lnet and it is working well. I don't know why with the ftp it is not working i do about the same. ---------------------------------------------------------------------- Almindor · 2009-01-07 10:45 You're calling .CallAction alright, but I'm not sure what happens then. Does your code get to the point where the repeat loop ends itself? Do you get any events along the way? No receives? (FTP servers send messages with errors, might be helpful too) ---------------------------------------------------------------------- vexal · 2009-01-16 08:44 Hi, My repeat loop ends well because i have an event fired : Failure  The message from FTP is : 530 Please login with USER and PASS I verified my login and password and they are rigth (Filezilla can connect without problems) I also tried other FTP servers but still the same problem : Connection succeed but Authentification fails. ---------------------------------------------------------------------- Almindor · 2009-01-16 09:38 Hmm, I had this problem with certain M$ servers before but it got fixed. Would it be possible to make me an account so I can test? The problem is related to the fact that USER and PASS commands sometimes must be sent at once, sometimes the servers kind of demand them to be separated. ---------------------------------------------------------------------- vexal · 2009-01-16 10:59 Thank you ! I send you a PM with a test account