OperationSECINFO_NO_NAME extends AbstractNFSv4Operation { @Override public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNFSException, IOException, OncRpcException { try { SECINFO_NO_NAME4res res = result.opsecinfo_no_name; Inode inode = context.currentInode(); switch (_args.opsecinfo_no_name.value) { case secinfo_style4.SECINFO_STYLE4_PARENT: inode = context.getFs().parentOf(inode); case secinfo_style4.SECINFO_STYLE4_CURRENT_FH: res.status = nfsstat.NFS_OK; res.resok4 = new SECINFO4resok(); res.resok4.value = secinfosOf(inode, context); break; default: throw new BadXdrException("bad type: " + _args.opsecinfo_no_name.value); } } catch (GSSException e) { throw new NfsIoException(e.getMessage()); } context.clearCurrentInode(); } OperationSECINFO_NO_NAME(nfs_argop4 args); @Override void process(CompoundContext context, nfs_resop4 result);  }
@Test public void testSecUnix() throws Exception { ExportFile exportFile = new ExportFile(ClassLoader.getSystemResource("org/dcache/nfs/exports.sys").toURI()); CompoundContext context = new CompoundContextBuilder() .withExportTable(exportFile) .withCall(generateRpcCall()) .build(); context.currentInode(inode); nfs_resop4 result = nfs_resop4.resopFor(nfs_opnum4.OP_SECINFO_NO_NAME); op.process(context, result); assertEquals("Sec Sys not detected", RpcAuthType.UNIX, result.opsecinfo_no_name.resok4.value[0].flavor); }
@Test public void testSecKrb() throws Exception { ExportFile exportFile = new ExportFile(ClassLoader.getSystemResource("org/dcache/nfs/exports.krb").toURI()); CompoundContext context = new CompoundContextBuilder() .withExportTable(exportFile) .withCall(generateRpcCall()) .build(); context.currentInode(inode); nfs_resop4 result = nfs_resop4.resopFor(nfs_opnum4.OP_SECINFO_NO_NAME); op.process(context, result); assertEquals("Sec Krb5 not detected", RpcAuthType.RPCGSS_SEC, result.opsecinfo_no_name.resok4.value[0].flavor); }
@Test public void testSecMix() throws Exception { ExportFile exportFile = new ExportFile(ClassLoader.getSystemResource("org/dcache/nfs/exports.mix").toURI()); CompoundContext context = new CompoundContextBuilder() .withExportTable(exportFile) .withCall(generateRpcCall()) .build(); context.currentInode(inode); nfs_resop4 result = nfs_resop4.resopFor(nfs_opnum4.OP_SECINFO_NO_NAME); op.process(context, result); assertEquals("Sec Krb5 not detected", RpcAuthType.RPCGSS_SEC, result.opsecinfo_no_name.resok4.value[0].flavor); assertEquals("Sec Sys not detected", RpcAuthType.UNIX, result.opsecinfo_no_name.resok4.value[1].flavor); }