port: security/cfs

Christopher Sean Hilton chris at vindaloo.com
Wed Sep 17 23:06:16 UTC 2008


The port security/cfs, Matt Blaze's userland Cryptographic filesystem,  
is marked as broken because it does not compile under FreeBSD-7.0 or  
later.

I've managed to get it to compile through some simple changes but I  
don't know enough about RPC to know if I am on the right track. I'm  
asking for the help of an RPC wizard to check my train of thought.

The big change is rpcgen. In FreeBSD 6.0 it builds a C header file  
with prototypes like this:

      void * rpc_entry_point();

Now it builds prototypes like this:

      void * rpc_entry_point(struct yourtype * yourvar, CLIENT * clnt);

I'm guessing that the first prototype caused GCC 4.x to gag so rpcgen  
was patched to produce the second when the move was made to FreeBSD-7.0.

The second problem is that CFS is coded with rpc entry points that  
look like this.

      void * rpc_entry_point(yourvar, rp)
          struct yourtype * yourvar;
          struct svc_req *rp;
      {
          int ret = 0;

          ...

          return ret;
      }

While gcc doesn't completely gag on that one it's not that happy about  
it either.
The small issue here is that the coding style is ancient. Returning an  
(int) 0 as NULL has been taboo in C for years and gcc is getting more  
and more fussy about these problems as time passes. The bigger problem  
is that the parameter types don't match up. But the mismatch is so  
huge that I find it difficult to believe that code ever worked.  
Looking further into things I discovered that rpcgen is basically  
specifying an client-server interface. For every:

      void * rpc_entry_point(struct yourtype * yt, CLIENT * clnt);

You also get:

      void * rpc_entry_point_svc(struct yourtype *yt, struct svc_req  
*rp);

Now CFS uses K&R to mangle up the _svc functions pretty well to but  
basically if you patch cfs_adm.c and cfs_nfs.c to change the rpc entry  
points from client to service definitions then the code compiles  
reasonably cleanly with gcc 4.

After that long discussion does someone know RPC programming well  
enough to verify that CFS was defining the Service side of thing all  
along and that in the past RPC was loose enough to take  
rpc_entry_point(... as the definition of the service which is now  
properly called rpc_entry_point_svc(... ?

-- Chris
-- 
Chris Hilton                                   chris-at-vindaloo-dot-com
------------------------------------------------------------------------
                "All I was doing was trying to get home from work!"
                                                 -- Rosa Parks



More information about the freebsd-questions mailing list