LetoDBF with user access control

1,143 views
Skip to first unread message

Marek MOL

unread,
Sep 14, 2018, 5:28:23 AM9/14/18
to Harbour Users
I'm using LetoDBF Fork.
Everything works great without users and passwords, but I need to add user control to my database.
I'm trying to add user via console.exe but, I'm getting message: User not added

What special configuration I need t ocreate to work with this?

Regards, Marek Olszewski

elch

unread,
Sep 20, 2018, 6:51:16 AM9/20/18
to Harbour Users
Hi Marek,

... I need to add user control to my database.
I'm trying to add user via console.exe but, I'm getting message: User not added

that needed some fixes, i have uploaded a new version.
Some fixes were in the frontend 'console', some in the LETO lib it uses,
and very minor at server side --> rebuild all.

This is a bit untested area, and please report if something does not work.
There is no risk, as this does NOT touch your databases, it only limits the 
allowed connections to the server.


----
Section: '4.3 Authentication' in 'Readme.txt' describe the basic steps,
where the [admin] user can (now;) be added also with the console.

Setting afterwards: 'authentication required' in the server config,
we must use it also for the console:
console[.exe] [ IP[:port ]  ]  [ username ] [ password ]
e.g.: console 127.0.0.1 admin secret

The user-database is ( blowfish ) encrypted with a hardcoded password,
where hardcoded means it is burned *into* the executable.
It maybe better to be personalized [ __RANDOM_STRING__ in 'include/funcleto.h' ]
It even can be randomized [ activating option 'plugrand.hb' in 'letodb.hbp' ],
but this with disadvantage that each server executable 
update needs a new user-database to be created, the old one deleted.


best regards
Rolf

elch

unread,
Sep 20, 2018, 7:02:05 AM9/20/18
to Harbour Users
addendum, Marek

in your application,
we need to READ beforehand the user and password for the Leto_Connect(),
as there is nothing in the LETO library for doing it.
For the password you nicely can use GETSECRET()  [CT lib, 'hbct.hbc' ],
it is used e.g. in console.prg ..

best regards
Rolf

Paul Smith

unread,
Sep 22, 2018, 8:03:36 PM9/22/18
to Harbour Users
Hi Marek

Any luck?
I can't get it to work either, the file "leto_users" doesn't seem to be created.

Also I can't get the zombie check part of letto_connect to work and close down after a broken connection.
So if a file is opened exclusively when the connection is broken the server keeps exclusive control of it and no one else can access it.

Cheers
Paul

Marek MOL

unread,
Sep 23, 2018, 3:00:33 AM9/23/18
to harbou...@googlegroups.com
I had no time to test it. Maybe this evening....

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to a topic in the Google Groups "Harbour Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-users/lKCaAbJ9HPQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

elch

unread,
Sep 23, 2018, 11:30:15 AM9/23/18
to Harbour Users
Hi Paul,

feel welcome! to ask if something does not work,
in case it is a bug it may spare others time ...


I can't get it to work either, the file "leto_users" doesn't seem to be created.

File 'leto_users' is created (by default) in directory of the server executable.
This will make problems if the user who started the server,
( or for Unix systems the user configured in 'letodb.ini with "Server_*" )
have no write access to that directory.
There is an undocumented option in 'letodb.ini' to change [/path/] name:
Pass_File = leto_users


Uploaded a fix, that the user credentials file is deleted when the last user
is deleted -- added in 'ReadMe.txt' a note that manually deleting this file
needs a server restart/ reset options -- added a possibility to set at command
line a password used for its encryption.


-----

Also I can't get the zombie check part of letto_connect to work and close down after a broken connection.
 
( with exeption for xHarbour where it is ever .F. ),
the 6th param of Leto_Connect() should be .T. -- aka don't touch if not very sure.

It enables a second thread for your your application, which handle a second
connection to the server -- needed *mainly* for performance.
This second thread/connection is *also* used for this 'zombie check' ;-),
then the ( so configured! ) server sends periodically requests to 'quiet' 
clients.
This is intended for 'hanging' [ 'living dead' ;] applications,
but Harbour application don't do so .. :-)

 
So if a file is opened exclusively when the connection is broken the server keeps exclusive control of it and no one else can access it.

Before starting to fix a possible existing problem 'at the wrong end',
aka using 'zombie detect', please describe the problem a bit more precisely,
when and in which environment a 'broken' connection is not detected.
( as that will close all opened files .. )

