Using Windows to query Unix RPC
March 10, 2008 11:33 PM   Subscribe

Using Windows to query Unix RPC rquota?

We have a need to query the NFS quota used by users/uid from Windows (technically from ASP, but a DOS exe will be acceptable), which usually you do using Unix RPC call to rpc.rquotad.

There seems to be an SDK onc-rpc from Netbula, but they've not updated since 2000, and forum is full of spam so we'd have to build our own code for it, but perhaps there is already such a tool available out there?

Failing that we will do a proxy between Windows and Unix, but that just adds complexity.
posted by lundman to Computers & Internet (7 answers total)
 
Sun/ONC RPC is a pretty simple protocol when you get down to it. If you can't find a library that compiles on Windows you could just hand-implement the required xdr routnes from the RFCs and the rquota interface definition. There are also generators for, e.g., perl (stale) and python (less stale).
posted by hattifattener at 12:07 AM on March 11, 2008


Depending on exactly what form you need to get the information back in, you could simply have a telnet script log in, run the unix command line, and dump the response to a text file.

If you use XML-RPC or web services, all the UNIX system has to do is display an XML document on port 80 containing the info. I remember coming across a fairly simple way to do this, without even using a web server. An incoming HTTP request would cause a shell script to be run and the stdout of that shell script would be displayed as the HTTP response.
posted by XMLicious at 2:43 AM on March 11, 2008


Response by poster:
I wanted to avoid doing the "tcp connect to run shell command" but it is always there as last option. If I had the time, I would just tcpdump/snoop the rquota packet and try to generate my own and hope it flies enough just to get quotas back.

At the moment, I would guess it can't be done easily/quickly, unless the company with the Win32 port of ONC RPC is still around. So maybe a listening C/perl that uses ioctl quotactl would be the 2nd most efficient method.
posted by lundman at 5:50 PM on March 11, 2008


Tcpdump would definitely be the hard route. Just read the protocol spec. It's simple.
posted by hattifattener at 7:29 PM on March 11, 2008


Response by poster:
Ah you are absolutely right, RFCs would be the way to go. I'm so used to that whenever I work with Windows, I have to do everything without documentation, since everything has to be secret.

Now to see if I can get time to do this.
posted by lundman at 8:06 PM on March 11, 2008


You can probably get the rquota client to compile with cygwin.
posted by sergent at 1:21 AM on March 12, 2008


Here it is: netcat is the tool I was thinking of. See this page, the use cases 4) Simple Socket Reply and 8) Simple Response Service.

With the output of the UNIX command line tools and a little good ol' shell script text processing to wrap it in XML you ought to be able to rig up the server side of a Web Service RPC. Or forget rigorous standards and hand-roll a POX or even simpler JSON service.
posted by XMLicious at 7:30 AM on March 12, 2008


« Older merchant account important for a site that might...   |   Should I leave Los Angeles? Newer »
This thread is closed to new comments.