User Security Manager
Minor issue with UserSecurityManager
Gravatar is a globally recognized avatar based on your email address. Minor issue with UserSecurityManager
  Alejandro A Sosa
  All
  Sep 19, 2020 @ 05:10pm

Hi Rick,

FYI about running usersecuritymanager_addtoproject.prg.

We have SET EXACT ON as our default, so GetDirs() fails in this statement:

if  AT("D",laDirs[x,5]) = 0 OR laDirs[x,1] = "." OR laDirs[x,1] = "   "

because it interprets ".." as a valid subdirectory.

Alex

Gravatar is a globally recognized avatar based on your email address. re: Minor issue with UserSecurityManager
  Rick Strahl
  Alejandro A Sosa
  Sep 19, 2020 @ 06:50pm

Not sure what you mean.

? laDirs[x,1] = "." 

is a single character that is checked. Since .. starts with a . and the it's a single character and therefore exact match, it'll be detected in that list?

Where is this happening exactly?

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Minor issue with UserSecurityManager
  Alejandro A Sosa
  Rick Strahl
  Sep 20, 2020 @ 10:02am

The failure happens in GetDirs(). Because GetDirs() assumes that SET("EXACT") = .F. and it in fact is true as our shop standard, the code in GetDirs() interprets ".." as a directory that should be added to the cursor and goes into infinite loop.

Actually unimportant, but thought I'd mention it.

Alex

Gravatar is a globally recognized avatar based on your email address. re: Minor issue with UserSecurityManager
  Rick Strahl
  Alejandro A Sosa
  Sep 20, 2020 @ 02:24pm

Well I think SET EXACT ON may cause some problems in Web Connection in general because there are lots of places where searches use exact scanning searches. The reasoning for that is in the documentation... in hindsight better planning in the early days would have been better but hindsight is always 20/20...

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Minor issue with UserSecurityManager
  Rick Strahl
  Alejandro A Sosa
  Sep 20, 2020 @ 02:30pm

Code should work like this regardless of SET EXACT setting:

lnFiles = aDir(laDirs,ADDBS(lcPath) + "*.*" ,"D",1)
FOR x=1 to lnFiles
   IF  AT("D",laDirs[x,5]) = 0 OR ;
       EMPTY(laDirs[x,1]) OR ;
       SUBSTR(laDirs[x,1],1)  = "." 
      LOOP
   ENDIF

   GetDirs( ADDBS(lcPath + laDirs[x,1]),lcBase ) 
ENDFOR


Gravatar is a globally recognized avatar based on your email address. re: Minor issue with UserSecurityManager
  Alejandro A Sosa
  Rick Strahl
  Sep 20, 2020 @ 02:34pm

It is easier to be a historian than a prophet.

Gravatar is a globally recognized avatar based on your email address. re: Minor issue with UserSecurityManager
  Rick Strahl
  Alejandro A Sosa
  Sep 20, 2020 @ 04:02pm

It is easier to be a historian than a prophet.

LOL!

Nah - in today's world prophets suffer no consequences for being wrong...

In the old days they used to string up the prophets if they were too far off the mark, which seems like a good incentive to be thorough... 😄

+++ Rick ---

© 1996-2020