initialiseModule(void)
{
	// FilePlugin>>#initialiseModule
	sCCPfn = ioLoadFunctionFrom("secCanCreatePathOfSize", "SecurityPlugin");
	sCDPfn = ioLoadFunctionFrom("secCanDeletePathOfSize", "SecurityPlugin");
	sCGFTfn = ioLoadFunctionFrom("secCanGetFileTypeOfSize", "SecurityPlugin");
	sCLPfn = ioLoadFunctionFrom("secCanListPathOfSize", "SecurityPlugin");
	sCSFTfn = ioLoadFunctionFrom("secCanSetFileTypeOfSize", "SecurityPlugin");
	sDFAfn = ioLoadFunctionFrom("secDisableFileAccess", "SecurityPlugin");
	sCDFfn = ioLoadFunctionFrom("secCanDeleteFileOfSize", "SecurityPlugin");
	sCOFfn = ioLoadFunctionFrom("secCanOpenFileOfSizeWritable", "SecurityPlugin");
	sCRFfn = ioLoadFunctionFrom("secCanRenameFileOfSize", "SecurityPlugin");
	sHFAfn = ioLoadFunctionFrom("secHasFileAccess", "SecurityPlugin");
	return sqFileInit();
}
Esempio n. 2
0
/*
  primitivePluginRequestFileHandle: id
  After a URL file request has been successfully
  completed, return a file handle for the received
  data. Note: The file handle must be read-only for
  security reasons.
*/
int display_primitivePluginRequestFileHandle()
{
    sqStreamRequest *req;
    int id, fileOop;
    void *openFn;

    id= stackIntegerValue(0);
    if (failed()) return 0;
    if (id < 0 || id >= MAX_REQUESTS) return primitiveFail();

    req= requests[id];
    if (!req || !req->localName) return primitiveFail();

    fileOop= nilObject();

    if (req->localName)
    {
        DPRINT("VM: Creating file handle for %s\n", req->localName);

        openFn= ioLoadFunctionFrom("fileOpenNamesizewritesecure", "FilePlugin");
        if (!openFn)
        {
            DPRINT("VM:   Couldn't load fileOpenName:size:write:secure: from FilePlugin!\n");
            return primitiveFail();
        }

        fileOop= ((sqInt (*)(char *, sqInt, sqInt, sqInt))openFn)
                 (req->localName, strlen(req->localName), 0 /* readonly */, 0 /* insecure */);

        /* if file ends in a $, it was a temp link created by the plugin */
        if ('$' == req->localName[strlen(req->localName) - 1])
        {
            DPRINT("VM:   unlink %s\n", req->localName);
            if (-1 == unlink(req->localName))
                DPRINT("VM:   unlink failed: %s\n", strerror(errno));
        }

        if (failed())
        {
            DPRINT("VM:   file open failed\n");
            return 0;
        }
    }
    pop(2);
    push(fileOop);
    return 1;
}
Esempio n. 3
0
/* ioLoadExternalFunctionOfLengthFromModuleOfLength
	Entry point for functions looked up through the VM.
*/
void *ioLoadExternalFunctionOfLengthFromModuleOfLength(sqInt functionNameIndex, sqInt functionNameLength,
						       sqInt moduleNameIndex,   sqInt moduleNameLength)
{
	char *functionNamePointer= pointerForIndex_xxx_dmu((usqInt)functionNameIndex);
	char *moduleNamePointer= pointerForIndex_xxx_dmu((usqInt)moduleNameIndex);
	char functionName[256];
	char moduleName[256];
	sqInt i;

	if(functionNameLength > 255 || moduleNameLength > 255)
		return 0; /* can't cope with those */
	for(i=0; i< functionNameLength; i++)
		functionName[i] = functionNamePointer[i];
	functionName[functionNameLength] = 0;
	for(i=0; i< moduleNameLength; i++)
		moduleName[i] = moduleNamePointer[i];
	moduleName[moduleNameLength] = 0;
	return ioLoadFunctionFrom(functionName, moduleName);
}
initialiseModule(void)
{
	// AsynchFilePlugin>>#initialiseModule
	sCOAFfn = ioLoadFunctionFrom("secCanOpenAsyncFileOfSizeWritable", "SecurityPlugin");
	return asyncFileInit();
}
Esempio n. 5
0
void loadFunctionFromPluginMessage_class::handle_me() {
  fn_t f = ioLoadFunctionFrom(fn_name, plugin_name);
  loadFunctionFromPluginResponse_class(f).send_to(sender);
}