2 Unix SMB/CIFS implementation.
3 SAM_ACCOUNT access routines
4 Copyright (C) Jeremy Allison 1996-2001
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1998
6 Copyright (C) Gerald (Jerry) Carter 2000-2001
7 Copyright (C) Andrew Bartlett 2001-2002
8 Copyright (C) Stefan (metze) Metzmacher 2002
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #define DBGC_CLASS DBGC_PASSDB
31 * @todo Redefine this to NULL, but this changes the API becouse
32 * much of samba assumes that the pdb_get...() funtions
33 * return pstrings. (ie not null-pointers).
34 * See also pdb_fill_default_sam().
37 #define PDB_NOT_QUITE_NULL ""
39 /*********************************************************************
40 Collection of get...() functions for SAM_ACCOUNT_INFO.
41 ********************************************************************/
43 uint16
pdb_get_acct_ctrl (const SAM_ACCOUNT
*sampass
)
46 return (sampass
->private.acct_ctrl
);
48 return (ACB_DISABLED
);
51 time_t pdb_get_logon_time (const SAM_ACCOUNT
*sampass
)
54 return (sampass
->private.logon_time
);
59 time_t pdb_get_logoff_time (const SAM_ACCOUNT
*sampass
)
62 return (sampass
->private.logoff_time
);
67 time_t pdb_get_kickoff_time (const SAM_ACCOUNT
*sampass
)
70 return (sampass
->private.kickoff_time
);
75 time_t pdb_get_pass_last_set_time (const SAM_ACCOUNT
*sampass
)
78 return (sampass
->private.pass_last_set_time
);
83 time_t pdb_get_pass_can_change_time (const SAM_ACCOUNT
*sampass
)
86 return (sampass
->private.pass_can_change_time
);
91 time_t pdb_get_pass_must_change_time (const SAM_ACCOUNT
*sampass
)
94 return (sampass
->private.pass_must_change_time
);
99 uint16
pdb_get_logon_divs (const SAM_ACCOUNT
*sampass
)
102 return (sampass
->private.logon_divs
);
107 uint32
pdb_get_hours_len (const SAM_ACCOUNT
*sampass
)
110 return (sampass
->private.hours_len
);
115 const uint8
* pdb_get_hours (const SAM_ACCOUNT
*sampass
)
118 return (sampass
->private.hours
);
123 const uint8
* pdb_get_nt_passwd (const SAM_ACCOUNT
*sampass
)
126 SMB_ASSERT((!sampass
->private.nt_pw
.data
)
127 || sampass
->private.nt_pw
.length
== NT_HASH_LEN
);
128 return ((uint8
*)sampass
->private.nt_pw
.data
);
134 const uint8
* pdb_get_lanman_passwd (const SAM_ACCOUNT
*sampass
)
137 SMB_ASSERT((!sampass
->private.lm_pw
.data
)
138 || sampass
->private.lm_pw
.length
== LM_HASH_LEN
);
139 return ((uint8
*)sampass
->private.lm_pw
.data
);
145 /* Return the plaintext password if known. Most of the time
146 it isn't, so don't assume anything magic about this function.
148 Used to pass the plaintext to passdb backends that might
149 want to store more than just the NTLM hashes.
151 const char* pdb_get_plaintext_passwd (const SAM_ACCOUNT
*sampass
)
154 return (sampass
->private.plaintext_pw
);
159 const DOM_SID
*pdb_get_user_sid(const SAM_ACCOUNT
*sampass
)
162 return &sampass
->private.user_sid
;
167 const DOM_SID
*pdb_get_group_sid(const SAM_ACCOUNT
*sampass
)
170 return &sampass
->private.group_sid
;
176 * Get flags showing what is initalised in the SAM_ACCOUNT
177 * @param sampass the SAM_ACCOUNT in question
178 * @return the flags indicating the members initialised in the struct.
181 uint32
pdb_get_init_flag (const SAM_ACCOUNT
*sampass
)
184 return sampass
->private.init_flag
;
186 return FLAG_SAM_UNINIT
;
189 uid_t
pdb_get_uid (const SAM_ACCOUNT
*sampass
)
192 return (sampass
->private.uid
);
197 gid_t
pdb_get_gid (const SAM_ACCOUNT
*sampass
)
200 return (sampass
->private.gid
);
205 const char* pdb_get_username (const SAM_ACCOUNT
*sampass
)
208 return (sampass
->private.username
);
213 const char* pdb_get_domain (const SAM_ACCOUNT
*sampass
)
216 return (sampass
->private.domain
);
221 const char* pdb_get_nt_username (const SAM_ACCOUNT
*sampass
)
224 return (sampass
->private.nt_username
);
229 const char* pdb_get_fullname (const SAM_ACCOUNT
*sampass
)
232 return (sampass
->private.full_name
);
237 const char* pdb_get_homedir (const SAM_ACCOUNT
*sampass
)
240 return (sampass
->private.home_dir
);
245 const char* pdb_get_unix_homedir (const SAM_ACCOUNT
*sampass
)
248 return (sampass
->private.unix_home_dir
);
253 const char* pdb_get_dir_drive (const SAM_ACCOUNT
*sampass
)
256 return (sampass
->private.dir_drive
);
261 const char* pdb_get_logon_script (const SAM_ACCOUNT
*sampass
)
264 return (sampass
->private.logon_script
);
269 const char* pdb_get_profile_path (const SAM_ACCOUNT
*sampass
)
272 return (sampass
->private.profile_path
);
277 const char* pdb_get_acct_desc (const SAM_ACCOUNT
*sampass
)
280 return (sampass
->private.acct_desc
);
285 const char* pdb_get_workstations (const SAM_ACCOUNT
*sampass
)
288 return (sampass
->private.workstations
);
293 const char* pdb_get_unknown_str (const SAM_ACCOUNT
*sampass
)
296 return (sampass
->private.unknown_str
);
301 const char* pdb_get_munged_dial (const SAM_ACCOUNT
*sampass
)
304 return (sampass
->private.munged_dial
);
309 uint32
pdb_get_unknown3 (const SAM_ACCOUNT
*sampass
)
312 return (sampass
->private.unknown_3
);
317 uint32
pdb_get_unknown5 (const SAM_ACCOUNT
*sampass
)
320 return (sampass
->private.unknown_5
);
325 uint32
pdb_get_unknown6 (const SAM_ACCOUNT
*sampass
)
328 return (sampass
->private.unknown_6
);
333 /*********************************************************************
334 Collection of set...() functions for SAM_ACCOUNT_INFO.
335 ********************************************************************/
337 BOOL
pdb_set_acct_ctrl (SAM_ACCOUNT
*sampass
, uint16 flags
)
343 sampass
->private.acct_ctrl
= flags
;
350 BOOL
pdb_set_logon_time (SAM_ACCOUNT
*sampass
, time_t mytime
, BOOL store
)
355 sampass
->private.logon_time
= mytime
;
358 pdb_set_init_flag(sampass
, FLAG_SAM_LOGONTIME
);
363 BOOL
pdb_set_logoff_time (SAM_ACCOUNT
*sampass
, time_t mytime
, BOOL store
)
368 sampass
->private.logoff_time
= mytime
;
371 pdb_set_init_flag(sampass
, FLAG_SAM_LOGOFFTIME
);
376 BOOL
pdb_set_kickoff_time (SAM_ACCOUNT
*sampass
, time_t mytime
, BOOL store
)
381 sampass
->private.kickoff_time
= mytime
;
384 pdb_set_init_flag(sampass
, FLAG_SAM_KICKOFFTIME
);
389 BOOL
pdb_set_pass_can_change_time (SAM_ACCOUNT
*sampass
, time_t mytime
, BOOL store
)
394 sampass
->private.pass_can_change_time
= mytime
;
397 pdb_set_init_flag(sampass
, FLAG_SAM_CANCHANGETIME
);
402 BOOL
pdb_set_pass_must_change_time (SAM_ACCOUNT
*sampass
, time_t mytime
, BOOL store
)
407 sampass
->private.pass_must_change_time
= mytime
;
410 pdb_set_init_flag(sampass
, FLAG_SAM_MUSTCHANGETIME
);
415 BOOL
pdb_set_pass_last_set_time (SAM_ACCOUNT
*sampass
, time_t mytime
)
420 sampass
->private.pass_last_set_time
= mytime
;
425 BOOL
pdb_set_hours_len (SAM_ACCOUNT
*sampass
, uint32 len
)
430 sampass
->private.hours_len
= len
;
434 BOOL
pdb_set_logon_divs (SAM_ACCOUNT
*sampass
, uint16 hours
)
439 sampass
->private.logon_divs
= hours
;
444 * Set flags showing what is initalised in the SAM_ACCOUNT
445 * @param sampass the SAM_ACCOUNT in question
446 * @param flag The *new* flag to be set. Old flags preserved
447 * this flag is only added.
450 BOOL
pdb_set_init_flag (SAM_ACCOUNT
*sampass
, uint32 flag
)
455 sampass
->private.init_flag
|= flag
;
460 BOOL
pdb_set_uid (SAM_ACCOUNT
*sampass
, const uid_t uid
)
465 DEBUG(10, ("pdb_set_uid: setting uid %d, was %d\n",
466 (int)uid
, (int)sampass
->private.uid
));
468 sampass
->private.uid
= uid
;
469 pdb_set_init_flag(sampass
, FLAG_SAM_UID
);
475 BOOL
pdb_set_gid (SAM_ACCOUNT
*sampass
, const gid_t gid
)
480 DEBUG(10, ("pdb_set_gid: setting gid %d, was %d\n",
481 (int)gid
, (int)sampass
->private.gid
));
483 sampass
->private.gid
= gid
;
484 pdb_set_init_flag(sampass
, FLAG_SAM_GID
);
490 BOOL
pdb_set_user_sid (SAM_ACCOUNT
*sampass
, DOM_SID
*u_sid
)
492 if (!sampass
|| !u_sid
)
495 sid_copy(&sampass
->private.user_sid
, u_sid
);
497 DEBUG(10, ("pdb_set_user_sid: setting user sid %s\n",
498 sid_string_static(&sampass
->private.user_sid
)));
503 BOOL
pdb_set_user_sid_from_string (SAM_ACCOUNT
*sampass
, fstring u_sid
)
506 if (!sampass
|| !u_sid
)
509 DEBUG(10, ("pdb_set_user_sid_from_string: setting user sid %s\n",
512 if (!string_to_sid(&new_sid
, u_sid
)) {
513 DEBUG(1, ("pdb_set_user_sid_from_string: %s isn't a valid SID!\n", u_sid
));
517 if (!pdb_set_user_sid(sampass
, &new_sid
)) {
518 DEBUG(1, ("pdb_set_user_sid_from_string: could not set sid %s on SAM_ACCOUNT!\n", u_sid
));
525 BOOL
pdb_set_group_sid (SAM_ACCOUNT
*sampass
, DOM_SID
*g_sid
)
527 if (!sampass
|| !g_sid
)
530 sid_copy(&sampass
->private.group_sid
, g_sid
);
532 DEBUG(10, ("pdb_set_group_sid: setting group sid %s\n",
533 sid_string_static(&sampass
->private.group_sid
)));
538 BOOL
pdb_set_group_sid_from_string (SAM_ACCOUNT
*sampass
, fstring g_sid
)
541 if (!sampass
|| !g_sid
)
544 DEBUG(10, ("pdb_set_group_sid_from_string: setting group sid %s\n",
547 if (!string_to_sid(&new_sid
, g_sid
)) {
548 DEBUG(1, ("pdb_set_group_sid_from_string: %s isn't a valid SID!\n", g_sid
));
552 if (!pdb_set_group_sid(sampass
, &new_sid
)) {
553 DEBUG(1, ("pdb_set_group_sid_from_string: could not set sid %s on SAM_ACCOUNT!\n", g_sid
));
559 /*********************************************************************
560 Set the user's UNIX name.
561 ********************************************************************/
563 BOOL
pdb_set_username(SAM_ACCOUNT
*sampass
, const char *username
)
569 DEBUG(10, ("pdb_set_username: setting username %s, was %s\n", username
,
570 (sampass
->private.username
)?(sampass
->private.username
):"NULL"));
572 sampass
->private.username
= talloc_strdup(sampass
->mem_ctx
, username
);
574 if (!sampass
->private.username
) {
575 DEBUG(0, ("pdb_set_username: talloc_strdup() failed!\n"));
580 sampass
->private.username
= PDB_NOT_QUITE_NULL
;
586 /*********************************************************************
588 ********************************************************************/
590 BOOL
pdb_set_domain(SAM_ACCOUNT
*sampass
, const char *domain
)
596 DEBUG(10, ("pdb_set_domain: setting domain %s, was %s\n", domain
,
597 (sampass
->private.domain
)?(sampass
->private.domain
):"NULL"));
599 sampass
->private.domain
= talloc_strdup(sampass
->mem_ctx
, domain
);
601 if (!sampass
->private.domain
) {
602 DEBUG(0, ("pdb_set_domain: talloc_strdup() failed!\n"));
607 sampass
->private.domain
= PDB_NOT_QUITE_NULL
;
613 /*********************************************************************
614 Set the user's NT name.
615 ********************************************************************/
617 BOOL
pdb_set_nt_username(SAM_ACCOUNT
*sampass
, const char *nt_username
)
623 DEBUG(10, ("pdb_set_nt_username: setting nt username %s, was %s\n", nt_username
,
624 (sampass
->private.nt_username
)?(sampass
->private.nt_username
):"NULL"));
626 sampass
->private.nt_username
= talloc_strdup(sampass
->mem_ctx
, nt_username
);
628 if (!sampass
->private.nt_username
) {
629 DEBUG(0, ("pdb_set_nt_username: talloc_strdup() failed!\n"));
634 sampass
->private.nt_username
= PDB_NOT_QUITE_NULL
;
640 /*********************************************************************
641 Set the user's full name.
642 ********************************************************************/
644 BOOL
pdb_set_fullname(SAM_ACCOUNT
*sampass
, const char *full_name
)
650 DEBUG(10, ("pdb_set_full_name: setting full name %s, was %s\n", full_name
,
651 (sampass
->private.full_name
)?(sampass
->private.full_name
):"NULL"));
653 sampass
->private.full_name
= talloc_strdup(sampass
->mem_ctx
, full_name
);
655 if (!sampass
->private.full_name
) {
656 DEBUG(0, ("pdb_set_fullname: talloc_strdup() failed!\n"));
661 sampass
->private.full_name
= PDB_NOT_QUITE_NULL
;
667 /*********************************************************************
668 Set the user's logon script.
669 ********************************************************************/
671 BOOL
pdb_set_logon_script(SAM_ACCOUNT
*sampass
, const char *logon_script
, BOOL store
)
677 DEBUG(10, ("pdb_set_logon_script: setting logon script %s, was %s\n", logon_script
,
678 (sampass
->private.logon_script
)?(sampass
->private.logon_script
):"NULL"));
680 sampass
->private.logon_script
= talloc_strdup(sampass
->mem_ctx
, logon_script
);
682 if (!sampass
->private.logon_script
) {
683 DEBUG(0, ("pdb_set_logon_script: talloc_strdup() failed!\n"));
688 sampass
->private.logon_script
= PDB_NOT_QUITE_NULL
;
692 DEBUG(10, ("pdb_set_logon_script: setting logon script sam flag!\n"));
693 pdb_set_init_flag(sampass
, FLAG_SAM_LOGONSCRIPT
);
699 /*********************************************************************
700 Set the user's profile path.
701 ********************************************************************/
703 BOOL
pdb_set_profile_path (SAM_ACCOUNT
*sampass
, const char *profile_path
, BOOL store
)
709 DEBUG(10, ("pdb_set_profile_path: setting profile path %s, was %s\n", profile_path
,
710 (sampass
->private.profile_path
)?(sampass
->private.profile_path
):"NULL"));
712 sampass
->private.profile_path
= talloc_strdup(sampass
->mem_ctx
, profile_path
);
714 if (!sampass
->private.profile_path
) {
715 DEBUG(0, ("pdb_set_profile_path: talloc_strdup() failed!\n"));
720 sampass
->private.profile_path
= PDB_NOT_QUITE_NULL
;
724 DEBUG(10, ("pdb_set_profile_path: setting profile path sam flag!\n"));
725 pdb_set_init_flag(sampass
, FLAG_SAM_PROFILE
);
731 /*********************************************************************
732 Set the user's directory drive.
733 ********************************************************************/
735 BOOL
pdb_set_dir_drive (SAM_ACCOUNT
*sampass
, const char *dir_drive
, BOOL store
)
741 DEBUG(10, ("pdb_set_dir_drive: setting dir drive %s, was %s\n", dir_drive
,
742 (sampass
->private.dir_drive
)?(sampass
->private.dir_drive
):"NULL"));
744 sampass
->private.dir_drive
= talloc_strdup(sampass
->mem_ctx
, dir_drive
);
746 if (!sampass
->private.dir_drive
) {
747 DEBUG(0, ("pdb_set_dir_drive: talloc_strdup() failed!\n"));
752 sampass
->private.dir_drive
= PDB_NOT_QUITE_NULL
;
756 DEBUG(10, ("pdb_set_dir_drive: setting dir drive sam flag!\n"));
757 pdb_set_init_flag(sampass
, FLAG_SAM_DRIVE
);
763 /*********************************************************************
764 Set the user's home directory.
765 ********************************************************************/
767 BOOL
pdb_set_homedir (SAM_ACCOUNT
*sampass
, const char *home_dir
, BOOL store
)
773 DEBUG(10, ("pdb_set_homedir: setting home dir %s, was %s\n", home_dir
,
774 (sampass
->private.home_dir
)?(sampass
->private.home_dir
):"NULL"));
776 sampass
->private.home_dir
= talloc_strdup(sampass
->mem_ctx
, home_dir
);
778 if (!sampass
->private.home_dir
) {
779 DEBUG(0, ("pdb_set_home_dir: talloc_strdup() failed!\n"));
784 sampass
->private.home_dir
= PDB_NOT_QUITE_NULL
;
788 DEBUG(10, ("pdb_set_homedir: setting home dir sam flag!\n"));
789 pdb_set_init_flag(sampass
, FLAG_SAM_SMBHOME
);
795 /*********************************************************************
796 Set the user's unix home directory.
797 ********************************************************************/
799 BOOL
pdb_set_unix_homedir (SAM_ACCOUNT
*sampass
, const char *unix_home_dir
)
805 DEBUG(10, ("pdb_set_unix_homedir: setting home dir %s, was %s\n", unix_home_dir
,
806 (sampass
->private.unix_home_dir
)?(sampass
->private.unix_home_dir
):"NULL"));
808 sampass
->private.unix_home_dir
= talloc_strdup(sampass
->mem_ctx
,
811 if (!sampass
->private.unix_home_dir
) {
812 DEBUG(0, ("pdb_set_unix_home_dir: talloc_strdup() failed!\n"));
817 sampass
->private.unix_home_dir
= PDB_NOT_QUITE_NULL
;
823 /*********************************************************************
824 Set the user's account description.
825 ********************************************************************/
827 BOOL
pdb_set_acct_desc (SAM_ACCOUNT
*sampass
, const char *acct_desc
)
833 sampass
->private.acct_desc
= talloc_strdup(sampass
->mem_ctx
, acct_desc
);
835 if (!sampass
->private.acct_desc
) {
836 DEBUG(0, ("pdb_set_acct_desc: talloc_strdup() failed!\n"));
841 sampass
->private.acct_desc
= PDB_NOT_QUITE_NULL
;
847 /*********************************************************************
848 Set the user's workstation allowed list.
849 ********************************************************************/
851 BOOL
pdb_set_workstations (SAM_ACCOUNT
*sampass
, const char *workstations
)
857 DEBUG(10, ("pdb_set_workstations: setting workstations %s, was %s\n", workstations
,
858 (sampass
->private.workstations
)?(sampass
->private.workstations
):"NULL"));
860 sampass
->private.workstations
= talloc_strdup(sampass
->mem_ctx
, workstations
);
862 if (!sampass
->private.workstations
) {
863 DEBUG(0, ("pdb_set_workstations: talloc_strdup() failed!\n"));
868 sampass
->private.workstations
= PDB_NOT_QUITE_NULL
;
874 /*********************************************************************
875 Set the user's 'unknown_str', whatever the heck this actually is...
876 ********************************************************************/
878 BOOL
pdb_set_unknown_str (SAM_ACCOUNT
*sampass
, const char *unknown_str
)
884 sampass
->private.unknown_str
= talloc_strdup(sampass
->mem_ctx
, unknown_str
);
886 if (!sampass
->private.unknown_str
) {
887 DEBUG(0, ("pdb_set_unknown_str: talloc_strdup() failed!\n"));
892 sampass
->private.unknown_str
= PDB_NOT_QUITE_NULL
;
898 /*********************************************************************
899 Set the user's dial string.
900 ********************************************************************/
902 BOOL
pdb_set_munged_dial (SAM_ACCOUNT
*sampass
, const char *munged_dial
)
908 sampass
->private.munged_dial
= talloc_strdup(sampass
->mem_ctx
, munged_dial
);
910 if (!sampass
->private.munged_dial
) {
911 DEBUG(0, ("pdb_set_munged_dial: talloc_strdup() failed!\n"));
916 sampass
->private.munged_dial
= PDB_NOT_QUITE_NULL
;
922 /*********************************************************************
923 Set the user's NT hash.
924 ********************************************************************/
926 BOOL
pdb_set_nt_passwd (SAM_ACCOUNT
*sampass
, const uint8
*pwd
)
931 data_blob_clear_free(&sampass
->private.nt_pw
);
933 sampass
->private.nt_pw
= data_blob(pwd
, NT_HASH_LEN
);
938 /*********************************************************************
939 Set the user's LM hash.
940 ********************************************************************/
942 BOOL
pdb_set_lanman_passwd (SAM_ACCOUNT
*sampass
, const uint8 pwd
[16])
947 data_blob_clear_free(&sampass
->private.lm_pw
);
949 sampass
->private.lm_pw
= data_blob(pwd
, LM_HASH_LEN
);
954 /*********************************************************************
955 Set the user's plaintext password only (base procedure, see helper
957 ********************************************************************/
959 BOOL
pdb_set_plaintext_pw_only (SAM_ACCOUNT
*sampass
, const char *password
)
965 if (sampass
->private.plaintext_pw
!=NULL
)
966 memset(sampass
->private.plaintext_pw
,'\0',strlen(sampass
->private.plaintext_pw
)+1);
968 sampass
->private.plaintext_pw
= talloc_strdup(sampass
->mem_ctx
, password
);
970 if (!sampass
->private.plaintext_pw
) {
971 DEBUG(0, ("pdb_set_unknown_str: talloc_strdup() failed!\n"));
976 sampass
->private.plaintext_pw
= NULL
;
982 BOOL
pdb_set_unknown_3 (SAM_ACCOUNT
*sampass
, uint32 unkn
)
987 sampass
->private.unknown_3
= unkn
;
991 BOOL
pdb_set_unknown_5 (SAM_ACCOUNT
*sampass
, uint32 unkn
)
996 sampass
->private.unknown_5
= unkn
;
1000 BOOL
pdb_set_unknown_6 (SAM_ACCOUNT
*sampass
, uint32 unkn
)
1005 sampass
->private.unknown_6
= unkn
;
1009 BOOL
pdb_set_hours (SAM_ACCOUNT
*sampass
, const uint8
*hours
)
1015 memset ((char *)sampass
->private.hours
, 0, MAX_HOURS_LEN
);
1019 memcpy (sampass
->private.hours
, hours
, MAX_HOURS_LEN
);
1025 /* Helpful interfaces to the above */
1027 /*********************************************************************
1028 Sets the last changed times and must change times for a normal
1030 ********************************************************************/
1032 BOOL
pdb_set_pass_changed_now (SAM_ACCOUNT
*sampass
)
1039 if (!pdb_set_pass_last_set_time (sampass
, time(NULL
)))
1042 if (!account_policy_get(AP_MAX_PASSWORD_AGE
, &expire
)
1043 || (expire
==(uint32
)-1)) {
1044 if (!pdb_set_pass_must_change_time (sampass
, get_time_t_max(), False
))
1047 if (!pdb_set_pass_must_change_time (sampass
,
1048 pdb_get_pass_last_set_time(sampass
)
1056 /*********************************************************************
1057 Set the user's PLAINTEXT password. Used as an interface to the above.
1058 Also sets the last change time to NOW.
1059 ********************************************************************/
1061 BOOL
pdb_set_plaintext_passwd (SAM_ACCOUNT
*sampass
, const char *plaintext
)
1063 uchar new_lanman_p16
[16];
1064 uchar new_nt_p16
[16];
1066 if (!sampass
|| !plaintext
)
1069 nt_lm_owf_gen (plaintext
, new_nt_p16
, new_lanman_p16
);
1071 if (!pdb_set_nt_passwd (sampass
, new_nt_p16
))
1074 if (!pdb_set_lanman_passwd (sampass
, new_lanman_p16
))
1077 if (!pdb_set_plaintext_pw_only (sampass
, plaintext
))
1080 if (!pdb_set_pass_changed_now (sampass
))