2 Unix SMB/CIFS implementation.
3 passdb editing frontend
5 Copyright (C) Simo Sorce 2000
6 Copyright (C) Andrew Bartlett 2001
7 Copyright (C) Jelmer Vernooij 2002
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /*************************************************************
27 Utility function to prompt for passwords from stdin. Each
28 password entered must end with a newline.
29 *************************************************************/
30 char *stdin_new_passwd( void)
32 static fstring new_pw;
38 * if no error is reported from fgets() and string at least contains
39 * the newline that ends the password, then replace the newline with
42 if ( fgets(new_pw, sizeof(new_pw), stdin) != NULL) {
43 if ((len = strlen(new_pw)) > 0) {
44 if(new_pw[len-1] == '\n')
51 /*************************************************************
52 Utility function to get passwords via tty or stdin
53 Used if the '-t' option is set to silently get passwords
55 *************************************************************/
56 char *get_pass( char *prompt, BOOL stdin_get)
60 p = stdin_new_passwd();
64 return smb_xstrdup( p);