2 Unix SMB/CIFS implementation.
3 SAMR Pipe utility functions.
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
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.
27 #define DBGC_CLASS DBGC_RPC_SRV
29 /*************************************************************
30 Copies a SAM_USER_INFO_23 to a SAM_ACCOUNT
31 **************************************************************/
33 void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
36 if (from == NULL || to == NULL)
39 pdb_set_logon_time(to,nt_time_to_unix(&from->logon_time), True);
40 pdb_set_logoff_time(to,nt_time_to_unix(&from->logoff_time), True);
41 pdb_set_kickoff_time(to, nt_time_to_unix(&from->kickoff_time), True);
42 pdb_set_pass_can_change_time(to, nt_time_to_unix(&from->pass_can_change_time), True);
43 pdb_set_pass_must_change_time(to, nt_time_to_unix(&from->pass_must_change_time), True);
45 pdb_set_pass_last_set_time(to, nt_time_to_unix(&from->pass_last_set_time));
47 if (from->uni_user_name.buffer)
48 pdb_set_username(to , pdb_unistr2_convert(&from->uni_user_name ));
49 if (from->uni_full_name.buffer)
50 pdb_set_fullname(to , pdb_unistr2_convert(&from->uni_full_name ));
51 if (from->uni_home_dir.buffer)
52 pdb_set_homedir(to , pdb_unistr2_convert(&from->uni_home_dir ), True);
53 if (from->uni_dir_drive.buffer)
54 pdb_set_dir_drive(to , pdb_unistr2_convert(&from->uni_dir_drive ), True);
55 if (from->uni_logon_script.buffer)
56 pdb_set_logon_script(to , pdb_unistr2_convert(&from->uni_logon_script), True);
57 if (from->uni_profile_path.buffer)
58 pdb_set_profile_path(to , pdb_unistr2_convert(&from->uni_profile_path), True);
59 if (from->uni_acct_desc.buffer)
60 pdb_set_acct_desc(to , pdb_unistr2_convert(&from->uni_acct_desc ));
61 if (from->uni_workstations.buffer)
62 pdb_set_workstations(to , pdb_unistr2_convert(&from->uni_workstations));
63 if (from->uni_unknown_str.buffer)
64 pdb_set_unknown_str(to , pdb_unistr2_convert(&from->uni_unknown_str ));
65 if (from->uni_munged_dial.buffer)
66 pdb_set_munged_dial(to , pdb_unistr2_convert(&from->uni_munged_dial ));
69 pdb_set_user_sid_from_rid(to, from->user_rid);
71 pdb_set_group_sid_from_rid(to, from->group_rid);
73 pdb_set_acct_ctrl(to, from->acb_info);
74 pdb_set_unknown_3(to, from->unknown_3);
76 pdb_set_logon_divs(to, from->logon_divs);
77 pdb_set_hours_len(to, from->logon_hrs.len);
78 pdb_set_hours(to, from->logon_hrs.hours);
80 pdb_set_unknown_5(to, from->unknown_5);
81 pdb_set_unknown_6(to, from->unknown_6);
85 /*************************************************************
87 **************************************************************/
89 void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
91 if (from == NULL || to == NULL)
94 pdb_set_logon_time(to,nt_time_to_unix(&from->logon_time), True);
95 pdb_set_logoff_time(to,nt_time_to_unix(&from->logoff_time), True);
96 pdb_set_kickoff_time(to, nt_time_to_unix(&from->kickoff_time), True);
97 pdb_set_pass_can_change_time(to, nt_time_to_unix(&from->pass_can_change_time), True);
98 pdb_set_pass_must_change_time(to, nt_time_to_unix(&from->pass_must_change_time), True);
100 pdb_set_pass_last_set_time(to, nt_time_to_unix(&from->pass_last_set_time));
102 if (from->uni_user_name.buffer)
103 pdb_set_username(to , pdb_unistr2_convert(&from->uni_user_name ));
104 if (from->uni_full_name.buffer)
105 pdb_set_fullname(to , pdb_unistr2_convert(&from->uni_full_name ));
106 if (from->uni_home_dir.buffer)
107 pdb_set_homedir(to , pdb_unistr2_convert(&from->uni_home_dir ), True);
108 if (from->uni_dir_drive.buffer)
109 pdb_set_dir_drive(to , pdb_unistr2_convert(&from->uni_dir_drive ), True);
110 if (from->uni_logon_script.buffer)
111 pdb_set_logon_script(to , pdb_unistr2_convert(&from->uni_logon_script), True);
112 if (from->uni_profile_path.buffer)
113 pdb_set_profile_path(to , pdb_unistr2_convert(&from->uni_profile_path), True);
114 if (from->uni_acct_desc.buffer)
115 pdb_set_acct_desc(to , pdb_unistr2_convert(&from->uni_acct_desc ));
116 if (from->uni_workstations.buffer)
117 pdb_set_workstations(to , pdb_unistr2_convert(&from->uni_workstations));
118 if (from->uni_unknown_str.buffer)
119 pdb_set_unknown_str(to , pdb_unistr2_convert(&from->uni_unknown_str ));
120 if (from->uni_munged_dial.buffer)
121 pdb_set_munged_dial(to , pdb_unistr2_convert(&from->uni_munged_dial ));
124 pdb_set_user_sid_from_rid(to, from->user_rid);
126 pdb_set_group_sid_from_rid(to, from->group_rid);
128 /* FIXME!! Do we need to copy the passwords here as well?
129 I don't know. Need to figure this out --jerry */
131 /* Passwords dealt with in caller --abartlet */
133 pdb_set_acct_ctrl(to, from->acb_info);
134 pdb_set_unknown_3(to, from->unknown_3);
136 pdb_set_logon_divs(to, from->logon_divs);
137 pdb_set_hours_len(to, from->logon_hrs.len);
138 pdb_set_hours(to, from->logon_hrs.hours);
140 pdb_set_unknown_5(to, from->unknown_5);
141 pdb_set_unknown_6(to, from->unknown_6);