krb5-locator: fix dsgetdcname caller.
[Samba.git] / source / libsmb / pwd_cache.c
blob071e729e8ca39746e6735c1e303681d03c424299
1 /*
2 Unix SMB/CIFS implementation.
3 Password cacheing. obfuscation is planned
4 Copyright (C) Luke Kenneth Casson Leighton 1996-1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
22 /****************************************************************************
23 Initialises a password structure.
24 ****************************************************************************/
26 static void pwd_init(struct pwd_info *pwd)
28 memset((char *)pwd->password , '\0', sizeof(pwd->password ));
30 pwd->null_pwd = True; /* safest option... */
33 /****************************************************************************
34 Stores a cleartext password.
35 ****************************************************************************/
37 void pwd_set_cleartext(struct pwd_info *pwd, const char *clr)
39 pwd_init(pwd);
40 if (clr) {
41 fstrcpy(pwd->password, clr);
42 pwd->null_pwd = False;
43 } else {
44 pwd->null_pwd = True;
47 pwd->cleartext = True;
50 /****************************************************************************
51 Gets a cleartext password.
52 ****************************************************************************/
54 void pwd_get_cleartext(struct pwd_info *pwd, fstring clr)
56 if (pwd->cleartext)
57 fstrcpy(clr, pwd->password);
58 else
59 clr[0] = 0;