Ftp @ in username problem

Moderator: Rathinagiri

hynan
Posts: 25
Joined: Sat Jun 29, 2013 7:00 pm

Ftp @ in username problem

Post by hynan »

Hi all,
My webhost only allow @ in username when making extra ftp accounts
I found already this:
/* Comprobamos si el usuario contiene una @ para forzar el userid */
IF At( "@", cUser ) > 0
oFTP:oUrl:cServer := cServer
oFTP:oUrl:cUserID := cUser
oFTP:oUrl:cPassword := cPassword
ENDIF

Try to implement it, but cannot get it to work,
i think ( as dummy ) oFTP:Open ( cURL ) has still the @ in username ?
Or ?
My code, ftp is working, i will delete account after i get it to work:

*---------------------------------------------------------------------------*
FUNCTION FTPUPLOAD ( cFILE )
*---------------------------------------------------------------------------*
LOCAL lOK := .F.
LOCAL cUSER := "Eldemo@johnsjn22.twentytwo.axc.nl"
LOCAL cSERVER := "johnsjn22.twentytwo.axc.nl"
LOCAL cPASSWORD := "12345"
LOCAL cUrl := "ftp://" + cUSER + ":" + cPASSWORD + "@" + cSERVER
LOCAL oURL := tUrl():NEW ( cURL )
LOCAL oFTP := tIPClientFtp():NEW ( oURL, .F. )

oFTP:nConnTimeout := 20000
oFTP:bUsePasv := .F.
oFTP:oUrl:cServer := cSERVER
oFTP:oUrl:cUserID := cUSER
oFTP:oUrl:cPassword := cPASSWORD

IF oFTP:Open ( cURL )
? "OK"
oFTP:CLOSE ()
ELSE
? "Error"
ENDIF

RETURN ( lOK )

*---------------------------------------------------------------------------*

Thanks and greetings...
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Ftp @ in username problem

Post by serge_girard »

Hynan,

Try this with correct login/pw:

Code: Select all

FUNCTION FTPUPLOAD()
*---------------------------------------------------------------------------*
LOCAL lOK         := .F.
LOCAL cUSER       := "Eldemo"
LOCAL cSERVER     := "johnsjn22.twentytwo.axc.nl"
LOCAL cPASSWORD   := "12345"
LOCAL cUrl        := "ftp://" + cUSER + ":" + cPASSWORD + "@" + cSERVER
LOCAL oFTP        := tIPClientFtp():NEW ( cUrl )

IF oFtp:open()
   msginfo( StrValue(oFtp:cReply) + ' ' + StrValue(oFtp:lastErrorMessage()) , 'ok')
   lOK         := .t.
   //oFTP:CLOSE ()
ELSE
   msginfo( StrValue(oFtp:cReply) + ' ' + StrValue(oFtp:lastErrorMessage()) , 'nok')
ENDIF

RETURN ( lOK )


FUNCTION StrValue( string, onoff )
/*********************************/
LOCAL retval := pNULL

onoff := Valid_parm( onoff, pLOGICAL, FALSE )

DO CASE
CASE VALTYPE( string ) = pCHARACTER
	retval := string

CASE VALTYPE( string ) = pNUMERIC
	retval := LTRIM( STR( string ) )

CASE VALTYPE( string ) = pMEMO
	retval := IF( (LEN(string) > (MEMORY(0) * 1024) * .80), ;
						SUBSTR(string,1, INT((MEMORY(0) * 1024) * .80)), ;
						string )

CASE VALTYPE( string ) = pDATE
	retval := DTOC( string )

CASE VALTYPE( string ) = pLOGICAL
	retval := IF( ( onoff ), IF(string, "On", "Off"), ;
				 IF(string, "True", "False") )
OTHERWISE
	retval := ''

ENDCASE

RETURN( ALLTRIM(retval) )

Greetings, Serge
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Ftp @ in username problem

Post by serge_girard »

Hynan,

Error is now: 530 Login incorrect.

Serge
There's nothing you can do that can't be done...
hynan
Posts: 25
Joined: Sat Jun 29, 2013 7:00 pm

Re: Ftp @ in username problem

Post by hynan »

Hi,
And thanks for thinking with me

cUSER := "Eldemo@johnsjn22.twentytwo.axc.nl"
must be that way
i did try with ftp program with this and its working

Greetings...
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Ftp @ in username problem

Post by danielmaximiliano »

I can use that username and password to authenticate to the FTP server?

