dbf file extension

dbf file extension

Postby Otto » Sun Mar 16, 2008 2:17 pm

Is it possible to rename the dbf files to something else. Only to obscure the database format you use.
example: customer.dbf customer.abc

Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Sun Mar 16, 2008 2:34 pm

Otto,

Yes, you can open them using the extension that you want or use RddInfo( RDDI_TABLEEXT, ".abc" ) so it will be used by default.

#define RDDI_TABLEEXT 5 /* Default data file's file extension */
#define RDDI_MEMOEXT 6 /* Default memo file's file extension */
#define RDDI_ORDBAGEXT 7 /* Default multi tag index's file extension */
#define RDDI_ORDEREXT 8 /* default single tag index's file extension */
#define RDDI_ORDSTRUCTEXT 9 /* default single tag index's file extension */
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby nageswaragunupudi » Sun Mar 16, 2008 4:41 pm

The above method may be better.
But you can also simply open the file with extention
example:
USE CUSTOMER.ABC
But you should use the extention every where you open the table.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Otto » Sun Mar 16, 2008 4:58 pm

Thank you.
Maybe this way you can keep off EXCEL user opening important files.
Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby mmercado » Sun Mar 16, 2008 5:10 pm

Hi Otto:

There was an old trick in Clipper to hide dbfs to programs, it consisted in changing the first byte of dbf file (dbf file's first byte is always Chr(3)), something like this:
Code: Select all  Expand view
   If ( nHandle := FOpen( "MGFCES.DBF", 2 ) ) >= 0
    FSeek( nHandle, 0, 0 )
    FWrite( nHandle,Chr( 4 ), 1 )
    FClose( nHandle )
    FRename( "MGFCES.DBF", "MGFCES.ABC" )
   EndIf

Then when you wanted to use the dbf again, just restored the first byte to Chr(3)

Regards

Manuel Mercado
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby nageswaragunupudi » Sun Mar 16, 2008 5:16 pm

Always beware of Excel user, particularity if he is knowledgeable. Excel is so powerful that he can see and tinker with any RDMS ( oracle, mssql ) if he knows the passwords. ADS is, in a way, better. We can hide the folder to all except ADS. Still he can break through if ADS OLEDB is installed.

One of the aspects of database management is to keep it safe from hackers and this is another art / science.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Sun Mar 16, 2008 5:19 pm

mmercado wrote:Hi Otto:

There was an old trick in Clipper to hide dbfs to programs, it consisted in changing the first byte of dbf file (dbf file's first byte is always Chr(3)), something like this:
Code: Select all  Expand view
   If ( nHandle := FOpen( "MGFCES.DBF", 2 ) ) >= 0
    FSeek( nHandle, 0, 0 )
    FWrite( nHandle,Chr( 4 ), 1 )
    FClose( nHandle )
    FRename( "MGFCES.DBF", "MGFCES.ABC" )
   EndIf

Then when you wanted to use the dbf again, just restored the first byte to Chr(3)

Regards

Manuel Mercado

Yes it was an old trick. But not useful in multiuser environments. Works in single user environment
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby JmGarcia » Sun Mar 16, 2008 5:59 pm

Some denominated function exists ISBDF() ?
Mi abuelo decía: Los aviones vuelan porque Dios quiere, y los helicópteros ni Dios sabe porque vuelan.
FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
User avatar
JmGarcia
 
Posts: 654
Joined: Mon May 29, 2006 3:14 pm
Location: Madrid - ESPAÑA

Postby xProgrammer » Mon Mar 17, 2008 1:48 am

Another idea is to make them hidden files. What the snooping Excel user doesn't see he possibly won't fiddle with. Just a thought.

xProgrammer
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby nageswaragunupudi » Mon Mar 17, 2008 3:54 am

xProgrammer wrote:Another idea is to make them hidden files. What the snooping Excel user doesn't see he possibly won't fiddle with. Just a thought.

xProgrammer

Yes. Good.
Need to do anything and everything to protect the data. Level of implementation depends on the assessment of the risks in the environment. Even assuming that somebody could still open the table, encryption helps to ensure that he does not understand the data. Again that does not prevent him from altering the data. Having some kind of checksum of important columns helps to know at least if there is any unauthorized change. Also meaningless table names and column names makes it difficult for the prying eye to know where to look for. Maintaining redundant columns or tables with encoded corresponding values helps restore correct data in case of unauthorized changes.

To repeat, it is an appropriate combination of measures that keeps data fairly safe. What measures we take depends on the assessment of the risks in a particular environment.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Otto » Mon Mar 17, 2008 7:12 am

To all,

Thank you for your help and suggestions.

Question:
Is there a function to hide files?
Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby xProgrammer » Mon Mar 17, 2008 8:42 am

Try SetFAttr() info below (I use Linux so can't test for you).

SetFAttr()
Sets file attributes.
Syntax
SetFAttr( <cFileName>, [<nAttributes>] ) --> nErrorCode
Arguments
<cFileName>
This is a character string holding the name of the file to set attributes for. It must include path
and file extension. If the path is omitted from <cFileName>, the file is searched in the current
directory only.
<nAttributes>
This is a numeric value specifying the file attributes to set. Values of the following list are used
for file attributes. To specifiy multiple attributes, pass the sum of the corresponding values:
Values for file attributes
Code: Select all  Expand view
           Value                             Attribute
           0                                 Normal
           1                                 Read only
           2                                 Hidden
           4                                 System
           8                                 Volume
           32                                Archived

Return
The function returns zero on success or a numeric error code on failure.
Info
See also: BitToC(), CtoBit(), FileAttr(), FileSeek()
Category: CT:DiskUtil, File functions, Low level file functions
Source: ct\files.c
LIB: xhb.lib
DLL: xhbdll.dll

Hope that helps
Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Otto » Mon Mar 17, 2008 9:26 am

xProgrammer, thank you for your help.
Do you use xHarbour?
Regards, Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Richard Chidiak » Mon Mar 17, 2008 9:56 am

Otto

#define FILE_ATTRIBUTE_NORMAL 128 // 0x00000080
#define FILE_ATTRIBUTE_READONLY 1 // 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 2 // 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 4 // 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 16 // 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 32 // 0x00000020
#define FILE_ATTRIBUTE_TEMPORARY 256 // 0x00000100
#define FILE_ATTRIBUTE_COMPRESSED 2048 // 0x00000800
#define FILE_ATTRIBUTE_OFFLINE 4096 // 0x00001000

SETFILEATTRIBUTES(yourfilename, FILE_ATTRIBUTE_NORMAL )

DLL32 FUNCTION SETFILEATTRIBUTES(cFileName AS LPSTR, nFileAttributes AS DWORD ) ;
AS BOOL PASCAL FROM "SetFileAttributesA" LIB "Kernel32.dll"

Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Otto » Mon Mar 17, 2008 10:20 am

Richard, thank you.

Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests