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 "libnet/libnet_samsync.h"
28 #include "../libcli/security/security.h"
30 /* Convert a struct samu_DELTA to a struct samu. */
31 #define STRING_CHANGED (old_string && !new_string) ||\
32 (!old_string && new_string) ||\
33 (old_string && new_string && (strcmp(old_string, new_string) != 0))
35 #define STRING_CHANGED_NC(s1,s2) ((s1) && !(s2)) ||\
37 ((s1) && (s2) && (strcmp((s1), (s2)) != 0))
39 /****************************************************************
40 ****************************************************************/
42 static NTSTATUS
sam_account_from_delta(struct samu
*account
,
43 struct netr_DELTA_USER
*r
)
45 const char *old_string
, *new_string
;
46 time_t unix_time
, stored_time
;
49 memset(zero_buf
, '\0', sizeof(zero_buf
));
51 /* Username, fullname, home dir, dir drive, logon script, acct
52 desc, workstations, profile. */
54 if (r
->account_name
.string
) {
55 old_string
= pdb_get_nt_username(account
);
56 new_string
= r
->account_name
.string
;
59 pdb_set_nt_username(account
, new_string
, PDB_CHANGED
);
62 /* Unix username is the same - for sanity */
63 old_string
= pdb_get_username( account
);
65 pdb_set_username(account
, new_string
, PDB_CHANGED
);
69 if (r
->full_name
.string
) {
70 old_string
= pdb_get_fullname(account
);
71 new_string
= r
->full_name
.string
;
74 pdb_set_fullname(account
, new_string
, PDB_CHANGED
);
77 if (r
->home_directory
.string
) {
78 old_string
= pdb_get_homedir(account
);
79 new_string
= r
->home_directory
.string
;
82 pdb_set_homedir(account
, new_string
, PDB_CHANGED
);
85 if (r
->home_drive
.string
) {
86 old_string
= pdb_get_dir_drive(account
);
87 new_string
= r
->home_drive
.string
;
90 pdb_set_dir_drive(account
, new_string
, PDB_CHANGED
);
93 if (r
->logon_script
.string
) {
94 old_string
= pdb_get_logon_script(account
);
95 new_string
= r
->logon_script
.string
;
98 pdb_set_logon_script(account
, new_string
, PDB_CHANGED
);
101 if (r
->description
.string
) {
102 old_string
= pdb_get_acct_desc(account
);
103 new_string
= r
->description
.string
;
106 pdb_set_acct_desc(account
, new_string
, PDB_CHANGED
);
109 if (r
->workstations
.string
) {
110 old_string
= pdb_get_workstations(account
);
111 new_string
= r
->workstations
.string
;
114 pdb_set_workstations(account
, new_string
, PDB_CHANGED
);
117 if (r
->profile_path
.string
) {
118 old_string
= pdb_get_profile_path(account
);
119 new_string
= r
->profile_path
.string
;
122 pdb_set_profile_path(account
, new_string
, PDB_CHANGED
);
125 if (r
->parameters
.array
) {
128 old_string
= pdb_get_munged_dial(account
);
129 mung
.length
= r
->parameters
.length
* 2;
130 mung
.data
= (uint8_t *) r
->parameters
.array
;
131 newstr
= (mung
.length
== 0) ? NULL
:
132 base64_encode_data_blob(talloc_tos(), mung
);
134 if (STRING_CHANGED_NC(old_string
, newstr
))
135 pdb_set_munged_dial(account
, newstr
, PDB_CHANGED
);
139 /* User and group sid */
140 if (pdb_get_user_rid(account
) != r
->rid
)
141 pdb_set_user_sid_from_rid(account
, r
->rid
, PDB_CHANGED
);
142 if (pdb_get_group_rid(account
) != r
->primary_gid
)
143 pdb_set_group_sid_from_rid(account
, r
->primary_gid
, PDB_CHANGED
);
145 /* Logon and password information */
146 if (!nt_time_is_zero(&r
->last_logon
)) {
147 unix_time
= nt_time_to_unix(r
->last_logon
);
148 stored_time
= pdb_get_logon_time(account
);
149 if (stored_time
!= unix_time
)
150 pdb_set_logon_time(account
, unix_time
, PDB_CHANGED
);
153 if (!nt_time_is_zero(&r
->last_logoff
)) {
154 unix_time
= nt_time_to_unix(r
->last_logoff
);
155 stored_time
= pdb_get_logoff_time(account
);
156 if (stored_time
!= unix_time
)
157 pdb_set_logoff_time(account
, unix_time
,PDB_CHANGED
);
161 if (pdb_get_logon_divs(account
) != r
->logon_hours
.units_per_week
)
162 pdb_set_logon_divs(account
, r
->logon_hours
.units_per_week
, PDB_CHANGED
);
165 /* no idea what to do with this one - gd */
166 /* Max Logon Hours */
167 if (delta
->unknown1
!= pdb_get_unknown_6(account
)) {
168 pdb_set_unknown_6(account
, delta
->unknown1
, PDB_CHANGED
);
171 /* Logon Hours Len */
172 if (r
->logon_hours
.units_per_week
/8 != pdb_get_hours_len(account
)) {
173 pdb_set_hours_len(account
, r
->logon_hours
.units_per_week
/8, PDB_CHANGED
);
177 if (r
->logon_hours
.bits
) {
178 char oldstr
[44], newstr
[44];
179 pdb_sethexhours(oldstr
, pdb_get_hours(account
));
180 pdb_sethexhours(newstr
, r
->logon_hours
.bits
);
181 if (!strequal(oldstr
, newstr
))
182 pdb_set_hours(account
, r
->logon_hours
.bits
, PDB_CHANGED
);
185 if (pdb_get_bad_password_count(account
) != r
->bad_password_count
)
186 pdb_set_bad_password_count(account
, r
->bad_password_count
, PDB_CHANGED
);
188 if (pdb_get_logon_count(account
) != r
->logon_count
)
189 pdb_set_logon_count(account
, r
->logon_count
, PDB_CHANGED
);
191 if (!nt_time_is_zero(&r
->last_password_change
)) {
192 unix_time
= nt_time_to_unix(r
->last_password_change
);
193 stored_time
= pdb_get_pass_last_set_time(account
);
194 if (stored_time
!= unix_time
)
195 pdb_set_pass_last_set_time(account
, unix_time
, PDB_CHANGED
);
197 /* no last set time, make it now */
198 pdb_set_pass_last_set_time(account
, time(NULL
), PDB_CHANGED
);
201 if (!nt_time_is_zero(&r
->acct_expiry
)) {
202 unix_time
= nt_time_to_unix(r
->acct_expiry
);
203 stored_time
= pdb_get_kickoff_time(account
);
204 if (stored_time
!= unix_time
)
205 pdb_set_kickoff_time(account
, unix_time
, PDB_CHANGED
);
208 /* Decode hashes from password hash
209 Note that win2000 may send us all zeros for the hashes if it doesn't
210 think this channel is secure enough - don't set the passwords at all
213 if (memcmp(r
->lmpassword
.hash
, zero_buf
, 16) != 0) {
214 pdb_set_lanman_passwd(account
, r
->lmpassword
.hash
, PDB_CHANGED
);
217 if (memcmp(r
->ntpassword
.hash
, zero_buf
, 16) != 0) {
218 pdb_set_nt_passwd(account
, r
->ntpassword
.hash
, PDB_CHANGED
);
221 /* TODO: account expiry time */
223 pdb_set_acct_ctrl(account
, r
->acct_flags
, PDB_CHANGED
);
225 pdb_set_domain(account
, lp_workgroup(), PDB_CHANGED
);
231 /****************************************************************
232 ****************************************************************/
234 static NTSTATUS
smb_create_user(TALLOC_CTX
*mem_ctx
,
237 struct passwd
**passwd_p
)
239 struct passwd
*passwd
;
240 char *add_script
= NULL
;
242 passwd
= Get_Pwnam_alloc(mem_ctx
, account
);
248 /* Create appropriate user */
249 if (acct_flags
& ACB_NORMAL
) {
250 add_script
= talloc_strdup(mem_ctx
, lp_adduser_script());
251 } else if ( (acct_flags
& ACB_WSTRUST
) ||
252 (acct_flags
& ACB_SVRTRUST
) ||
253 (acct_flags
& ACB_DOMTRUST
) ) {
254 add_script
= talloc_strdup(mem_ctx
, lp_addmachine_script());
256 DEBUG(1, ("Unknown user type: %s\n",
257 pdb_encode_acct_ctrl(acct_flags
, NEW_PW_FORMAT_SPACE_PADDED_LEN
)));
258 return NT_STATUS_UNSUCCESSFUL
;
262 return NT_STATUS_NO_MEMORY
;
267 add_script
= talloc_all_string_sub(mem_ctx
, add_script
,
270 return NT_STATUS_NO_MEMORY
;
272 add_ret
= smbrun(add_script
, NULL
);
273 DEBUG(add_ret
? 0 : 1,("fetch_account: Running the command `%s' "
274 "gave %d\n", add_script
, add_ret
));
276 smb_nscd_flush_user_cache();
280 /* try and find the possible unix account again */
281 passwd
= Get_Pwnam_alloc(mem_ctx
, account
);
283 return NT_STATUS_NO_SUCH_USER
;
290 /****************************************************************
291 ****************************************************************/
293 static NTSTATUS
fetch_account_info(TALLOC_CTX
*mem_ctx
,
295 struct netr_DELTA_USER
*r
)
298 NTSTATUS nt_ret
= NT_STATUS_UNSUCCESSFUL
;
300 struct samu
*sam_account
=NULL
;
303 struct dom_sid user_sid
;
304 struct dom_sid group_sid
;
305 struct passwd
*passwd
= NULL
;
308 fstrcpy(account
, r
->account_name
.string
);
309 d_printf("Creating account: %s\n", account
);
311 if ( !(sam_account
= samu_new(mem_ctx
)) ) {
312 return NT_STATUS_NO_MEMORY
;
315 nt_ret
= smb_create_user(sam_account
, r
->acct_flags
, account
, &passwd
);
316 if (!NT_STATUS_IS_OK(nt_ret
)) {
317 d_fprintf(stderr
, "Could not create posix account info for '%s'\n",
322 sid_compose(&user_sid
, get_global_sam_sid(), r
->rid
);
324 DEBUG(3, ("Attempting to find SID %s for user %s in the passdb\n",
325 sid_to_fstring(sid_string
, &user_sid
), account
));
326 if (!pdb_getsampwsid(sam_account
, &user_sid
)) {
327 sam_account_from_delta(sam_account
, r
);
328 DEBUG(3, ("Attempting to add user SID %s for user %s in the passdb\n",
329 sid_to_fstring(sid_string
, &user_sid
),
330 pdb_get_username(sam_account
)));
331 if (!NT_STATUS_IS_OK(pdb_add_sam_account(sam_account
))) {
332 DEBUG(1, ("SAM Account for %s failed to be added to the passdb!\n",
334 return NT_STATUS_ACCESS_DENIED
;
337 sam_account_from_delta(sam_account
, r
);
338 DEBUG(3, ("Attempting to update user SID %s for user %s in the passdb\n",
339 sid_to_fstring(sid_string
, &user_sid
),
340 pdb_get_username(sam_account
)));
341 if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_account
))) {
342 DEBUG(1, ("SAM Account for %s failed to be updated in the passdb!\n",
344 TALLOC_FREE(sam_account
);
345 return NT_STATUS_ACCESS_DENIED
;
349 if (pdb_get_group_sid(sam_account
) == NULL
) {
350 return NT_STATUS_UNSUCCESSFUL
;
353 group_sid
= *pdb_get_group_sid(sam_account
);
355 if (!pdb_getgrsid(&map
, group_sid
)) {
356 DEBUG(0, ("Primary group of %s has no mapping!\n",
357 pdb_get_username(sam_account
)));
359 if (map
.gid
!= passwd
->pw_gid
) {
360 if (!(grp
= getgrgid(map
.gid
))) {
361 DEBUG(0, ("Could not find unix group %lu for user %s (group SID=%s)\n",
362 (unsigned long)map
.gid
, pdb_get_username(sam_account
), sid_string_tos(&group_sid
)));
364 smb_set_primary_group(grp
->gr_name
, pdb_get_username(sam_account
));
370 DEBUG(1, ("No unix user for this account (%s), cannot adjust mappings\n",
371 pdb_get_username(sam_account
)));
375 TALLOC_FREE(sam_account
);
379 /****************************************************************
380 ****************************************************************/
382 static NTSTATUS
fetch_group_info(TALLOC_CTX
*mem_ctx
,
384 struct netr_DELTA_GROUP
*r
)
388 struct group
*grp
= NULL
;
389 struct dom_sid group_sid
;
394 fstrcpy(name
, r
->group_name
.string
);
395 fstrcpy(comment
, r
->description
.string
);
397 /* add the group to the mapping table */
398 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
399 sid_to_fstring(sid_string
, &group_sid
);
401 if (pdb_getgrsid(&map
, group_sid
)) {
403 grp
= getgrgid(map
.gid
);
410 /* No group found from mapping, find it from its name. */
411 if ((grp
= getgrnam(name
)) == NULL
) {
413 /* No appropriate group found, create one */
415 d_printf("Creating unix group: '%s'\n", name
);
417 if (smb_create_group(name
, &gid
) != 0)
418 return NT_STATUS_ACCESS_DENIED
;
420 if ((grp
= getgrnam(name
)) == NULL
)
421 return NT_STATUS_ACCESS_DENIED
;
425 map
.gid
= grp
->gr_gid
;
427 map
.sid_name_use
= SID_NAME_DOM_GRP
;
428 fstrcpy(map
.nt_name
, name
);
429 if (r
->description
.string
) {
430 fstrcpy(map
.comment
, comment
);
432 fstrcpy(map
.comment
, "");
436 pdb_add_group_mapping_entry(&map
);
438 pdb_update_group_mapping_entry(&map
);
443 /****************************************************************
444 ****************************************************************/
446 static NTSTATUS
fetch_group_mem_info(TALLOC_CTX
*mem_ctx
,
448 struct netr_DELTA_GROUP_MEMBER
*r
)
451 char **nt_members
= NULL
;
453 struct dom_sid group_sid
;
457 if (r
->num_rids
== 0) {
461 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
463 if (!get_domain_group_from_sid(group_sid
, &map
)) {
464 DEBUG(0, ("Could not find global group %d\n", rid
));
465 return NT_STATUS_NO_SUCH_GROUP
;
468 if (!(grp
= getgrgid(map
.gid
))) {
469 DEBUG(0, ("Could not find unix group %lu\n", (unsigned long)map
.gid
));
470 return NT_STATUS_NO_SUCH_GROUP
;
473 d_printf("Group members of %s: ", grp
->gr_name
);
476 if ((nt_members
= TALLOC_ZERO_ARRAY(mem_ctx
, char *, r
->num_rids
)) == NULL
) {
477 DEBUG(0, ("talloc failed\n"));
478 return NT_STATUS_NO_MEMORY
;
484 for (i
=0; i
< r
->num_rids
; i
++) {
485 struct samu
*member
= NULL
;
486 struct dom_sid member_sid
;
488 if ( !(member
= samu_new(mem_ctx
)) ) {
489 return NT_STATUS_NO_MEMORY
;
492 sid_compose(&member_sid
, get_global_sam_sid(), r
->rids
[i
]);
494 if (!pdb_getsampwsid(member
, &member_sid
)) {
495 DEBUG(1, ("Found bogus group member: %d (member_sid=%s group=%s)\n",
496 r
->rids
[i
], sid_string_tos(&member_sid
), grp
->gr_name
));
501 if (pdb_get_group_rid(member
) == rid
) {
502 d_printf("%s(primary),", pdb_get_username(member
));
507 d_printf("%s,", pdb_get_username(member
));
508 nt_members
[i
] = talloc_strdup(mem_ctx
, pdb_get_username(member
));
514 unix_members
= grp
->gr_mem
;
516 while (*unix_members
) {
517 bool is_nt_member
= false;
518 for (i
=0; i
< r
->num_rids
; i
++) {
519 if (nt_members
[i
] == NULL
) {
520 /* This was a primary group */
524 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
530 /* We look at a unix group member that is not
531 an nt group member. So, remove it. NT is
533 smb_delete_user_group(grp
->gr_name
, *unix_members
);
538 for (i
=0; i
< r
->num_rids
; i
++) {
539 bool is_unix_member
= false;
541 if (nt_members
[i
] == NULL
) {
542 /* This was the primary group */
546 unix_members
= grp
->gr_mem
;
548 while (*unix_members
) {
549 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
550 is_unix_member
= true;
556 if (!is_unix_member
) {
557 /* We look at a nt group member that is not a
558 unix group member currently. So, add the nt
560 smb_add_user_group(grp
->gr_name
, nt_members
[i
]);
567 /****************************************************************
568 ****************************************************************/
570 static NTSTATUS
fetch_alias_info(TALLOC_CTX
*mem_ctx
,
572 struct netr_DELTA_ALIAS
*r
,
573 const struct dom_sid
*dom_sid
)
577 struct group
*grp
= NULL
;
578 struct dom_sid alias_sid
;
583 fstrcpy(name
, r
->alias_name
.string
);
584 fstrcpy(comment
, r
->description
.string
);
586 /* Find out whether the group is already mapped */
587 sid_compose(&alias_sid
, dom_sid
, rid
);
588 sid_to_fstring(sid_string
, &alias_sid
);
590 if (pdb_getgrsid(&map
, alias_sid
)) {
591 grp
= getgrgid(map
.gid
);
598 /* No group found from mapping, find it from its name. */
599 if ((grp
= getgrnam(name
)) == NULL
) {
600 /* No appropriate group found, create one */
601 d_printf("Creating unix group: '%s'\n", name
);
602 if (smb_create_group(name
, &gid
) != 0)
603 return NT_STATUS_ACCESS_DENIED
;
604 if ((grp
= getgrgid(gid
)) == NULL
)
605 return NT_STATUS_ACCESS_DENIED
;
609 map
.gid
= grp
->gr_gid
;
612 if (dom_sid_equal(dom_sid
, &global_sid_Builtin
))
613 map
.sid_name_use
= SID_NAME_WKN_GRP
;
615 map
.sid_name_use
= SID_NAME_ALIAS
;
617 fstrcpy(map
.nt_name
, name
);
618 fstrcpy(map
.comment
, comment
);
621 pdb_add_group_mapping_entry(&map
);
623 pdb_update_group_mapping_entry(&map
);
628 /****************************************************************
629 ****************************************************************/
631 static NTSTATUS
fetch_alias_mem(TALLOC_CTX
*mem_ctx
,
633 struct netr_DELTA_ALIAS_MEMBER
*r
,
634 const struct dom_sid
*dom_sid
)
639 /****************************************************************
640 ****************************************************************/
642 static NTSTATUS
fetch_domain_info(TALLOC_CTX
*mem_ctx
,
644 struct netr_DELTA_DOMAIN
*r
)
646 time_t u_max_age
, u_min_age
, u_logout
;
647 NTSTATUS nt_status
= NT_STATUS_UNSUCCESSFUL
;
649 struct netr_AcctLockStr
*lockstr
= NULL
;
652 status
= pull_netr_AcctLockStr(mem_ctx
, &r
->account_lockout
,
654 if (!NT_STATUS_IS_OK(status
)) {
655 d_printf("failed to pull account lockout string: %s\n",
659 u_max_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->max_password_age
);
660 u_min_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->min_password_age
);
661 u_logout
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->force_logoff_time
);
663 domname
= r
->domain_name
.string
;
665 return NT_STATUS_NO_MEMORY
;
668 /* we don't handle BUILTIN account policies */
669 if (!strequal(domname
, get_global_sam_name())) {
670 printf("skipping SAM_DOMAIN_INFO delta for '%s' (is not my domain)\n", domname
);
675 if (!pdb_set_account_policy(PDB_POLICY_PASSWORD_HISTORY
,
676 r
->password_history_length
))
679 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_LEN
,
680 r
->min_password_length
))
683 if (!pdb_set_account_policy(PDB_POLICY_MAX_PASSWORD_AGE
,
687 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_AGE
,
691 if (!pdb_set_account_policy(PDB_POLICY_TIME_TO_LOGOUT
,
696 time_t u_lockoutreset
, u_lockouttime
;
698 u_lockoutreset
= uint64s_nt_time_to_unix_abs(&lockstr
->reset_count
);
699 u_lockouttime
= uint64s_nt_time_to_unix_abs((uint64_t *)&lockstr
->lockout_duration
);
701 if (!pdb_set_account_policy(PDB_POLICY_BAD_ATTEMPT_LOCKOUT
,
702 lockstr
->bad_attempt_lockout
))
705 if (!pdb_set_account_policy(PDB_POLICY_RESET_COUNT_TIME
,
706 (uint32_t)u_lockoutreset
/60))
709 if (u_lockouttime
!= -1)
712 if (!pdb_set_account_policy(PDB_POLICY_LOCK_ACCOUNT_DURATION
,
713 (uint32_t)u_lockouttime
))
717 if (!pdb_set_account_policy(PDB_POLICY_USER_MUST_LOGON_TO_CHG_PASS
,
718 r
->logon_to_chgpass
))
724 /****************************************************************
725 ****************************************************************/
727 static NTSTATUS
fetch_sam_entry(TALLOC_CTX
*mem_ctx
,
728 enum netr_SamDatabaseID database_id
,
729 struct netr_DELTA_ENUM
*r
,
730 struct samsync_context
*ctx
)
732 NTSTATUS status
= NT_STATUS_NOT_IMPLEMENTED
;
734 switch (r
->delta_type
) {
735 case NETR_DELTA_USER
:
736 status
= fetch_account_info(mem_ctx
,
737 r
->delta_id_union
.rid
,
738 r
->delta_union
.user
);
740 case NETR_DELTA_GROUP
:
741 status
= fetch_group_info(mem_ctx
,
742 r
->delta_id_union
.rid
,
743 r
->delta_union
.group
);
745 case NETR_DELTA_GROUP_MEMBER
:
746 status
= fetch_group_mem_info(mem_ctx
,
747 r
->delta_id_union
.rid
,
748 r
->delta_union
.group_member
);
750 case NETR_DELTA_ALIAS
:
751 status
= fetch_alias_info(mem_ctx
,
752 r
->delta_id_union
.rid
,
753 r
->delta_union
.alias
,
756 case NETR_DELTA_ALIAS_MEMBER
:
757 status
= fetch_alias_mem(mem_ctx
,
758 r
->delta_id_union
.rid
,
759 r
->delta_union
.alias_member
,
762 case NETR_DELTA_DOMAIN
:
763 status
= fetch_domain_info(mem_ctx
,
764 r
->delta_id_union
.rid
,
765 r
->delta_union
.domain
);
767 /* The following types are recognised but not handled */
768 case NETR_DELTA_RENAME_GROUP
:
769 d_printf("NETR_DELTA_RENAME_GROUP not handled\n");
771 case NETR_DELTA_RENAME_USER
:
772 d_printf("NETR_DELTA_RENAME_USER not handled\n");
774 case NETR_DELTA_RENAME_ALIAS
:
775 d_printf("NETR_DELTA_RENAME_ALIAS not handled\n");
777 case NETR_DELTA_POLICY
:
778 d_printf("NETR_DELTA_POLICY not handled\n");
780 case NETR_DELTA_TRUSTED_DOMAIN
:
781 d_printf("NETR_DELTA_TRUSTED_DOMAIN not handled\n");
783 case NETR_DELTA_ACCOUNT
:
784 d_printf("NETR_DELTA_ACCOUNT not handled\n");
786 case NETR_DELTA_SECRET
:
787 d_printf("NETR_DELTA_SECRET not handled\n");
789 case NETR_DELTA_DELETE_GROUP
:
790 d_printf("NETR_DELTA_DELETE_GROUP not handled\n");
792 case NETR_DELTA_DELETE_USER
:
793 d_printf("NETR_DELTA_DELETE_USER not handled\n");
795 case NETR_DELTA_MODIFY_COUNT
:
796 d_printf("NETR_DELTA_MODIFY_COUNT not handled\n");
798 case NETR_DELTA_DELETE_ALIAS
:
799 d_printf("NETR_DELTA_DELETE_ALIAS not handled\n");
801 case NETR_DELTA_DELETE_TRUST
:
802 d_printf("NETR_DELTA_DELETE_TRUST not handled\n");
804 case NETR_DELTA_DELETE_ACCOUNT
:
805 d_printf("NETR_DELTA_DELETE_ACCOUNT not handled\n");
807 case NETR_DELTA_DELETE_SECRET
:
808 d_printf("NETR_DELTA_DELETE_SECRET not handled\n");
810 case NETR_DELTA_DELETE_GROUP2
:
811 d_printf("NETR_DELTA_DELETE_GROUP2 not handled\n");
813 case NETR_DELTA_DELETE_USER2
:
814 d_printf("NETR_DELTA_DELETE_USER2 not handled\n");
817 d_printf("Unknown delta record type %d\n", r
->delta_type
);
818 status
= NT_STATUS_INVALID_PARAMETER
;
825 /****************************************************************
826 ****************************************************************/
828 static NTSTATUS
fetch_sam_entries(TALLOC_CTX
*mem_ctx
,
829 enum netr_SamDatabaseID database_id
,
830 struct netr_DELTA_ENUM_ARRAY
*r
,
831 uint64_t *sequence_num
,
832 struct samsync_context
*ctx
)
836 for (i
= 0; i
< r
->num_deltas
; i
++) {
837 fetch_sam_entry(mem_ctx
, database_id
, &r
->delta_enum
[i
], ctx
);
843 /****************************************************************
844 ****************************************************************/
846 const struct samsync_ops libnet_samsync_passdb_ops
= {
847 .process_objects
= fetch_sam_entries
,