private void ensureWindowsSupport(NativeFunction function) throws NativeAccessException { if (!hasWindowsSupport()) { throw new NativeAccessException("Native Windows Support plugin not installed"); } if (!nativeWindowsSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native Windows Support plugin does not support " + function); } }
Darwin(NativeUtils nativeUtils) { this.nativeUtils = nativeUtils; try { for (final NativeProcess process : nativeUtils.getMacProcesses()) { try { super.processes.put(process.getPid(), new DarwinProcess(process)); } catch (NativeAccessException exc) { // We may have access permission, skip and get rest of the process logger.warn("Failed to fecth Native Mac Processes", exc.getLocalizedMessage()); } } } catch (NativeAccessException exc) { // Don't fail if the Native Mac access plugin is not installed. logger.warn( "Failed to fecth Native Mac Processes", exc.getLocalizedMessage()); } }
public Authentication authenticate(Authentication authentication) throws AuthenticationException { String username = authentication.getPrincipal().toString(); String password = authentication.getCredentials().toString(); try { Set<String> grps = NativeUtils.getInstance().pamAuthenticate(serviceName, username, password); GrantedAuthority[] groups = new GrantedAuthority[grps.size()]; int i = 0; for (String g : grps) { groups[i++] = new GrantedAuthorityImpl(g); } EnvVars.setHudsonUserEnvVar(username); // I never understood why Spring Security insists on keeping the password... return new UsernamePasswordAuthenticationToken(username, password, groups); } catch (NativeAccessException exc) { throw new BadCredentialsException(exc.getMessage(), exc); } }
StringWriter stWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stWriter); exc.printStackTrace(writer); sendError("Native function isDotNetInstalled() failed. " + stWriter.toString(), req, rsp);
if(ze.getCode() == NativeAccessException.PERMISSION) {
private void ensureMacSupport(NativeFunction function) throws NativeAccessException { if (!hasMacSupport()) { throw new NativeAccessException("Native Mac Support plugin not installed"); } if (!nativeMacSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native Mac Support plugin does not support " + function); } }
public boolean isRoot() { try { return NativeUtils.getInstance().getEuid() == 0; } catch (NativeAccessException exc) { LOGGER.log(Level.INFO, "Native Support to find EUID failed - {0}", exc.getLocalizedMessage()); return false; } }
private void ensureZfsSupport(NativeFunction function) throws NativeAccessException { if (!hasZfsSupport()) { throw new NativeAccessException("Native ZFS Support plugin not installed"); } if (!nativeZfsSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native ZFS Support plugin does not support " + function); } }
private void ensureUnixSupport(NativeFunction function) throws NativeAccessException { if (!hasUnixSupport()) { throw new NativeAccessException("Native Unix Support plugin not installed"); } if (!nativeUnixSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native Unix Support plugin does not support " + function); } }