User OK
Login :cry:
20140521-11:18:45 :INETCONNECT( johnsjn22.twentytwo.axc.nl, 21 )
>> <pointer> <<

20140521-11:18:45 :INETERRORCODE( <pointer> )
>> 0 <<

20140521-11:18:45 :INETRECVLINE( <pointer>, , 128 )
>> 220 ProFTPD 1.3.4d Server ready. <<

20140521-11:18:45 :INETERRORCODE( <pointer> )
>> 0 <<

20140521-11:18:45 :INETSENDALL( <pointer>, 13, USER Eldemo<cr><lf> )
>> 13 <<

20140521-11:18:46 :INETRECVLINE( <pointer>, , 128 )
>> 331 Password required for Eldemo <<

20140521-11:18:46 :INETERRORCODE( <pointer> )
>> 0 <<

20140521-11:18:46 :INETSENDALL( <pointer>, 12, PASS 12345<cr><lf> )
>> 12 <<

20140521-11:18:46 :INETRECVLINE( <pointer>, , 128 )
>> 530 Login incorrect. <<

20140521-11:18:46 :INETERRORCODE( <pointer> )
>> 0 <<
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
hynan
Posts: 25
Joined: Sat Jun 29, 2013 7:00 pm

Re: Ftp @ in username problem

Post by hynan »

Hi danielmaximiliano,

I only know,
i tested ftp login
( i copy/paste from source in this post to make sure )
LOCAL cUSER := "Eldemo@johnsjn22.twentytwo.axc.nl"
LOCAL cSERVER := "johnsjn22.twentytwo.axc.nl"
LOCAL cPASSWORD := "12345"
and it works
i did use totalcommander ftp function
maby any login name ftp server ask for password

Greetings and thanks...
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Ftp @ in username problem

Post by danielmaximiliano »

hynan wrote:Hi danielmaximiliano,

I only know,
i tested ftp login
( i copy/paste from source in this post to make sure )
LOCAL cUSER := "Eldemo@johnsjn22.twentytwo.axc.nl"
LOCAL cSERVER := "johnsjn22.twentytwo.axc.nl"
LOCAL cPASSWORD := "12345"
and it works
i did use totalcommander ftp function
maby any login name ftp server ask for password

Greetings and thanks...
the FTP server might work in safe mode and need secure authentication
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
hynan
Posts: 25
Joined: Sat Jun 29, 2013 7:00 pm

Re: Ftp @ in username problem

Post by hynan »

Hi,

***
the FTP server might work in safe mode and need secure authentication
***
I think not
with main ftp account ( no @ in username )
same settings in ftp program as Eldemo account
both works ok

In Harbour with main ftp account ( no @ in username )
works ok.

Only account with @ in username gives problem

Thanks and greetings.
hynan
Posts: 25
Joined: Sat Jun 29, 2013 7:00 pm

Re: Ftp @ in username problem

Post by hynan »

Hi all,

Did some testing with main ftp account,
what is working OK in Harbour

LOCAL cUSER := "GOODACCOUNTNAME"
LOCAL cSERVER := "johnsjn22.twentytwo.axc.nl"
LOCAL cPASSWORD := "12345"
LOCAL cUrl := "ftp://" + "NOTGOODACCOUNTNAME" + ":" + cPASSWORD + "@" + cSERVER

oFTP:oUrl:cServer := cSERVER
oFTP:oUrl:cUserID := cUSER
oFTP:oUrl:cPassword := cPASSWORD

Works not, because
oFTP:oUrl:cUserID := cUSER
does not doing what it should do ?

Thanks and greetings...
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Ftp @ in username problem

Post by danielmaximiliano »

hynan wrote:Hi all,

Did some testing with main ftp account,
what is working OK in Harbour

LOCAL cUSER := "GOODACCOUNTNAME"
LOCAL cSERVER := "johnsjn22.twentytwo.axc.nl"
LOCAL cPASSWORD := "12345"
LOCAL cUrl := "ftp://" + "NOTGOODACCOUNTNAME" + ":" + cPASSWORD + "@" + cSERVER

oFTP:oUrl:cServer := cSERVER
oFTP:oUrl:cUserID := cUSER
oFTP:oUrl:cPassword := cPASSWORD

Works not, because
oFTP:oUrl:cUserID := cUSER
does not doing what it should do ?

Thanks and greetings...
can you tell me how to create a new user and the requirements demanded by the web server?
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply