/** * Reads the text block. */ private static String readTextBlock(InputStream in) throws IOException { StringBuilder buf = new StringBuilder(); while(true) { String line = readLine(in); if(line.equals(".")) return buf.toString(); // end of it if(line.startsWith("..")) buf.append(line.substring(1)); else buf.append(line); buf.append('\n'); } }
protected Process sudoWithPass(ArgumentListBuilder args) throws IOException { listener.getLogger().println("Running with embedded_su"); ProcessBuilder pb = new ProcessBuilder(args.prepend(sudoExe()).toCommandArray()); return EmbeddedSu.startWithSu(rootUsername, rootPassword, pb); } // in solaris, pfexec never asks for a password, so username==null means
String line = readLine(in); if(line.startsWith("CONV")) { String header = readLine(in); String textBlock = readTextBlock(in); LOGGER.fine("Got "+header+" : "+textBlock); if(header.startsWith("PAM_PROMPT_ECHO_OFF")) { throw new SuAuthenticationFailureException(readTextBlock(in)+join(errorMessages));
String line = readLine(in); if (line.startsWith("CONV")) { String header = readLine(in); String textBlock = readTextBlock(in); LOGGER.fine("Got " + header + " : " + textBlock); if (header.startsWith("PAM_PROMPT_ECHO_OFF")) { throw new SuAuthenticationFailureException(readTextBlock(in) + join(errorMessages));
protected Process sudoWithPass(ArgumentListBuilder args) throws IOException { listener.getLogger().println("Running with embedded_su"); ProcessBuilder pb = new ProcessBuilder(args.prepend(sudoExe()).toCommandArray()); return EmbeddedSu.startWithSu(rootUsername, rootPassword, pb); } // in solaris, pfexec never asks for a password, so username==null means
/** * Reads the text block. */ private static String readTextBlock(InputStream in) throws IOException { StringBuilder buf = new StringBuilder(); while (true) { String line = readLine(in); if (line.equals(".")) { return buf.toString(); // end of it } if (line.startsWith("..")) { buf.append(line.substring(1)); } else { buf.append(line); } buf.append('\n'); } } private static final Logger LOGGER = Logger.getLogger(EmbeddedSu.class.getName());