Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3:Update
mokutil
mokutil-allow-password-from-pipe.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mokutil-allow-password-from-pipe.patch of Package mokutil
commit adce7208ddcb65daac83ea3429aa8586d9cc4ea5 Author: Gary Ching-Pang Lin <glin@suse.com> Date: Wed Jan 2 17:30:07 2013 +0800 Only change terminal settings tcgetattr() will fail if we send password through a pipeline instead of a TTY. diff --git a/src/mokutil.c b/src/mokutil.c index a99e355..ea8481a 100644 --- a/src/mokutil.c +++ b/src/mokutil.c @@ -278,22 +278,27 @@ read_hidden_line (char **line, size_t *n) { struct termios old, new; int nread; + int isTTY = isatty(fileno (stdin)); - /* Turn echoing off and fail if we can't. */ - if (tcgetattr (fileno (stdin), &old) != 0) - return -1; + if (isTTY) { + /* Turn echoing off and fail if we can't. */ + if (tcgetattr (fileno (stdin), &old) != 0) + return -1; - new = old; - new.c_lflag &= ~ECHO; + new = old; + new.c_lflag &= ~ECHO; - if (tcsetattr (fileno (stdin), TCSAFLUSH, &new) != 0) - return -1; + if (tcsetattr (fileno (stdin), TCSAFLUSH, &new) != 0) + return -1; + } /* Read the password. */ nread = getline (line, n, stdin); - /* Restore terminal. */ - (void) tcsetattr (fileno (stdin), TCSAFLUSH, &old); + if (isTTY) { + /* Restore terminal. */ + (void) tcsetattr (fileno (stdin), TCSAFLUSH, &old); + } /* Remove the newline */ (*line)[nread-1] = '\0';
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor