docs: fix two typos in the mount.cifs manpage
[Samba.git] / source / libsmb / pwd_cache.c
bloba0f3383e2970c38fc1c7200675508331df7db6ad
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 2 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, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "includes.h"
23 /****************************************************************************
24 Initialises a password structure.
25 ****************************************************************************/
27 static void pwd_init(struct pwd_info *pwd)
29 memset((char *)pwd->password , '\0', sizeof(pwd->password ));
31 pwd->null_pwd = True; /* safest option... */
34 /****************************************************************************
35 Stores a cleartext password.
36 ****************************************************************************/
38 void pwd_set_cleartext(struct pwd_info *pwd, const char *clr)
40 pwd_init(pwd);
41 if (clr) {
42 fstrcpy(pwd->password, clr);
43 pwd->null_pwd = False;
44 } else {
45 pwd->null_pwd = True;
48 pwd->cleartext = True;
51 /****************************************************************************
52 Gets a cleartext password.
53 ****************************************************************************/
55 void pwd_get_cleartext(struct pwd_info *pwd, fstring clr)
57 if (pwd->cleartext)
58 fstrcpy(clr, pwd->password);
59 else
60 clr[0] = 0;