B4700230 behaving differently in interactive app and UBE

DirkZoellner

Member
Hi, List,

by little, i'm running out of ideas...

I try to use B4700230 to copy files. The BF is OCM-mapped to run on the enterprise server, which is an AIX machine. The filenames are stored in the database or in processing options, resp.. If the BF is invoked from an interactive program, everything works fine. If it is invoked from a UBE (for the same files), it cannot see the input file and returns error.

Some more infos:

- We are running B9, i.e. we are in Unicode.
- I modified the BF a bit, because i didn't trust jdeFopen and wanted to see more in detail, what is happening:

/* Action for copying from original flat file to new flat file */
case _J('2'):

memset(szOriginalFlatFileASCII, (int)_J('\0'), sizeof(szOriginalFlatFileASCII));
memset(szNewFlatFileASCII, (int)_J('\0'), sizeof(szNewFlatFileASCII));
jdeFromUnicode ((ZCHAR *) szOriginalFlatFileASCII, (JCHAR *) lpDS->szOriginalFlatFile, DIM(szOriginalFlatFileASCII), NULL);
jdeFromUnicode ((ZCHAR *) szNewFlatFileASCII, (JCHAR *) lpDS->szNewFlatFile, DIM(szNewFlatFileASCII), NULL);

/* Check for existence */
if( (access( (const char *) szOriginalFlatFileASCII, (int) 0 )) == -1 )
{
if ( lpDS->cSuppressErrorMessage != _J('1') )
{
jdeErrorSet (lpBhvrCom, lpVoid, IDERRszNewFlatFile_2, _J("3142"), (LPVOID) NULL);
}
jdeStrcpy(lpDS->szErrorMessage, (const JCHAR *) _J("3142"));
idReturn = ER_ERROR;
}
else
{
/* Check for read permission */
if( (access( (const char *) szOriginalFlatFileASCII, (int) 4 )) == -1 )
{
if ( lpDS->cSuppressErrorMessage != _J('1') )
{ jdeErrorSet (lpBhvrCom, lpVoid, IDERRszNewFlatFile_2, _J("025C"), (LPVOID) NULL);
}
jdeStrcpy(lpDS->szErrorMessage, (const JCHAR *) _J("025C"));
idReturn = ER_ERROR;
}
}
/* if ( (lpdsOriginalFile = jdeFopen(lpDS->szOriginalFlatFile, _J("r")) ) != (FILE *) NULL ) */
if ( (lpdsOriginalFile = fopen((ZCHAR *) szOriginalFlatFileASCII, "r") ) != (FILE *) NULL )
{

So, first I translate Unicode into Ansi, then I check, if the file exists. If it exists, I check, if we have read access. The first access() fails, i.e. the file cannot be seen.

Any ideas, List?

Thanks + cheers - Dirk.
 
Does the UBE run on the same machine as the BSFN? I'm not sure a UBE on one logic server can run a BSFN on a second.
 
Thanks, Darren. UBE and BSF run on the same server.

The same error occurs, if the BSF is not mapped in OCM and the UBE is launched on the enterprise server.
 
My first guess is to verify the security on the directory you're reading. The 'user' may be different between the interactive, and batch job.
 
Thanks again, Darren. Security issue - that was my first guess too and, actually, still is. But, if I understand this right, the difference is that in interactive mode the BSF is launched via 'jdenet' middleware, while in batch 'runbatch' is used. I verified this on the AIX, and both processes run with the same user: 'jdeb9'. And jdeb9 is also the owner of the file that I want to open. jdeb9 has full access to the file, while the rest of the world still has read access (jdeb9 also is the owner of all the directories from 'home' onwards with rwx rights). BTW - the filename is fully qualified '/home/jdeb9/...' We even 'chmod 666' the file with no difference. So, there have to be some security issues that we overlooked. On the other hand, in Unix, security settings for file access are quite simple - at least that is what I thought until today.

Still brooding - Dirk.
 
Back
Top