best regards
Rolf

Paul Smith

unread,
Sep 24, 2018, 12:24:51 AM9/24/18
to Harbour Users
Thanks Rolf

Firstly apologies Marek, for hijacking your thread

I've got the  user  access control to work by naming the file correctly in letodb.ini
In the letodb.ini  file line 18 is ;Pass_File = "leto_users" 
and in readme.txt line 428 it says Pass_File = "leto_users"
but it really needs to be Pass_File = leto_users  ( without the " " )
I misinterpreted the instructions.

In my version of windows 7 leto_users is created in the same sub-directory as letodb.exe
but in windows 10 it was created in Windows\SysWOW64\ resetting sharing rights seemed to fix that

I'm still having trouble with paths, I can only start an application with user access control
from the sub directory where letodb.exe and leto_users are.
I have been passing the parameters from the command line with start c:\other\directory\my.exe  cAddress cUser cPasswd
and starting the code with:

PROCEDURE MAIN(cAddress, cUser, cPasswd )
SET( _SET_FORCEOPT, .T. )
leto_Connect( cAddress, cUser, cPasswd, 21000, , .T. )

How do you do it from the clients location?

Thanks for all your work and patience
Cheers
Paul


Paul Smith

unread,
Sep 24, 2018, 5:19:02 AM9/24/18
to Harbour Users
Hi Rolf

If a password is test ,
1test won't work but test1 will work.

Thanks
Paul

elch

unread,
Sep 24, 2018, 1:36:15 PM9/24/18
to Harbour Users
Hi Paul,


If a password is test ,
1test won't work but test1 will work.

ouch!,
a tiny ( but important ) [same] length check was missing.

OT: maybe an example, why 4 letters makes a bad PW.
-- they can be up to 32 chars long ...

best regards
Rolf

elch

unread,
Sep 24, 2018, 2:26:36 PM9/24/18
to Harbour Users
Hi Paul,

In the letodb.ini  file line 18 is ;Pass_File = "leto_users" 
...
but it really needs to be Pass_File = leto_users  ( without the " " )
I misinterpreted the instructions.

No, you are excused!, the given example/ doc was wrong.
Fixed -- plus now removing given double-quotes ("..") in general.

Plus: if server is configured for user authentication required,
it should not start if the user credentials are not found, as nobody can log into.
( leaving a note in 'letodbf.log' )


----- 

In my version of windows 7 leto_users is created in the same sub-directory as letodb.exe
but in windows 10 it was created in Windows\SysWOW64\ resetting sharing rights seemed to fix that

Development center is 'Win10-free', nuclear-free zone 8-),
so expect less specific help from me for that "OS".

This 'WOW64' indicates LetoDBf is build as 32-bit.
( If Harbour itself is build as 64-Bit with an appropriate C-compiler,
also LETO will be 64-Bit -- a task for the future, to get rid of 32-Bit emulation )
 

I'm still having trouble with paths, I can only start an application with user access control
from the sub directory where letodb.exe and leto_users are.

That sounds W10 specific -- have a look for an recent post from A. Wozniak:
and search a bit the www whats happening ...

---
...
leto_Connect( cAddress, cUser, cPasswd, 21000, , .T. )
 
<nTimeOut> == 21 sec  [ default 120000 == 2 min ]
the timespan, the client application will wait for a response from server,
before giving up and ending! ( by deciding server have a problem )

This is a knife with two cutting edges:
at one edge we want most immediate get feedback about such situation,
at other edge the server may need a moment to respond.

Think of a request: 'create index' for a GB-sized DBF, or an long lasting UDF call ...
During such task, the server does not check the network status,
so it will also not notice a 'shut-down' network connection done by this 'zombie-check'.

Whereas a 'really' broken network connection should be noticed by the client,
when waiting for an response ...

best regards
Rolf

Paul Smith

unread,
Sep 30, 2018, 9:24:36 AM9/30/18
to Harbour Users

Before starting to fix a possible existing problem 'at the wrong end',
aka using 'zombie detect', please describe the problem a bit more precisely,
when and in which environment a 'broken' connection is not detected.
( as that will close all opened files .. )



Hi Rolf
This is the scenario where a broken connection does not seem to be detected
Thanks
Paul


 
Server: 
Letoddb.ini contains Zombie_Check = 10

Client:
compiled with -mt 
contains leto_Connect( cAddress, cUser, cPasswd, 21000, , .T. )

Client accesses dbf files exclusively on server
Turn off client computer
Files remain opened exclusively on the server and can not be accessed by the client when restarted

Marek MOL

unread,
Oct 3, 2018, 12:19:49 PM10/3/18
to Harbour Users
I'm trying to test new version of LetoDBF, but I'm still getting strange behaviour.
Simple code
#include <minigui.ch>
#include <fileio.ch>
#include "dbinfo.ch"


function MAIN

    local lOpenNew := .t.
    local cServer := "127.0.0.1"
    local cUser := ""
    local cPass := ""
   
    REQUEST HB_GT_WIN_DEFAULT

    REQUEST HB_CODEPAGE_PLWIN
    REQUEST LETO 

    nStatusLETO := LETO_CONNECT( "127.0.0.1", cUser, cPass)
   
    if nStatusLeto < 0
        ? "Error: No connection to server"
        quit
    endif
   
    // create test table no. 1
    aDbDef    := { {"ID", "C", 1, 0}, {"Login", "C", 5, 1}, {"Name","C",5, 0} }
    aData    := { { "1", "z1", "ZZZZZ"}, {"3", "b3", "BBBBB"}, {"2", "a2", "AAAAA" } }
    DBCreate( "test", aDbDef, "LETO", lOpenNew, "test")
   
    select("test")
    index on ID to test1
    index on Login to test2
    index on Name to test3
    set index to test1, test2, test3
   
    for i:=1 to len(aData)
        append blank
        replace;
            ID    with aData[i,1],;
            Login with aData[i,2],;
            Name with aData[i,3]
    next i
   
    aDbDef    := { {"ID", "C", 1, 0}, {"Login", "C", 5, 1}, {"Name","C",5, 0} }
    aData    := { { "1", "z1", "ZZZZZ"}, {"3", "b3", "BBBBB"}, {"2", "a2", "AAAAA" } }
    DBCreate( "db2", aDbDef, "LETO", lOpenNew, "db2")
   
    select("db2")
    index on ID to db21
   
    for i:=1 to len(aData)
        append blank
        replace;
            ID    with aData[i,1],;
            Login with aData[i,2],;
            Name with aData[i,3]
    next i
   
    ? "number of records in table TEST:", test->(reccount())
   
    if db2->(DBSeek("3"))
        lOK := db2->(RecLock())
    else
        lOK := db2->(AddRec())
    endif

    ? "number of records in table TEST:", test->(reccount())
   
    if lOK
        replace;
            db2->Login    with "CCCCCC",;
            db2->Name    with "cccccc"
            db2->(DBRUnlock())
    endif
   
    ? "number of records in table TEST:", test->(reccount())
    inkey(0)

    close databases
   
return
*------------
function AddRec
    append blank
return .t.
*------------
function RecLock
   
return rlock()


works fine as standalone sample, but when I nest it at the begin of my huge application reports 0 records in table TEST1 after third inspection of this...

I can't isolate problem.
When I've returned to june version, everything works OK.

Did anybody noticed strange behaviour of this new version?

Marek MOL

unread,
Oct 3, 2018, 2:47:52 PM10/3/18
to Harbour Users
Answer below:


number of records in table TEST:3 Curr.Recno: 3
After seeking in DB2, number of records in table TEST:3 Curr.Recno: 3
After replacing record in DB2, number of records in table TEST:0 Curr.Recno: 3

Function RecNo returns 3 but RecCount returns 0 - what's going on???
Marek

Paul Smith

unread,
Oct 3, 2018, 11:57:11 PM10/3/18
to Harbour Users
Hi Marek

I get  :

number of records in table TEST:         3
number of records in table TEST:         3
number of records in table TEST:         3

Letodbi.ini 
IP = 127.0.0.1

rddleto.ini
IP = 127.0.0.1

I commented out, #include <minigui.ch>
as I don't have it
This is the same for windows 7 and 10,  32 and 64 bit

I take it your getting 
3
3
0

Cheers
Paul

elch

unread,
Oct 4, 2018, 2:34:32 PM10/4/18
to Harbour Users
Hi Marek,
...
Function RecNo returns 3 but RecCount returns 0 - what's going on???

indeed, that sounds scary.
And i still cannot imagine how that could happen.

'RecNo()' works fully at client side -- as this info is send together with record-data from server.
A 'RecNo()' > 0 indicates that a valid workarea is selected [ aka 'Alias()' returns a string ].

