OS/2, eCS & ArcaOS - Technical > Applications

SeaMonkey downloads and Unix permissions

<< < (3/7) > >>

Dariusz Piatkowski:
You know...there is one more thing I came across while looking into the LIBC errors I am starting to regularly see now.

Here is what I found at the LIBCx Github (https://github.com/bitwiseworks/libcx):


--- Quote ---EXPERIMENTAL. Automatic setting of the Unix user ID at process startup to an ID of a user specified with the LOGNAME or USER environment variable if a match in the passwd database is found for it. This has a numbef of side effects, e.g. all files and directories created by kLIBC functions will have an UID and GID of the specified user rathar than root. Also Unix programs will see the correct user via getuid() and other APIs which in particular will make some tools (e.g. yum) complain about the lack of root priveleges. For this reason this functionality is disabled by default and can be enabled by setting LIBCX_SETUID=1 in the environment.

--- End quote ---

David,
Worth a try? You could try enabling this just for the Seamonkey session itself, so you'd need to start from a CMD and have the environment variables set there before you load Seamonkey.

David McKenna:
 Hi Dariusz,

 Tried using libcx_setuid=1, and it seems to work in that when a file is downloaded with SeaMonkey it now has the permission: '-rw------- DaveM root'. But that really doesn't solve the issue - what I want is for the files to be accessible to anyone who uses the share, not just me. In other words, the permissions need to be: '-rw-rw-rw- root root'. Only SeaMonkey can set that at download time (or use 'chmod' to change it afterwards).

Regards,

David McKenna:
 Dave,

 Just to check for comparison, I downloaded a zip file from Hobbes using the QT5 Simplebrowser. The permissions on it were: '-rw-r--r-- root root'. Maybe that makes the most sense for downloaded files? I would think '-rwxr-xr-x root root' would also be appropriate for an executable file. And it seems from your example above that is what the exceptions you mention show too.

Regards,

Dave Yeo:
Yes, either one should be fine. Turns out the code is more complex then I first thought, have to experiment and maybe ask for help.

Alex Taylor:
In my QE editor and a few other programs, I simply make sure that new files are created without EAs. 

More precisely, because libc creates these file permission EAs on a new file automatically, my save routines all have some logic to immediately delete them if the file was new. (I don't do that when updating an existing file because the user might actually have set them on purpose.)

e.g.

--- Code: ---    if ( !fileExists ) {
#ifdef __OS2__
        // If this is a new file, get rid of the useless default EAs added by klibc
        deleteEA( pszFileName, (PCSZ) "UID");
        deleteEA( pszFileName, (PCSZ) "GID");
        deleteEA( pszFileName, (PCSZ) "MODE");
        deleteEA( pszFileName, (PCSZ) "INO");
        deleteEA( pszFileName, (PCSZ) "RDEV");
        deleteEA( pszFileName, (PCSZ) "GEN");
        deleteEA( pszFileName, (PCSZ) "FLAGS");
#endif
    }

--- End code ---


--- Code: ---unsigned long deleteEA( char *pszPathName, const char *pszEAName )
{
    PFEA2LIST pFEA2List = NULL;
    PFEA2     pFEA2 = NULL;
    EAOP2     eaop2 = {0};
    size_t    cb = 0;
    APIRET    rc = ERROR_NOT_ENOUGH_MEMORY;

    cb = sizeof( FEA2LIST ) + strlen( pszEAName );
    pFEA2List = (PFEA2LIST) calloc( cb, 1 );
    if ( pFEA2List ) {
        pFEA2List->cbList = cb;
        pFEA2 = pFEA2List->list;
        pFEA2->cbName = (BYTE) strlen( pszEAName );
        strcpy( pFEA2->szName, pszEAName );
        pFEA2->cbValue = 0;

        eaop2.fpFEA2List = pFEA2List;
        rc = DosSetPathInfo( (PCSZ) pszPathName, FIL_QUERYEASIZE,
                             (PBYTE) &eaop2, sizeof( eaop2 ), DSPI_WRTTHRU );
        free( pFEA2List );
    }
    return (unsigned long) rc;
}

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version