Clipper On Line • Ver Tópico - Letodb -> leto_users
Página 1 de 1

Letodb -> leto_users

MensagemEnviado: 22 Set 2015 18:52
por asimoes
Pessoal,

Estou qurendo testar um acesso ao servidor letodb informando usuário e senha:

Meu código de teste é esse:

cServidorDB:='//'+cIpAddServer+':'+cPortaServer+HB_PS()

DO WHILE Leto_Connect( cServidorDB, "admin", "senha"   ) == -1
nRes := leto_Connect_Err()
      IF nRes == LETO_ERR_LOGIN
         hwg_MsgStop("Login failed","Erro")
      ELSEIF nRes == LETO_ERR_RECV
          hwg_MsgStop("Recv Error","Erro")
      ELSEIF nRes == LETO_ERR_SEND
          hwg_MsgStop("Send Error","Erro")
      ELSE
          hwg_MsgStop("No connection","Errro"
      ENDIF
      hwg_DoEvents()
ENDDO


No letodb.ini

Habilitei:

; if 1, user authentication is necessary to
; login to the server;
Pass_for_Login = 1

Tem também Pass_File = "leto_users"

É neste arquivo que se grava os usuários/senhas para acesso?

Já procurei nao google e não achei uma dica sequer.

Letodb -> leto_users

MensagemEnviado: 28 Set 2015 22:14
por esbasso
Não tentou isso

4.2 Authentication

To turn authentication subsystem on you need to set one of the following
letodb.ini parameters to 1: Pass_for_Login, Pass_for_Manage, Pass_for_Data. But before
you need to create, at least, one user with admin rights, because when authentication
subsystem works, only authenticated users with admin rights are able to add/change users
and passwords.
To add a user, you need to include a call of LETO_USERADD() in your client side
program, for example:

LETO_USERADD( "admin", "secret:)", "YYY" )

where "YYY" is a string, which gives rights to admin, manage and write access. You may
also use the utils/manager/console.prg program to set or change authentication data.

Pelo que entendi é necessário primeiro criar um usuario com direitos administrativos e depois adicionar os demais usuarios
No ini tem de ter
Pass_File = "leto_users" - the path and name of users info file;

Letodb -> leto_users

MensagemEnviado: 29 Set 2015 09:45
por asimoes
Olá Esbasso,

Fiz o seguinte:

No letodb.ini

; if 1, user authentication is necessary to
; login to the server;
Pass_for_Login = 1

Tentei:

LETO_USERADD( "admin", "secret:)", "YYY" )

Antes do

DO WHILE Leto_Connect( cServidorDB, "admin", "secret:)" ) == -1
      nRes := leto_Connect_Err()
      IF nRes == LETO_ERR_LOGIN
         hwg_MsgStop("Login failed")
         lConnect:=.F.
         EXIT
      ELSEIF nRes == LETO_ERR_RECV
         hwg_MsgStop("Recv Error")
         lConnect:=.F.
         EXIT
      ELSEIF nRes == LETO_ERR_SEND
         hwg_MsgStop("Send Error")
         lConnect:=.F.
         EXIT
      ELSE
         hwg_MsgStop("No connection")
         lConnect:=.F.
         EXIT
      ENDIF
      hwg_DoEvents()
   ENDDO


E sempre dá Login failed

Letodb -> leto_users

MensagemEnviado: 29 Set 2015 09:49
por asimoes
O que eu não entendi é como informar os usuários no leto_users
No letodb.log dá: ERROR! ParseCommand()