For 'RecCount()' [ or 'LastRec()' ] a request is send to server, *if* a valid workarea is selected.
Then the server does an original Harbour method [ 'SELF_RECCOUNT(..)' ] and responds the value.

'0' sounds like no request is send.

We may debug for that: start server console monitor -- run the application up to before that RecCount()
-- then change 'ALT_M - D' debug level to '21', and let the 'RecCount()' perform,
-- then reset the debug level to '1'
You should get a 'letodbf_xx.log' ( xx == 01?, the other log is from the console ),
and therein should be (at least) three lines about this 'reccount' request plus answer.

best regards
Rolf

Andrew C

unread,
Oct 5, 2018, 1:42:53 PM10/5/18
to Harbour Users
Hi Marek

I have the  same problem
sometimes recno() returns 0 or wrong number , reccount() returns 0.

To prevent this situation I check reccount() and try close files and application
if reccount()=0
       dbCloseall()  -- break - write error error.log or (and) ErrorLog.htm
       quit
endif

After dbcloseall() application breaks usually .
After rerun application everythink is OK.

I'm not sure,  I suspect thet its occurs after lost connection.
I can't generate the problem in my test environment.

letodb download 16.09.2018
harbour 3.2
Borland C++ 5.5.1
miniguiextended 18.05

clients: WiFi

letodb.ini:
Default_Driver = CDX
share_Tables = 1
No_Save_WA = 0

best regards
Andrew

elch

unread,
Oct 5, 2018, 1:59:39 PM10/5/18
to Harbour Users
Hi Andrew,


I have the  same problem
sometimes recno() returns 0 or wrong number , reccount() returns 0.
really a <wrong> ? [ not '0' ! ] record number ?
 

To prevent this situation I check reccount() and try close files and application
if reccount()=0
       dbCloseall()  -- break - write error error.log or (and) ErrorLog.htm
I am *VERY* interested in any ! more hints about.
What RTE error number appears ?
Can i see such an error log ?

best regards
Rolf

elch

unread,
Oct 5, 2018, 2:07:47 PM10/5/18
to Harbour Users
Again, Andrew



letodb.ini:
Default_Driver = CDX
share_Tables = 1
No_Save_WA = 0

Could you plese test:

No_Save_WA = 1

when problem afterwards still not exist -- that wold be an important hint ...

best regards
Rolf

 

best regards
Andrew

Marek MOL

unread,
Oct 5, 2018, 2:42:58 PM10/5/18
to Harbour Users
There is no lost connection at my side - localhost and the test was the first procedure in the application.

elch

unread,
Oct 9, 2018, 5:58:01 AM10/9/18
to Harbour Users
Hi,

for not obvious, complex bugs,
i need a point where to start the search for them.

Two possibilities:
# standalone snippet
# server log

To get the server log,
increase with console monitor the debug level, this case to: 21
[ ALT-M --> D --> 21 ]

After the bug have appeared, search for the right log file: 'letodbf_xx.log'.
What "xx" can be seen in the console monitor, browse: connections.ID.

These log files will quickly get quite huge, i may not need the whole file.
Ensure a *zip-ped* attach is not bigger than HB-groups limit of 50KB.
! It may contain personal data !, so best to do it in test environment.
If this isn't possible, sent it to my (funny!) PM-address shown in HB-group.


In general, often needed is the letodb.ini ( there are multiple server modes ... )
and sure a description what is not as expected ( if not already explained )

---
Don't forget to reset afterwards server debug level to 1 ...

best regards
Rolf

Marek MOL

unread,
Oct 9, 2018, 9:26:16 AM10/9/18
to Harbour Users
Hi Rolf!
Can you download log from my site?

elch

unread,
Oct 9, 2018, 12:10:26 PM10/9/18
to Harbour Users
Hi Marek,

yes, saved me that logs ...
What last lines tells me:
....
for WA 8 == upr:

RLOCK recno 1; update record plus unlock

then for WA 7 == personel:

DBGoTop() ---> recno 3 data ...
change to index order "3" -- * while positioned at RecNo: ? 755855483 ? *
DbGoTop() ---> recno 3 data ...
* DbGoto( 755855483 ) *
DbGoTop() ---> recno 3 data
change to index order "3" -- while positioned at RecNo: ! 3 !
change to index order "3" -- while positioned at RecNo: ! 4 ! [ EOF ]  (***)
DbGoTop() ---> recno 3 data
RecCount() --> 3

... then all WA are closing ...

(***) here the EOF ( 4 ) record is returned, that should be also RecNo 3 like above
For sure scary looks this RecNo: 755855483


----
You please rebuild that index order -- would not hurt.

I fear it doesn't help,
can i see the related few lines in your source ?

best regards
Rolf

Marek MOL

unread,
Oct 9, 2018, 1:13:07 PM10/9/18
to Harbour Users
Rebuilding indexes does not help.
I've uploaded DBF files and log http://marekolszewski.info/faktury/log_leto2.zip

This is problematic code below:

if personel->(reccount()) == 0
        if personel->(AddRec(0))
            replace;
                personel->Nr_Kolejny    with "000001",;
                personel->login        with "Administrator",;
                personel->Aktywny    with .T.,;
                personel->Nazwisko    with "Administrator",;
                personel->Imie        with "",;
                personel->OdKiedy    with date()
            personel->(DBRUnlock())
       
            if upr->(AddRec(0))
                replace;
                    upr->Nr_Prac    with "000001",;
                    upr->Nr_Upr    with "999999",;
                    upr->Upr        with "YES"

                upr->(DBRUnlock())
            endif
        endif
       
        lPusteHaslo := .t.
       
    else
   
        if upr->(DBSeek("000001999999"))
            lOK := upr->(RecLock(0))
        else
            lOK := upr->(AddRec(0))
        endif
        if lOK
            replace;
                upr->Nr_Prac    with "000001",;
                upr->Nr_Upr    with "999999",;
                upr->Upr        with "YES"
            upr->(DBRUnlock())
        endif
       
    endif

log with db files

elch

unread,
Oct 9, 2018, 1:51:20 PM10/9/18
to Harbour Users
Hi Marek,

found a possible bug which may lead to some unpredicted behavior at server side.
Just uploaded a fix.


...            replace; ....
            upr->(DBRUnlock())
 
Exact about this was a change quite a while ago.
Formerly, first the updated record was send to server,
then in another extra request the unlock happen.

