Opened 11 years ago

Closed 9 years ago

Last modified 9 years ago

#47 closed defect (fixed)

EVFS GUI unable to detect status of connection

Reported by: jojo Owned by: diver
Priority: major Milestone: Netdrive plugin 1.5 beta 1
Component: Samba Client Plugin Version: NDP 1.5 alpha
Keywords: EVFS Cc:

Description

The GUI for EVFS as included in eCS 2.0 RC4 is unable to determine if the resource was actually connected properly or not. Below is a cut & paste from a discussion with Alex Taylor (author of the GUI) me (Joachim) and Vitali.

===

the return code of EvfsRxMount? indicates whether the resource

was initialized and parameters were accepted by the plugin. It does not indicate the resource availability. That is, it is possible to mount a resource that is not accessible at the time of the mount. That is the design.

If you have to verify, whether the resource is actually accessible, you have to do a file system operation on the resource and verify the result of it.

Return codes for all REXX functions are generic OS/2 return codes converted to a decimal string (like ERROR_INVALID_PARAMETER is '87', etc).

Okay, thanks for the info. So this would require some additional coding but seems not impossible...

I'm not sure... how could I tell the difference between an attached directory that simply contains no files, and an empty mountpoint (whose attach failed)?

It would seem there's also no way to return "login failed" to the user.

===

Hi Joachim, Alex,

it is possible to implement an IOCTL in the samba plugin. The IOCTL would return information about the samba resource. I believe it is the most suitable method, as it will allow to return any information: login failed, etc.

So after a mount, an additional IOCTL call to the plugin will be made by the script.

I think doing an IOCTL from rexx is not implemented in evfscall, so a separate executable (or REXX callable DLL, or additing the function to evfscalls) will be required.

I will send a C example of implementing an IOCTL later today.

Best regards, Vitali.

===

here is what to do.

In the plugin (ndpsmb.c) implement:

int APIENTRY NdpIOCTL (int type, HRESOURCE resource, char *path, int function,

void *in, ULONG insize, PULONG poutlen)

{

Resource *pRes = (Resource *)resource;

if (function == 100 ) /* Arbitrary value */ {

SAMBAINFO *pInfo = (SAMBAINFO *)in; fillResourceInfo (pRes, pInfo); poutlen = sizeof (SAMBAINFO); return NO_ERROR;

}

return ERROR_NOT_SUPPORTED;

}

In the application call:

SAMBAINFO info;

fullpath = path to just created resource.

ULONG cbOut = sizeof (info); rc = EvfsPluginIoctl? (100, "ndpsmb", "smbfs", fullpath, &info, sizeof (info), &cbOut);

That should eventually call the custom fillResourceInfo which can return whatever is required in the SAMBAINFO structure.

Let me know if there are any problems.

Best regards, Vitali.

===

We'd like to have the capability to perform a status check in REXX, but am unsure if the above is sufficient to implement this. It is also unclear to me who is supposed to implement what :)

Thanks in advance,

Joachim

Attachments (1)

evfscall.dll (12.8 KB) - added by jojo 11 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by jojo

comment:1 Changed 11 years ago by jojo

here is a new evfscall.dll with implemented EvfsRxIoCtl?.

In Rexx it is:

/* REXX sample */

/* Load the NetDrive? REXX interface. */ call RxFuncAdd? 'EvfsRxLoadFuncs?', 'EVFSCALL', 'EvfsRxLoadFuncs?' call EvfsRxLoadFuncs?

/* Attach the virtual drive. */ say EvfsRxIoctl?( 111, 'n:\', 'Test')

/* Unload the NetDrive? REXX interface. */ call EvfsRxDropFuncs? exit(0)

The first parameter is a function number, second is the path to samba resource and third a parameter for the function.

The EvfsRxIoctl? returns a string that either contains the decimal error code, or whatever the plugin has returned. To distinguish between returned error code and string returned by the plugin, the plugin should prepend the string with a non digit string ('SAMBA' for example).

In plugin the following should be implemented: int APIENTRY NdpIOCTL (int type, HRESOURCE resource, char *path, int function, void *in, ULONG insize, PULONG poutlen) {

log("NdpIOCTL <%s> %d\n", path, function);

if (in && insize > 4096) {

sprintf (in, "SAMBA IOCTL function = %d, parms [%s] insize = %d,

*poutlen = %d", function, in, insize, *poutlen);

*poutlen = insize; return NO_ERROR;

}

return ERROR_NOT_SUPPORTED;

}

I've tested this with netdrive.

Best regards, Vitali.

comment:2 Changed 10 years ago by ydario

  • Milestone set to Netdrive SMB Client plugin 1.5 alpha 1

comment:3 Changed 10 years ago by diver

  • Owner set to diver

comment:4 Changed 9 years ago by ataylor

Just to clarify what still needs to be done... as all of the above can be a little confusing. This is what I understand...

Currently ndpsmb.dll implements the function NdpIOCTL as a stub, i.e. it exists, but currently does nothing. This needs to be modified (ndpsmb.c) to something like:

int APIENTRY NdpIOCTL (int type, HRESOURCE resource, char *path, int function, void *in, ULONG insize, PULONG poutlen)
{
    Resource *pRes = (Resource *)resource;

    if (function == IOCTL_GET_INFO) {
        SAMBAINFO *pInfo = (SAMBAINFO *)in; 
        fillResourceInfo (pRes, pInfo); 
        poutlen = sizeof (SAMBAINFO); 
        return NO_ERROR;
    }

    return ERROR_NOT_SUPPORTED;
}

We then need to create a fillResourceInfo() function that fills in the SAMBAINFO structure (which I think we also need to define) with the necessary information.

What is the "necessary information" in this case? Presumably, the error condition from the mount function (e.g. bad user/password, server unavailable, etc.)

This will then be accessible via REXX by calling the EvfsIoctl? function. EVFSGUI can implement that once NDPSMB is modified.

comment:5 Changed 9 years ago by diver

  • Status changed from new to assigned

we did it in a more simple way. code will be updated shortly

comment:6 Changed 9 years ago by herwigb

  • Resolution set to fixed
  • Status changed from assigned to closed

http://svn.netlabs.org/samba/changeset/178

http://svn.netlabs.org/samba/changeset/179

Note: EVFSGUI has to be updated in order to make use of the new code in ndpsmb.dll. In part this already happened.

comment:7 Changed 9 years ago by herwigb

  • Version set to Netdrive plugin 1.5 alpha 1
Note: See TracTickets for help on using tickets.