Package com.sun.nfs

Class XFileExtensionAccessor

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] getExports()
      Get server's export list
      boolean loginPCNFSD​(java.lang.String host, java.lang.String username, java.lang.String password)
      Sets the user's RPC credential from Login name and password.
      void loginUGID​(int uid, int gid, int[] gids)
      Sets the user's RPC credential to a known uid/gid.
      void logoutPCNFSD()
      Sets the user's RPC credential to "nobody"
      void logoutUGID()
      Sets the user's RPC credential to "nobody"
      void setNfsHandler​(NfsHandler handler)
      Assigns an NfsHandler class that allows the application to receive RPC timeout notifications.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XFileExtensionAccessor

        public XFileExtensionAccessor​(XFile xf)
    • Method Detail

      • loginPCNFSD

        public boolean loginPCNFSD​(java.lang.String host,
                                   java.lang.String username,
                                   java.lang.String password)
        Sets the user's RPC credential from Login name and password. Every NFS request includes a "credential" that identifies the user. An AUTH_SYS credential includes the user's UID and GID values. These are determined from the user's login name (and password) by the PCNFSD service that must be available on a local server. Once the credential is set, it is assigned globally to all future NFS XFile objects.

        If this method is not called, a default credential is assigned with a UID and GID of "nobody".

        Type Parameters:
        code - host The name of the host that runs the PCNFSD service. This does not have to be an NFS server.
        code - username The user's login name.
        code - password The user's password. This is obscured before transmission to the PCNFSD server.
        Returns:
        true if the login succeeded, false otherwise.
      • logoutPCNFSD

        public void logoutPCNFSD()
        Sets the user's RPC credential to "nobody"
      • loginUGID

        public void loginUGID​(int uid,
                              int gid,
                              int[] gids)
        Sets the user's RPC credential to a known uid/gid. Assumes that the calling application has already authenticated the user and has obtained to uid/gid itself.

        Note: This credential setting method exposes an inherent security hole in RPC AUTH_SYS authentication. The server trusts the client to authenticate the user before setting the UID and GID values. It is possible for a malicious client to allow the UID and/or group ids to be set to allow unauthorized access to other user's files on the server.

        Servers can avoid this security hole by exporting NFS filesystem securely - requiring clients to use secure Diffie-Hellman or Kerberos credentials.

        If this method is not called, a default credential is assigned with a UID and GID of "nobody".

        Type Parameters:
        code - uid The user-ID.
        code - gid The group-ID.
        code - gids The group-ID list.
      • logoutUGID

        public void logoutUGID()
        Sets the user's RPC credential to "nobody"
      • setNfsHandler

        public void setNfsHandler​(NfsHandler handler)
        Assigns an NfsHandler class that allows the application to receive RPC timeout notifications. The handler is used for all NFS files accessed by the application. The default handler can be restored by passing a null handler argument.
        Type Parameters:
        code - handler An instance of the NfsHandler class.
      • getExports

        public java.lang.String[] getExports()
                                      throws java.net.UnknownHostException,
                                             java.io.IOException
        Get server's export list
        Throws:
        java.net.UnknownHostException
        java.io.IOException