This is 'now' made with one request -- at least i try so ;-(.


---
I made an update earlier this day for Paul,
which needs an overall rebuild ( server, client, console ):

I am NOT sure if the problem is fixed.
Can you please update and try again -- sorry! for the trouble.

If the problem remains, i have to see again a log ...

best regards
Rolf

Marek MOL

unread,
Oct 9, 2018, 2:30:59 PM10/9/18
to Harbour Users
I've downloaded lat commit, compiled lib, letodf service and console.

elch

unread,
Oct 9, 2018, 3:05:11 PM10/9/18
to Harbour Users
Again sorry for the trouble, Marek

at least i can exclude one possible cause for the bug,
but as i already feared it is hiding at other place ...

I keep searching! and report immediately -- earliest tomorrow ...

best regards
Rolf

Marek MOL

unread,
Oct 9, 2018, 3:06:02 PM10/9/18
to Harbour Users
Thank you very much

elch

unread,
Oct 9, 2018, 3:16:27 PM10/9/18
to Harbour Users
Hi Marek,

This is problematic code below:

if personel->(reccount()) == 0
        if personel->(AddRec(0))
...
    else
    endif
 
and here must follow ( according the log ) something about a DbGoTop(),
and an index order change -- can you show me please, it may help ...

best regards
Rolf

Marek MOL

unread,
Oct 9, 2018, 3:24:44 PM10/9/18
to Harbour Users
If I understand you well...
personel.dbf has three simple indexes:
1. Nr_Kolejny
2. Login
3. Nazwisko

upr.dbf has only one index "Nr_Prac + Nr_Upr"

elch

unread,
Oct 10, 2018, 6:01:54 AM10/10/18
to Harbour Users
Hi Marek,

something gets screwed!,
and despite hours search have no explanation why it may happen.
The wrong 'RecCount() = 0' may be just a further consequence.

The server seem to work fine, the bug should hide at client side:

application updates a record in "UPR", then:
DbGoTop() for "PERSONEL" ---> gets record 3 data ...
... then want index order change, claiming to be at record number: 758855483,
should be 3 or so.


-----
I added a debug message in the only function, which set the record number.
Please download -- only the client lib must be rebuild, no changes for server.

Compile the lib with these two flags for C-level:
hbmk2 rddleto[addon] -cflag=-DHB_TR_LEVEL=5 -cflag=-DLETO_CLIENTLOG=1

Add into your source code two lines at very start in main() function:
hb_tracelevel(5)
hb_traceFile( "C:\temp\trace.txt" )
( file-path must be adapted, directory must exist )

Compile your application also with one flag:
hbmk2 ... -cflag=-DHB_TR_LEVEL=5

Run your application

After ending, we should have two files:
trace.txt
<name_of_executable>.log -- in directory of your executable.


Thanks
Rolf

Marek MOL

unread,
Oct 10, 2018, 8:07:26 AM10/10/18
to Harbour Users
I hope, I was compiled everythig OK.
I'm using Harbour Minigui, not hbmk2 directly.

Andrew C

unread,
Oct 10, 2018, 9:29:21 AM10/10/18
to Harbour Users
Hi Rolf


W dniu piątek, 5 października 2018 20:07:47 UTC+2 użytkownik elch napisał:
Again, Andrew


letodb.ini:
Default_Driver = CDX
share_Tables = 1
No_Save_WA = 0

Could you plese test:

No_Save_WA = 1

when problem afterwards still not exist -- that wold be an important hint ...



version LetODBF 09.10.2018 , Share_Tables = 1 , No_Save_WA = 1 ,Cache_Records = 21

//#include "minigui.ch" // only to ErrorLog.html
Function Main()
   local aStru
   HB_GT_WIN_DEFAULT()

   RDDSETDEFAULT( "LETO" )
   cServerLetODB := "//192.168.8.100:2812/"
   IF Leto_Connect( cServerLetODB ) < 0
      ? 'Server letodb not found'
      inkey(0)
      RETURN NIL
   ENDIF


   aStru    := { {"ID", "C", 10, 0} }
   DBCreate( "test", aStru )
   use test
   append blank
   replace test->id with "ABCDEFGHIJ"

   ? alias()    // TEST
   ? recno()    // 1
   ? reccount() // 1

   ? "Restart access point or letodb server"
   ? "After establish connection  press any key"
   inkey(0)

   ? alias()    // TEST
   ? recno()    // 1
   ? reccount() // 0
   inkey(0)

   dbcloseall() // error

return nil

best regards
Andrew
ErrorLog.htm

elch

unread,
Oct 10, 2018, 10:07:17 AM10/10/18
to Harbour Users
I hope, I was compiled everythig OK.
well done!, Marek -- i am just scrolling through them ...
 
I'm using Harbour Minigui, not hbmk2 directly.
No problem -- but a question: is 'letodb.hbc' somehow included/ used ?
It will automatic include two header files * as extension * to the default "std.ch":
include/rddleto.ch
include/leto_std.ch   <-- this one since 2018-06-15
Doing that manually needs to use: -u+...
i.e.: -u+rddleto.ch

---
BTW, which old version of LetoDBf works for you ( see last entry in ChangeLog.txt )

best regards
Rolf

Marek MOL

unread,
Oct 10, 2018, 10:24:15 AM10/10/18
to harbou...@googlegroups.com
Last good working (I didn't try latter version) was:
         2018-05-14 19:18 UTC+0100 Rolf 'elch' Beckmann (elchs users.noreply.github.com)
I've included rddleto.ch and leto_std.ch
Any good results.

Regards, Marek


--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to a topic in the Google Groups "Harbour Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-users/lKCaAbJ9HPQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

elch

unread,
Oct 10, 2018, 4:25:24 PM10/10/18
to Harbour Users
Hi Marek,


I've included rddleto.ch and leto_std.ch
Any good results.
 
'rddleto.ch':
translates 'SET()' in your source-code to 'Leto_SET()'.
This will inform the server about changes of:
SOFTSEEK, DELETED, AUTOPEN, AUTORDER
*after* a connection is ready established with Leto_Connect()
All other settings are just forwarded to the original SET()
--> it should be used to be on the safe side.

'leto_std.ch'
offers optimizing some actions to be done completely at server side.
This may be optional, but it should not have any bad effects if used.


-----
BTW, Harbour MiniGui means, the used C-compiler is:
BCC 5.5.1 Copyright (c) 1993, 2000 ?


#####
prepared a precise ! analyse about the reported problem,
but deeper knowledge of Harbour and LetoDBf is needed
and moreover: it should be very boring you ! ;-)

In short:
the work-area are screwed at client ! side,
like RAM foul-play -- but for sure is not ! the case -- maybe the compiler have a problem ?

There is only one! RecCount() request to the server.
That means Harbour command does not see a valid workarea,
and immediate returns '0' -- without calling the RDD method.
[ src/rdd/dbcmd.c -- HB_FUNC( LASTREC ) ]

Conclusion:
stay at the older working version of LetoDBf for a moment
-- i will do more research by time, reporting if something is found or more info needed.

best regards
Rolf

elch

unread,
Oct 10, 2018, 4:53:18 PM10/10/18
to Harbour Users
Hi Andrew,

THANKS!

this is very explain-able -- and all as expected !

We have a DBF workarea ( 'virtual' in RAM ) at client side where your
application runs.
and a 'real' DBF workarea at server itself.

Every time the client needs *new* information, it requests the server.
Already available info is reported without doing so, so these
ALIAS() and RecNo()
never ask the server, and a missing server won't be noticed.

With very latest update, even also:
RecCount()
will NOT ask the server for an *exclusive* workarea -- like presented in snippet.
For a *shared* workarea the server must be requested ! - as other user may have 
appended new records.

If you like to check the server avail-ability, you may use:
Leto_Ping() --> '.T. / .F.'

* Once a connection is lost, it will never be re-established - automatically. *
For such a scenario i created: 'Leto_ReConnect()' for 'server hopping' :-))
Check 'ReadMe.txt' -- and start a new thread when questions about are left open ...

