The Samba-Bugzilla – Attachment 8727 Details for
Bug 9767
"net ads join" fails when called via stdin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Don't manipulate tty state (such as turning off echo) when prompting for passwords if we're not reading from a tty.
0001-getpass-Don-t-fail-if-stdin-is-not-a-tty.patch (text/plain), 2.21 KB, created by
Yassir Elley
on 2013-04-04 14:47:43 UTC
(
hide
)
Description:
Don't manipulate tty state (such as turning off echo) when prompting for passwords if we're not reading from a tty.
Filename:
MIME Type:
Creator:
Yassir Elley
Created:
2013-04-04 14:47:43 UTC
Size:
2.21 KB
patch
obsolete
>From 09f8155b5c0a97857b8f2d6c1854671d71385469 Mon Sep 17 00:00:00 2001 >From: Stef Walter <stefw@gnome.org> >Date: Thu, 4 Apr 2013 15:55:10 +0200 >Subject: [PATCH] getpass: Don't fail if stdin is not a tty > >We don't need to manipulate the tty state (such as turning off >echo) when prompting for passwords if we're not reading from a tty. >--- > lib/util/getpass.c | 52 +++++++++++++++++++++++++++++----------------------- > 1 file changed, 29 insertions(+), 23 deletions(-) > >diff --git a/lib/util/getpass.c b/lib/util/getpass.c >index 480bd56..0cbc7dd 100644 >--- a/lib/util/getpass.c >+++ b/lib/util/getpass.c >@@ -170,31 +170,34 @@ int samba_getpass(const char *prompt, > return -1; > } > >- ZERO_STRUCT(attr); >- ZERO_STRUCT(old_attr); >+ if (isatty (STDIN_FILENO)) { > >- /* get local terminal attributes */ >- if (tcgetattr(STDIN_FILENO, &attr) < 0) { >- perror("tcgetattr"); >- return -1; >- } >+ ZERO_STRUCT(attr); >+ ZERO_STRUCT(old_attr); > >- /* save terminal attributes */ >- memcpy(&old_attr, &attr, sizeof(attr)); >- if((fd = fcntl(0, F_GETFL, 0)) < 0) { >- perror("fcntl"); >- return -1; >- } >+ /* get local terminal attributes */ >+ if (tcgetattr(STDIN_FILENO, &attr) < 0) { >+ perror("tcgetattr"); >+ return -1; >+ } > >- /* disable echo */ >- if (!echo) { >- attr.c_lflag &= ~(ECHO); >- } >+ /* save terminal attributes */ >+ memcpy(&old_attr, &attr, sizeof(attr)); >+ if((fd = fcntl(0, F_GETFL, 0)) < 0) { >+ perror("fcntl"); >+ return -1; >+ } > >- /* write attributes to terminal */ >- if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &attr) < 0) { >- perror("tcsetattr"); >- return -1; >+ /* disable echo */ >+ if (!echo) { >+ attr.c_lflag &= ~(ECHO); >+ } >+ >+ /* write attributes to terminal */ >+ if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &attr) < 0) { >+ perror("tcsetattr"); >+ return -1; >+ } > } > > /* disable nonblocking I/O */ >@@ -204,8 +207,11 @@ int samba_getpass(const char *prompt, > > ok = samba_gets(prompt, buf, len, verify); > >- /* reset terminal */ >- tcsetattr(STDIN_FILENO, TCSANOW, &old_attr); >+ if (isatty (STDIN_FILENO)) { >+ >+ /* reset terminal */ >+ tcsetattr(STDIN_FILENO, TCSANOW, &old_attr); >+ } > > /* close fd */ > if (fd & O_NDELAY) { >-- >1.8.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 9767
: 8727 |
8734