2
Unix SMB/CIFS implementation.
3
passdb editing frontend
5
Copyright (C) Jeremy Allison 1998
6
Copyright (C) Andrew Tridgell 1998
7
Copyright (C) Tim Potter 2000
8
Copyright (C) Simo Sorce 2000
9
Copyright (C) Martin Pool 2001
10
Copyright (C) Gerald Carter 2002
11
Copyright (C) Andrew Bartlett 2003
13
This program is free software; you can redistribute it and/or modify
14
it under the terms of the GNU General Public License as published by
15
the Free Software Foundation; either version 2 of the License, or
16
(at your option) any later version.
18
This program is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
GNU General Public License for more details.
23
You should have received a copy of the GNU General Public License
24
along with this program; if not, write to the Free Software
25
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30
/*************************************************************
31
Utility function to prompt for passwords from stdin. Each
32
password entered must end with a newline.
33
*************************************************************/
34
char *stdin_new_passwd( void)
36
static fstring new_pw;
42
* if no error is reported from fgets() and string at least contains
43
* the newline that ends the password, then replace the newline with
46
if ( fgets(new_pw, sizeof(new_pw), stdin) != NULL) {
47
if ((len = strlen(new_pw)) > 0) {
48
if(new_pw[len-1] == '\n')
55
/*************************************************************
56
Utility function to get passwords via tty or stdin
57
Used if the '-s' (smbpasswd) or '-t' (pdbedit) option is set
58
to silently get passwords to enable scripting.
59
*************************************************************/
60
char *get_pass( const char *prompt, BOOL stdin_get)
64
p = stdin_new_passwd();
68
return smb_xstrdup( p);