best regards
Rolf


   ? "Restart access point or letodb server"
   ? "After establish connection  press any key"
yeah -- all is lost -- sunk in the deep sea, who will dive for it ;-)

best regards
Rolf

Marek MOL

unread,
Oct 11, 2018, 1:30:47 AM10/11/18
to harbou...@googlegroups.com
HMG Official uses MinGW as C Compiler.
Maybe version of this one is too old?
I'll try newer harbour and mingw

--

elch

unread,
Oct 11, 2018, 2:06:22 AM10/11/18
to Harbour Users
Hi Marek,


HMG Official uses MinGW as C Compiler.
Maybe version of this one is too old?
 
MinGW for sure is ok ! -- Borland commonly also, but it is just really old.

As the C-compiler is between you and the hardware,
it isn't a bad idea to a use a 'not so old' one.
It means Borland still 'thinks' its a Pentium-II ? ;-) ...

---
I also do further research, as i cannot exclude a bug in LetoDBf.
But it looks really 'scrambled' ...

best regards
Rolf

Marek MOL

unread,
Oct 25, 2018, 1:27:25 PM10/25/18
to harbou...@googlegroups.com
Hi Elch! Did you found solution of this problem?
Best regards, Marek

--

elch

unread,
Jan 14, 2019, 5:49:22 AM1/14/19
to Harbour Users
Hi Marek,


Hi Elch! Did you found solution of this problem?

