2 Unix SMB/CIFS implementation.
3 dump the remote SAM using rpc samsync operations
5 Copyright (C) Andrew Tridgell 2002
6 Copyright (C) Tim Potter 2001,2002
7 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2005
8 Modified by Volker Lendecke 2002
9 Copyright (C) Jeremy Allison 2005.
10 Copyright (C) Guenther Deschner 2008.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #include "system/passwd.h"
28 #include "libnet/libnet_samsync.h"
29 #include "../libcli/security/security.h"
32 /* Convert a struct samu_DELTA to a struct samu. */
33 #define STRING_CHANGED (old_string && !new_string) ||\
34 (!old_string && new_string) ||\
35 (old_string && new_string && (strcmp(old_string, new_string) != 0))
37 #define STRING_CHANGED_NC(s1,s2) ((s1) && !(s2)) ||\
39 ((s1) && (s2) && (strcmp((s1), (s2)) != 0))
41 /****************************************************************
42 ****************************************************************/
44 static NTSTATUS
sam_account_from_delta(struct samu
*account
,
45 struct netr_DELTA_USER
*r
)
47 const char *old_string
, *new_string
;
48 time_t unix_time
, stored_time
;
51 memset(zero_buf
, '\0', sizeof(zero_buf
));
53 /* Username, fullname, home dir, dir drive, logon script, acct
54 desc, workstations, profile. */
56 if (r
->account_name
.string
) {
57 old_string
= pdb_get_nt_username(account
);
58 new_string
= r
->account_name
.string
;
61 pdb_set_nt_username(account
, new_string
, PDB_CHANGED
);
64 /* Unix username is the same - for sanity */
65 old_string
= pdb_get_username( account
);
67 pdb_set_username(account
, new_string
, PDB_CHANGED
);
71 if (r
->full_name
.string
) {
72 old_string
= pdb_get_fullname(account
);
73 new_string
= r
->full_name
.string
;
76 pdb_set_fullname(account
, new_string
, PDB_CHANGED
);
79 if (r
->home_directory
.string
) {
80 old_string
= pdb_get_homedir(account
);
81 new_string
= r
->home_directory
.string
;
84 pdb_set_homedir(account
, new_string
, PDB_CHANGED
);
87 if (r
->home_drive
.string
) {
88 old_string
= pdb_get_dir_drive(account
);
89 new_string
= r
->home_drive
.string
;
92 pdb_set_dir_drive(account
, new_string
, PDB_CHANGED
);
95 if (r
->logon_script
.string
) {
96 old_string
= pdb_get_logon_script(account
);
97 new_string
= r
->logon_script
.string
;
100 pdb_set_logon_script(account
, new_string
, PDB_CHANGED
);
103 if (r
->description
.string
) {
104 old_string
= pdb_get_acct_desc(account
);
105 new_string
= r
->description
.string
;
108 pdb_set_acct_desc(account
, new_string
, PDB_CHANGED
);
111 if (r
->workstations
.string
) {
112 old_string
= pdb_get_workstations(account
);
113 new_string
= r
->workstations
.string
;
116 pdb_set_workstations(account
, new_string
, PDB_CHANGED
);
119 if (r
->profile_path
.string
) {
120 old_string
= pdb_get_profile_path(account
);
121 new_string
= r
->profile_path
.string
;
124 pdb_set_profile_path(account
, new_string
, PDB_CHANGED
);
127 if (r
->parameters
.array
) {
130 old_string
= pdb_get_munged_dial(account
);
131 mung
.length
= r
->parameters
.length
* 2;
132 mung
.data
= (uint8_t *) r
->parameters
.array
;
133 newstr
= (mung
.length
== 0) ? NULL
:
134 base64_encode_data_blob(talloc_tos(), mung
);
136 if (STRING_CHANGED_NC(old_string
, newstr
))
137 pdb_set_munged_dial(account
, newstr
, PDB_CHANGED
);
141 /* User and group sid */
142 if (pdb_get_user_rid(account
) != r
->rid
)
143 pdb_set_user_sid_from_rid(account
, r
->rid
, PDB_CHANGED
);
144 if (pdb_get_group_rid(account
) != r
->primary_gid
)
145 pdb_set_group_sid_from_rid(account
, r
->primary_gid
, PDB_CHANGED
);
147 /* Logon and password information */
148 if (!nt_time_is_zero(&r
->last_logon
)) {
149 unix_time
= nt_time_to_unix(r
->last_logon
);
150 stored_time
= pdb_get_logon_time(account
);
151 if (stored_time
!= unix_time
)
152 pdb_set_logon_time(account
, unix_time
, PDB_CHANGED
);
155 if (!nt_time_is_zero(&r
->last_logoff
)) {
156 unix_time
= nt_time_to_unix(r
->last_logoff
);
157 stored_time
= pdb_get_logoff_time(account
);
158 if (stored_time
!= unix_time
)
159 pdb_set_logoff_time(account
, unix_time
,PDB_CHANGED
);
163 if (pdb_get_logon_divs(account
) != r
->logon_hours
.units_per_week
)
164 pdb_set_logon_divs(account
, r
->logon_hours
.units_per_week
, PDB_CHANGED
);
167 /* no idea what to do with this one - gd */
168 /* Max Logon Hours */
169 if (delta
->unknown1
!= pdb_get_unknown_6(account
)) {
170 pdb_set_unknown_6(account
, delta
->unknown1
, PDB_CHANGED
);
173 /* Logon Hours Len */
174 if (r
->logon_hours
.units_per_week
/8 != pdb_get_hours_len(account
)) {
175 pdb_set_hours_len(account
, r
->logon_hours
.units_per_week
/8, PDB_CHANGED
);
179 if (r
->logon_hours
.bits
) {
180 char oldstr
[44], newstr
[44];
181 pdb_sethexhours(oldstr
, pdb_get_hours(account
));
182 pdb_sethexhours(newstr
, r
->logon_hours
.bits
);
183 if (!strequal(oldstr
, newstr
))
184 pdb_set_hours(account
, r
->logon_hours
.bits
,
185 pdb_get_hours_len(account
), PDB_CHANGED
);
188 if (pdb_get_bad_password_count(account
) != r
->bad_password_count
)
189 pdb_set_bad_password_count(account
, r
->bad_password_count
, PDB_CHANGED
);
191 if (pdb_get_logon_count(account
) != r
->logon_count
)
192 pdb_set_logon_count(account
, r
->logon_count
, PDB_CHANGED
);
194 if (!nt_time_is_zero(&r
->last_password_change
)) {
195 unix_time
= nt_time_to_unix(r
->last_password_change
);
196 stored_time
= pdb_get_pass_last_set_time(account
);
197 if (stored_time
!= unix_time
)
198 pdb_set_pass_last_set_time(account
, unix_time
, PDB_CHANGED
);
200 /* no last set time, make it now */
201 pdb_set_pass_last_set_time(account
, time(NULL
), PDB_CHANGED
);
204 if (!nt_time_is_zero(&r
->acct_expiry
)) {
205 unix_time
= nt_time_to_unix(r
->acct_expiry
);
206 stored_time
= pdb_get_kickoff_time(account
);
207 if (stored_time
!= unix_time
)
208 pdb_set_kickoff_time(account
, unix_time
, PDB_CHANGED
);
211 /* Decode hashes from password hash
212 Note that win2000 may send us all zeros for the hashes if it doesn't
213 think this channel is secure enough - don't set the passwords at all
216 if (memcmp(r
->lmpassword
.hash
, zero_buf
, 16) != 0) {
217 pdb_set_lanman_passwd(account
, r
->lmpassword
.hash
, PDB_CHANGED
);
220 if (memcmp(r
->ntpassword
.hash
, zero_buf
, 16) != 0) {
221 pdb_set_nt_passwd(account
, r
->ntpassword
.hash
, PDB_CHANGED
);
224 /* TODO: account expiry time */
226 pdb_set_acct_ctrl(account
, r
->acct_flags
, PDB_CHANGED
);
228 pdb_set_domain(account
, lp_workgroup(), PDB_CHANGED
);
234 /****************************************************************
235 ****************************************************************/
237 static NTSTATUS
smb_create_user(TALLOC_CTX
*mem_ctx
,
240 struct passwd
**passwd_p
)
242 struct passwd
*passwd
;
243 char *add_script
= NULL
;
245 passwd
= Get_Pwnam_alloc(mem_ctx
, account
);
251 /* Create appropriate user */
252 if (acct_flags
& ACB_NORMAL
) {
253 add_script
= talloc_strdup(mem_ctx
, lp_adduser_script());
254 } else if ( (acct_flags
& ACB_WSTRUST
) ||
255 (acct_flags
& ACB_SVRTRUST
) ||
256 (acct_flags
& ACB_DOMTRUST
) ) {
257 add_script
= talloc_strdup(mem_ctx
, lp_addmachine_script());
259 DEBUG(1, ("Unknown user type: %s\n",
260 pdb_encode_acct_ctrl(acct_flags
, NEW_PW_FORMAT_SPACE_PADDED_LEN
)));
261 return NT_STATUS_UNSUCCESSFUL
;
265 return NT_STATUS_NO_MEMORY
;
270 add_script
= talloc_all_string_sub(mem_ctx
, add_script
,
273 return NT_STATUS_NO_MEMORY
;
275 add_ret
= smbrun(add_script
, NULL
);
276 DEBUG(add_ret
? 0 : 1,("fetch_account: Running the command `%s' "
277 "gave %d\n", add_script
, add_ret
));
279 smb_nscd_flush_user_cache();
283 /* try and find the possible unix account again */
284 passwd
= Get_Pwnam_alloc(mem_ctx
, account
);
286 return NT_STATUS_NO_SUCH_USER
;
293 /****************************************************************
294 ****************************************************************/
296 static NTSTATUS
fetch_account_info(TALLOC_CTX
*mem_ctx
,
298 struct netr_DELTA_USER
*r
)
301 NTSTATUS nt_ret
= NT_STATUS_UNSUCCESSFUL
;
303 struct samu
*sam_account
=NULL
;
304 GROUP_MAP
*map
= NULL
;
306 struct dom_sid user_sid
;
307 struct dom_sid group_sid
;
308 struct passwd
*passwd
= NULL
;
311 fstrcpy(account
, r
->account_name
.string
);
312 d_printf("Creating account: %s\n", account
);
314 if ( !(sam_account
= samu_new(mem_ctx
)) ) {
315 return NT_STATUS_NO_MEMORY
;
318 nt_ret
= smb_create_user(sam_account
, r
->acct_flags
, account
, &passwd
);
319 if (!NT_STATUS_IS_OK(nt_ret
)) {
320 d_fprintf(stderr
, "Could not create posix account info for '%s'\n",
325 sid_compose(&user_sid
, get_global_sam_sid(), r
->rid
);
327 DEBUG(3, ("Attempting to find SID %s for user %s in the passdb\n",
328 sid_to_fstring(sid_string
, &user_sid
), account
));
329 if (!pdb_getsampwsid(sam_account
, &user_sid
)) {
330 sam_account_from_delta(sam_account
, r
);
331 DEBUG(3, ("Attempting to add user SID %s for user %s in the passdb\n",
332 sid_to_fstring(sid_string
, &user_sid
),
333 pdb_get_username(sam_account
)));
334 if (!NT_STATUS_IS_OK(pdb_add_sam_account(sam_account
))) {
335 DEBUG(1, ("SAM Account for %s failed to be added to the passdb!\n",
337 return NT_STATUS_ACCESS_DENIED
;
340 sam_account_from_delta(sam_account
, r
);
341 DEBUG(3, ("Attempting to update user SID %s for user %s in the passdb\n",
342 sid_to_fstring(sid_string
, &user_sid
),
343 pdb_get_username(sam_account
)));
344 if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_account
))) {
345 DEBUG(1, ("SAM Account for %s failed to be updated in the passdb!\n",
347 TALLOC_FREE(sam_account
);
348 return NT_STATUS_ACCESS_DENIED
;
352 if (pdb_get_group_sid(sam_account
) == NULL
) {
353 return NT_STATUS_UNSUCCESSFUL
;
356 group_sid
= *pdb_get_group_sid(sam_account
);
358 map
= talloc_zero(mem_ctx
, GROUP_MAP
);
360 return NT_STATUS_NO_MEMORY
;
363 if (!pdb_getgrsid(map
, group_sid
)) {
364 DEBUG(0, ("Primary group of %s has no mapping!\n",
365 pdb_get_username(sam_account
)));
367 if (map
->gid
!= passwd
->pw_gid
) {
368 if (!(grp
= getgrgid(map
->gid
))) {
369 DEBUG(0, ("Could not find unix group %lu for user %s (group SID=%s)\n",
370 (unsigned long)map
->gid
, pdb_get_username(sam_account
), sid_string_tos(&group_sid
)));
372 smb_set_primary_group(grp
->gr_name
, pdb_get_username(sam_account
));
378 DEBUG(1, ("No unix user for this account (%s), cannot adjust mappings\n",
379 pdb_get_username(sam_account
)));
383 TALLOC_FREE(sam_account
);
388 /****************************************************************
389 ****************************************************************/
391 static NTSTATUS
fetch_group_info(TALLOC_CTX
*mem_ctx
,
393 struct netr_DELTA_GROUP
*r
)
395 struct group
*grp
= NULL
;
396 struct dom_sid group_sid
;
401 map
= talloc_zero(mem_ctx
, GROUP_MAP
);
403 return NT_STATUS_NO_MEMORY
;
405 /* add the group to the mapping table */
406 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
407 sid_to_fstring(sid_string
, &group_sid
);
409 if (pdb_getgrsid(map
, group_sid
)) {
410 if (map
->gid
!= -1) {
411 grp
= getgrgid(map
->gid
);
416 map
->nt_name
= talloc_strdup(map
, r
->group_name
.string
);
418 return NT_STATUS_NO_MEMORY
;
420 map
->comment
= talloc_strdup(map
, r
->description
.string
);
422 return NT_STATUS_NO_MEMORY
;
428 /* No group found from mapping, find it from its name. */
429 if ((grp
= getgrnam(map
->nt_name
)) == NULL
) {
431 /* No appropriate group found, create one */
433 d_printf("Creating unix group: '%s'\n", map
->nt_name
);
435 if (smb_create_group(map
->nt_name
, &gid
) != 0)
436 return NT_STATUS_ACCESS_DENIED
;
438 if ((grp
= getgrnam(map
->nt_name
)) == NULL
)
439 return NT_STATUS_ACCESS_DENIED
;
443 map
->gid
= grp
->gr_gid
;
444 map
->sid
= group_sid
;
445 map
->sid_name_use
= SID_NAME_DOM_GRP
;
448 pdb_add_group_mapping_entry(map
);
450 pdb_update_group_mapping_entry(map
);
457 /****************************************************************
458 ****************************************************************/
460 static NTSTATUS
fetch_group_mem_info(TALLOC_CTX
*mem_ctx
,
462 struct netr_DELTA_GROUP_MEMBER
*r
)
465 char **nt_members
= NULL
;
467 struct dom_sid group_sid
;
471 if (r
->num_rids
== 0) {
475 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
477 map
= talloc_zero(mem_ctx
, GROUP_MAP
);
479 return NT_STATUS_NO_MEMORY
;
482 if (!get_domain_group_from_sid(group_sid
, map
)) {
483 DEBUG(0, ("Could not find global group %d\n", rid
));
485 return NT_STATUS_NO_SUCH_GROUP
;
488 if (!(grp
= getgrgid(map
->gid
))) {
489 DEBUG(0, ("Could not find unix group %lu\n",
490 (unsigned long)map
->gid
));
492 return NT_STATUS_NO_SUCH_GROUP
;
497 d_printf("Group members of %s: ", grp
->gr_name
);
500 if ((nt_members
= talloc_zero_array(mem_ctx
, char *, r
->num_rids
)) == NULL
) {
501 DEBUG(0, ("talloc failed\n"));
502 return NT_STATUS_NO_MEMORY
;
508 for (i
=0; i
< r
->num_rids
; i
++) {
509 struct samu
*member
= NULL
;
510 struct dom_sid member_sid
;
512 if ( !(member
= samu_new(mem_ctx
)) ) {
513 return NT_STATUS_NO_MEMORY
;
516 sid_compose(&member_sid
, get_global_sam_sid(), r
->rids
[i
]);
518 if (!pdb_getsampwsid(member
, &member_sid
)) {
519 DEBUG(1, ("Found bogus group member: %d (member_sid=%s group=%s)\n",
520 r
->rids
[i
], sid_string_tos(&member_sid
), grp
->gr_name
));
525 if (pdb_get_group_rid(member
) == rid
) {
526 d_printf("%s(primary),", pdb_get_username(member
));
531 d_printf("%s,", pdb_get_username(member
));
532 nt_members
[i
] = talloc_strdup(mem_ctx
, pdb_get_username(member
));
538 unix_members
= grp
->gr_mem
;
540 while (*unix_members
) {
541 bool is_nt_member
= false;
542 for (i
=0; i
< r
->num_rids
; i
++) {
543 if (nt_members
[i
] == NULL
) {
544 /* This was a primary group */
548 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
554 /* We look at a unix group member that is not
555 an nt group member. So, remove it. NT is
557 smb_delete_user_group(grp
->gr_name
, *unix_members
);
562 for (i
=0; i
< r
->num_rids
; i
++) {
563 bool is_unix_member
= false;
565 if (nt_members
[i
] == NULL
) {
566 /* This was the primary group */
570 unix_members
= grp
->gr_mem
;
572 while (*unix_members
) {
573 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
574 is_unix_member
= true;
580 if (!is_unix_member
) {
581 /* We look at a nt group member that is not a
582 unix group member currently. So, add the nt
584 smb_add_user_group(grp
->gr_name
, nt_members
[i
]);
591 /****************************************************************
592 ****************************************************************/
594 static NTSTATUS
fetch_alias_info(TALLOC_CTX
*mem_ctx
,
596 struct netr_DELTA_ALIAS
*r
,
597 const struct dom_sid
*dom_sid
)
599 struct group
*grp
= NULL
;
600 struct dom_sid alias_sid
;
605 map
= talloc_zero(mem_ctx
, GROUP_MAP
);
607 return NT_STATUS_NO_MEMORY
;
610 /* Find out whether the group is already mapped */
611 sid_compose(&alias_sid
, dom_sid
, rid
);
612 sid_to_fstring(sid_string
, &alias_sid
);
614 if (pdb_getgrsid(map
, alias_sid
)) {
615 grp
= getgrgid(map
->gid
);
619 map
->nt_name
= talloc_strdup(map
, r
->alias_name
.string
);
621 return NT_STATUS_NO_MEMORY
;
623 map
->comment
= talloc_strdup(map
, r
->description
.string
);
625 return NT_STATUS_NO_MEMORY
;
631 /* No group found from mapping, find it from its name. */
632 if ((grp
= getgrnam(map
->nt_name
)) == NULL
) {
633 /* No appropriate group found, create one */
634 d_printf("Creating unix group: '%s'\n", map
->nt_name
);
635 if (smb_create_group(map
->nt_name
, &gid
) != 0)
636 return NT_STATUS_ACCESS_DENIED
;
637 if ((grp
= getgrgid(gid
)) == NULL
)
638 return NT_STATUS_ACCESS_DENIED
;
642 map
->gid
= grp
->gr_gid
;
643 map
->sid
= alias_sid
;
645 if (dom_sid_equal(dom_sid
, &global_sid_Builtin
)) {
646 map
->sid_name_use
= SID_NAME_WKN_GRP
;
648 map
->sid_name_use
= SID_NAME_ALIAS
;
652 pdb_add_group_mapping_entry(map
);
654 pdb_update_group_mapping_entry(map
);
661 /****************************************************************
662 ****************************************************************/
664 static NTSTATUS
fetch_alias_mem(TALLOC_CTX
*mem_ctx
,
666 struct netr_DELTA_ALIAS_MEMBER
*r
,
667 const struct dom_sid
*dom_sid
)
672 /****************************************************************
673 ****************************************************************/
675 static NTSTATUS
fetch_domain_info(TALLOC_CTX
*mem_ctx
,
677 struct netr_DELTA_DOMAIN
*r
)
679 time_t u_max_age
, u_min_age
, u_logout
;
680 NTSTATUS nt_status
= NT_STATUS_UNSUCCESSFUL
;
682 struct netr_AcctLockStr
*lockstr
= NULL
;
685 status
= pull_netr_AcctLockStr(mem_ctx
, &r
->account_lockout
,
687 if (!NT_STATUS_IS_OK(status
)) {
688 d_printf("failed to pull account lockout string: %s\n",
692 u_max_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->max_password_age
);
693 u_min_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->min_password_age
);
694 u_logout
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->force_logoff_time
);
696 domname
= r
->domain_name
.string
;
698 return NT_STATUS_NO_MEMORY
;
701 /* we don't handle BUILTIN account policies */
702 if (!strequal(domname
, get_global_sam_name())) {
703 printf("skipping SAM_DOMAIN_INFO delta for '%s' (is not my domain)\n", domname
);
708 if (!pdb_set_account_policy(PDB_POLICY_PASSWORD_HISTORY
,
709 r
->password_history_length
))
712 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_LEN
,
713 r
->min_password_length
))
716 if (!pdb_set_account_policy(PDB_POLICY_MAX_PASSWORD_AGE
,
720 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_AGE
,
724 if (!pdb_set_account_policy(PDB_POLICY_TIME_TO_LOGOUT
,
729 time_t u_lockoutreset
, u_lockouttime
;
731 u_lockoutreset
= uint64s_nt_time_to_unix_abs(&lockstr
->reset_count
);
732 u_lockouttime
= uint64s_nt_time_to_unix_abs((uint64_t *)&lockstr
->lockout_duration
);
734 if (!pdb_set_account_policy(PDB_POLICY_BAD_ATTEMPT_LOCKOUT
,
735 lockstr
->bad_attempt_lockout
))
738 if (!pdb_set_account_policy(PDB_POLICY_RESET_COUNT_TIME
,
739 (uint32_t)u_lockoutreset
/60))
742 if (u_lockouttime
!= -1)
745 if (!pdb_set_account_policy(PDB_POLICY_LOCK_ACCOUNT_DURATION
,
746 (uint32_t)u_lockouttime
))
750 if (!pdb_set_account_policy(PDB_POLICY_USER_MUST_LOGON_TO_CHG_PASS
,
751 r
->logon_to_chgpass
))
757 /****************************************************************
758 ****************************************************************/
760 static NTSTATUS
fetch_sam_entry(TALLOC_CTX
*mem_ctx
,
761 enum netr_SamDatabaseID database_id
,
762 struct netr_DELTA_ENUM
*r
,
763 struct samsync_context
*ctx
)
765 NTSTATUS status
= NT_STATUS_NOT_IMPLEMENTED
;
767 switch (r
->delta_type
) {
768 case NETR_DELTA_USER
:
769 status
= fetch_account_info(mem_ctx
,
770 r
->delta_id_union
.rid
,
771 r
->delta_union
.user
);
773 case NETR_DELTA_GROUP
:
774 status
= fetch_group_info(mem_ctx
,
775 r
->delta_id_union
.rid
,
776 r
->delta_union
.group
);
778 case NETR_DELTA_GROUP_MEMBER
:
779 status
= fetch_group_mem_info(mem_ctx
,
780 r
->delta_id_union
.rid
,
781 r
->delta_union
.group_member
);
783 case NETR_DELTA_ALIAS
:
784 status
= fetch_alias_info(mem_ctx
,
785 r
->delta_id_union
.rid
,
786 r
->delta_union
.alias
,
789 case NETR_DELTA_ALIAS_MEMBER
:
790 status
= fetch_alias_mem(mem_ctx
,
791 r
->delta_id_union
.rid
,
792 r
->delta_union
.alias_member
,
795 case NETR_DELTA_DOMAIN
:
796 status
= fetch_domain_info(mem_ctx
,
797 r
->delta_id_union
.rid
,
798 r
->delta_union
.domain
);
800 /* The following types are recognised but not handled */
801 case NETR_DELTA_RENAME_GROUP
:
802 d_printf("NETR_DELTA_RENAME_GROUP not handled\n");
804 case NETR_DELTA_RENAME_USER
:
805 d_printf("NETR_DELTA_RENAME_USER not handled\n");
807 case NETR_DELTA_RENAME_ALIAS
:
808 d_printf("NETR_DELTA_RENAME_ALIAS not handled\n");
810 case NETR_DELTA_POLICY
:
811 d_printf("NETR_DELTA_POLICY not handled\n");
813 case NETR_DELTA_TRUSTED_DOMAIN
:
814 d_printf("NETR_DELTA_TRUSTED_DOMAIN not handled\n");
816 case NETR_DELTA_ACCOUNT
:
817 d_printf("NETR_DELTA_ACCOUNT not handled\n");
819 case NETR_DELTA_SECRET
:
820 d_printf("NETR_DELTA_SECRET not handled\n");
822 case NETR_DELTA_DELETE_GROUP
:
823 d_printf("NETR_DELTA_DELETE_GROUP not handled\n");
825 case NETR_DELTA_DELETE_USER
:
826 d_printf("NETR_DELTA_DELETE_USER not handled\n");
828 case NETR_DELTA_MODIFY_COUNT
:
829 d_printf("NETR_DELTA_MODIFY_COUNT not handled\n");
831 case NETR_DELTA_DELETE_ALIAS
:
832 d_printf("NETR_DELTA_DELETE_ALIAS not handled\n");
834 case NETR_DELTA_DELETE_TRUST
:
835 d_printf("NETR_DELTA_DELETE_TRUST not handled\n");
837 case NETR_DELTA_DELETE_ACCOUNT
:
838 d_printf("NETR_DELTA_DELETE_ACCOUNT not handled\n");
840 case NETR_DELTA_DELETE_SECRET
:
841 d_printf("NETR_DELTA_DELETE_SECRET not handled\n");
843 case NETR_DELTA_DELETE_GROUP2
:
844 d_printf("NETR_DELTA_DELETE_GROUP2 not handled\n");
846 case NETR_DELTA_DELETE_USER2
:
847 d_printf("NETR_DELTA_DELETE_USER2 not handled\n");
850 d_printf("Unknown delta record type %d\n", r
->delta_type
);
851 status
= NT_STATUS_INVALID_PARAMETER
;
858 /****************************************************************
859 ****************************************************************/
861 static NTSTATUS
fetch_sam_entries(TALLOC_CTX
*mem_ctx
,
862 enum netr_SamDatabaseID database_id
,
863 struct netr_DELTA_ENUM_ARRAY
*r
,
864 uint64_t *sequence_num
,
865 struct samsync_context
*ctx
)
869 for (i
= 0; i
< r
->num_deltas
; i
++) {
870 fetch_sam_entry(mem_ctx
, database_id
, &r
->delta_enum
[i
], ctx
);
876 /****************************************************************
877 ****************************************************************/
879 const struct samsync_ops libnet_samsync_passdb_ops
= {
880 .process_objects
= fetch_sam_entries
,