finally ... -- sadly many weeks (and in sum many hours search) later :-(
At least i think so, seems i searched at wrong places.

There is a shortcut: if a record is unlocked *plus* record data changed,
*one* single request is send to server, doing both actions at once:
update AND unlock.

This can NOT be done,
if application ( "faktury.exe" ) is linked WITHOUT multi-threading support,
then the second thread serving the second socket is missing.
This case it must be done as before, with *two* separate requests.

The base of this change dates back to 2018-06-15.
" # performance for sequence: Rlock(); change data; DbUnlock()
spares a network package ( 'unlock' send together with data update )
"
sigh ...

-----
Multi-thread linking of an Harbour LETO app is initiated by "letodb.hbc",
as therin is the short line: "mt=yes"
[ OT: xHarbour any case is treated as single-threaded ]
So my question about from 2018/10/10 was likely on the track ...

You may please test once again,
firstly as it was at you, without ! that 'multi-threading'.
If that works (again;), you will like to activate it ...

best regards
Rolf

Marek MOL

unread,
Jan 17, 2019, 5:38:53 PM1/17/19
to Harbour Users
Hi Rolf!
Thanks for your great work! I  have no time to test it now, I'll try to find some spare time next week. I'll report my observations.
Regards!

Marek MOL

unread,
Mar 6, 2019, 3:40:09 PM3/6/19
to Harbour Users
Hi Rolf!
I'm trying to compile and use last version of LetoDBF.
I'm compiling it as service.
When I want to install it as service, I get an error:

Application Internal Error - (null)
Terminated at: 2019-03-06 21:32:50
Unrecoverable error 6005: Exception error:

    Exception Code:C0000005 ACCESS_VIOLATION
    Exception Address:005E0DD1
    EAX:00000000  EBX:00000002  ECX:00000000  EDX:00000001
    ESI:00951628  EDI:00000008  EBP:008200B8
    CS:EIP:0023:005E0DD1  SS:ESP:002B:0082FEA0
    DS:002B  ES:002B  FS:0053  GS:002B
    Flags:00010202
    Exception Parameters: 00000000 008200B8
    CS:EIP: C9 C3 90 90 90 90 90 90 90 90 90 90 90 90 90 55
    SS:ESP: 00000001 00951628 00000008 00000008 00951600 00000008 0082FF80 004013E2 00000002 00951628 00951B90 00000000 00000000 00000000 00000000 00000000

    C stack:
    EIP:     EBP:       Frame: OldEBP, RetAddr, Params...

Modules:
00400000 00221000 d:\leto\letodb.exe
77C40000 00183000 C:\WINDOWS\SYSTEM32\ntdll.dll
75970000 000E0000 C:\WINDOWS\System32\KERNEL32.DLL
74940000 001A1000 C:\WINDOWS\System32\KERNELBASE.dll
74C50000 00077000 C:\WINDOWS\System32\ADVAPI32.dll
74E00000 000BE000 C:\WINDOWS\System32\msvcrt.dll
74CD0000 00041000 C:\WINDOWS\System32\sechost.dll
74780000 000C1000 C:\WINDOWS\System32\RPCRT4.dll
746E0000 0001E000 C:\WINDOWS\System32\SspiCli.dll
746D0000 0000A000 C:\WINDOWS\System32\CRYPTBASE.dll
75C40000 0005A000 C:\WINDOWS\System32\bcryptPrimitives.dll
77970000 0015F000 C:\WINDOWS\System32\USER32.dll
755B0000 00015000 C:\WINDOWS\System32\win32u.dll
746A0000 0002F000 C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL
75940000 0002B000 C:\WINDOWS\System32\GDI32.dll
77AD0000 0015B000 C:\WINDOWS\System32\gdi32full.dll
75D90000 00063000 C:\WINDOWS\System32\WS2_32.dll
745F0000 00024000 C:\WINDOWS\SYSTEM32\WINMM.DLL
74510000 00023000 C:\WINDOWS\SYSTEM32\WINMMBASE.dll
75880000 00036000 C:\WINDOWS\System32\cfgmgr32.dll
74C20000 00025000 C:\WINDOWS\System32\IMM32.DLL

------------------------------------------------------------------------

Do you have any idea what I'm doing wrong?

elch

unread,
Mar 7, 2019, 7:17:20 AM3/7/19
to Harbour Users
Hi Marek,

When I want to install it as service, I get an error:
...

Unrecoverable error 6005: Exception error:
...
Do you have any idea what I'm doing wrong?

commonly *i* do something wrong ... ;-)

There were recent changes, that we can install the service multiple times,
but its tested in a virtual machine running XP - 64Bit,
and also the user, who wanted the changes, reported: working.

Firstly: verify the LetoDBf service is not already active,
then uninstall it beforehand,
and that 'sometimes' need a restart of Windows afterwards.
( something like: start button -> system management -> administration -> services )

Then try to (un)install LetoDBf service as user Administrator !,
that would mean to start the command shell as this user,
or to execute at least the command line "letodb install" as admin.
( This is the result of a quick google search, and maybe the difference to my test environment )

Does that help ?
Is there any feedback in the 'letodbf.log' ?
( as that would mean the executable crashed ... )

best regards
Rolf

Marek MOL

unread,
Mar 7, 2019, 9:35:54 AM3/7/19
to Harbour Users
When I try to install letodb as service, it crashes without any information in log file.
Maybe my harbour is too old?
I'm using   Harbour 3.2.0dev (r1802131223)

Marek MOL

unread,
Mar 7, 2019, 10:23:31 AM3/7/19
to Harbour Users
Service has insyalled. But error occurs on it's installation.
After that, server is running...

elch

unread,
Mar 7, 2019, 1:45:13 PM3/7/19
to Harbour Users
Hi Marek,

commonly *i* do something wrong ... ;-)

Yep!, a nicely mis-used hb_strncpy() ... -- fix against uploaded.

best regards
Rolf

Marek MOL

unread,
Mar 7, 2019, 2:48:29 PM3/7/19
to Harbour Users
Hi!
I've recompiled and now it's installing without any problems.
Thank you very much!
Reply all
Reply to author
Forward
0 new messages