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
;
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 if (!pdb_getgrsid(&map
, group_sid
)) {
359 DEBUG(0, ("Primary group of %s has no mapping!\n",
360 pdb_get_username(sam_account
)));
362 if (map
.gid
!= passwd
->pw_gid
) {
363 if (!(grp
= getgrgid(map
.gid
))) {
364 DEBUG(0, ("Could not find unix group %lu for user %s (group SID=%s)\n",
365 (unsigned long)map
.gid
, pdb_get_username(sam_account
), sid_string_tos(&group_sid
)));
367 smb_set_primary_group(grp
->gr_name
, pdb_get_username(sam_account
));
373 DEBUG(1, ("No unix user for this account (%s), cannot adjust mappings\n",
374 pdb_get_username(sam_account
)));
378 TALLOC_FREE(sam_account
);
382 /****************************************************************
383 ****************************************************************/
385 static NTSTATUS
fetch_group_info(TALLOC_CTX
*mem_ctx
,
387 struct netr_DELTA_GROUP
*r
)
391 struct group
*grp
= NULL
;
392 struct dom_sid group_sid
;
397 fstrcpy(name
, r
->group_name
.string
);
398 fstrcpy(comment
, r
->description
.string
);
400 /* add the group to the mapping table */
401 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
402 sid_to_fstring(sid_string
, &group_sid
);
404 if (pdb_getgrsid(&map
, group_sid
)) {
406 grp
= getgrgid(map
.gid
);
413 /* No group found from mapping, find it from its name. */
414 if ((grp
= getgrnam(name
)) == NULL
) {
416 /* No appropriate group found, create one */
418 d_printf("Creating unix group: '%s'\n", name
);
420 if (smb_create_group(name
, &gid
) != 0)
421 return NT_STATUS_ACCESS_DENIED
;
423 if ((grp
= getgrnam(name
)) == NULL
)
424 return NT_STATUS_ACCESS_DENIED
;
428 map
.gid
= grp
->gr_gid
;
430 map
.sid_name_use
= SID_NAME_DOM_GRP
;
431 fstrcpy(map
.nt_name
, name
);
432 if (r
->description
.string
) {
433 fstrcpy(map
.comment
, comment
);
435 fstrcpy(map
.comment
, "");
439 pdb_add_group_mapping_entry(&map
);
441 pdb_update_group_mapping_entry(&map
);
446 /****************************************************************
447 ****************************************************************/
449 static NTSTATUS
fetch_group_mem_info(TALLOC_CTX
*mem_ctx
,
451 struct netr_DELTA_GROUP_MEMBER
*r
)
454 char **nt_members
= NULL
;
456 struct dom_sid group_sid
;
460 if (r
->num_rids
== 0) {
464 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
466 if (!get_domain_group_from_sid(group_sid
, &map
)) {
467 DEBUG(0, ("Could not find global group %d\n", rid
));
468 return NT_STATUS_NO_SUCH_GROUP
;
471 if (!(grp
= getgrgid(map
.gid
))) {
472 DEBUG(0, ("Could not find unix group %lu\n", (unsigned long)map
.gid
));
473 return NT_STATUS_NO_SUCH_GROUP
;
476 d_printf("Group members of %s: ", grp
->gr_name
);
479 if ((nt_members
= TALLOC_ZERO_ARRAY(mem_ctx
, char *, r
->num_rids
)) == NULL
) {
480 DEBUG(0, ("talloc failed\n"));
481 return NT_STATUS_NO_MEMORY
;
487 for (i
=0; i
< r
->num_rids
; i
++) {
488 struct samu
*member
= NULL
;
489 struct dom_sid member_sid
;
491 if ( !(member
= samu_new(mem_ctx
)) ) {
492 return NT_STATUS_NO_MEMORY
;
495 sid_compose(&member_sid
, get_global_sam_sid(), r
->rids
[i
]);
497 if (!pdb_getsampwsid(member
, &member_sid
)) {
498 DEBUG(1, ("Found bogus group member: %d (member_sid=%s group=%s)\n",
499 r
->rids
[i
], sid_string_tos(&member_sid
), grp
->gr_name
));
504 if (pdb_get_group_rid(member
) == rid
) {
505 d_printf("%s(primary),", pdb_get_username(member
));
510 d_printf("%s,", pdb_get_username(member
));
511 nt_members
[i
] = talloc_strdup(mem_ctx
, pdb_get_username(member
));
517 unix_members
= grp
->gr_mem
;
519 while (*unix_members
) {
520 bool is_nt_member
= false;
521 for (i
=0; i
< r
->num_rids
; i
++) {
522 if (nt_members
[i
] == NULL
) {
523 /* This was a primary group */
527 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
533 /* We look at a unix group member that is not
534 an nt group member. So, remove it. NT is
536 smb_delete_user_group(grp
->gr_name
, *unix_members
);
541 for (i
=0; i
< r
->num_rids
; i
++) {
542 bool is_unix_member
= false;
544 if (nt_members
[i
] == NULL
) {
545 /* This was the primary group */
549 unix_members
= grp
->gr_mem
;
551 while (*unix_members
) {
552 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
553 is_unix_member
= true;
559 if (!is_unix_member
) {
560 /* We look at a nt group member that is not a
561 unix group member currently. So, add the nt
563 smb_add_user_group(grp
->gr_name
, nt_members
[i
]);
570 /****************************************************************
571 ****************************************************************/
573 static NTSTATUS
fetch_alias_info(TALLOC_CTX
*mem_ctx
,
575 struct netr_DELTA_ALIAS
*r
,
576 const struct dom_sid
*dom_sid
)
580 struct group
*grp
= NULL
;
581 struct dom_sid alias_sid
;
586 fstrcpy(name
, r
->alias_name
.string
);
587 fstrcpy(comment
, r
->description
.string
);
589 /* Find out whether the group is already mapped */
590 sid_compose(&alias_sid
, dom_sid
, rid
);
591 sid_to_fstring(sid_string
, &alias_sid
);
593 if (pdb_getgrsid(&map
, alias_sid
)) {
594 grp
= getgrgid(map
.gid
);
601 /* No group found from mapping, find it from its name. */
602 if ((grp
= getgrnam(name
)) == NULL
) {
603 /* No appropriate group found, create one */
604 d_printf("Creating unix group: '%s'\n", name
);
605 if (smb_create_group(name
, &gid
) != 0)
606 return NT_STATUS_ACCESS_DENIED
;
607 if ((grp
= getgrgid(gid
)) == NULL
)
608 return NT_STATUS_ACCESS_DENIED
;
612 map
.gid
= grp
->gr_gid
;
615 if (dom_sid_equal(dom_sid
, &global_sid_Builtin
))
616 map
.sid_name_use
= SID_NAME_WKN_GRP
;
618 map
.sid_name_use
= SID_NAME_ALIAS
;
620 fstrcpy(map
.nt_name
, name
);
621 fstrcpy(map
.comment
, comment
);
624 pdb_add_group_mapping_entry(&map
);
626 pdb_update_group_mapping_entry(&map
);
631 /****************************************************************
632 ****************************************************************/
634 static NTSTATUS
fetch_alias_mem(TALLOC_CTX
*mem_ctx
,
636 struct netr_DELTA_ALIAS_MEMBER
*r
,
637 const struct dom_sid
*dom_sid
)
642 /****************************************************************
643 ****************************************************************/
645 static NTSTATUS
fetch_domain_info(TALLOC_CTX
*mem_ctx
,
647 struct netr_DELTA_DOMAIN
*r
)
649 time_t u_max_age
, u_min_age
, u_logout
;
650 NTSTATUS nt_status
= NT_STATUS_UNSUCCESSFUL
;
652 struct netr_AcctLockStr
*lockstr
= NULL
;
655 status
= pull_netr_AcctLockStr(mem_ctx
, &r
->account_lockout
,
657 if (!NT_STATUS_IS_OK(status
)) {
658 d_printf("failed to pull account lockout string: %s\n",
662 u_max_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->max_password_age
);
663 u_min_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->min_password_age
);
664 u_logout
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->force_logoff_time
);
666 domname
= r
->domain_name
.string
;
668 return NT_STATUS_NO_MEMORY
;
671 /* we don't handle BUILTIN account policies */
672 if (!strequal(domname
, get_global_sam_name())) {
673 printf("skipping SAM_DOMAIN_INFO delta for '%s' (is not my domain)\n", domname
);
678 if (!pdb_set_account_policy(PDB_POLICY_PASSWORD_HISTORY
,
679 r
->password_history_length
))
682 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_LEN
,
683 r
->min_password_length
))
686 if (!pdb_set_account_policy(PDB_POLICY_MAX_PASSWORD_AGE
,
690 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_AGE
,
694 if (!pdb_set_account_policy(PDB_POLICY_TIME_TO_LOGOUT
,
699 time_t u_lockoutreset
, u_lockouttime
;
701 u_lockoutreset
= uint64s_nt_time_to_unix_abs(&lockstr
->reset_count
);
702 u_lockouttime
= uint64s_nt_time_to_unix_abs((uint64_t *)&lockstr
->lockout_duration
);
704 if (!pdb_set_account_policy(PDB_POLICY_BAD_ATTEMPT_LOCKOUT
,
705 lockstr
->bad_attempt_lockout
))
708 if (!pdb_set_account_policy(PDB_POLICY_RESET_COUNT_TIME
,
709 (uint32_t)u_lockoutreset
/60))
712 if (u_lockouttime
!= -1)
715 if (!pdb_set_account_policy(PDB_POLICY_LOCK_ACCOUNT_DURATION
,
716 (uint32_t)u_lockouttime
))
720 if (!pdb_set_account_policy(PDB_POLICY_USER_MUST_LOGON_TO_CHG_PASS
,
721 r
->logon_to_chgpass
))
727 /****************************************************************
728 ****************************************************************/
730 static NTSTATUS
fetch_sam_entry(TALLOC_CTX
*mem_ctx
,
731 enum netr_SamDatabaseID database_id
,
732 struct netr_DELTA_ENUM
*r
,
733 struct samsync_context
*ctx
)
735 NTSTATUS status
= NT_STATUS_NOT_IMPLEMENTED
;
737 switch (r
->delta_type
) {
738 case NETR_DELTA_USER
:
739 status
= fetch_account_info(mem_ctx
,
740 r
->delta_id_union
.rid
,
741 r
->delta_union
.user
);
743 case NETR_DELTA_GROUP
:
744 status
= fetch_group_info(mem_ctx
,
745 r
->delta_id_union
.rid
,
746 r
->delta_union
.group
);
748 case NETR_DELTA_GROUP_MEMBER
:
749 status
= fetch_group_mem_info(mem_ctx
,
750 r
->delta_id_union
.rid
,
751 r
->delta_union
.group_member
);
753 case NETR_DELTA_ALIAS
:
754 status
= fetch_alias_info(mem_ctx
,
755 r
->delta_id_union
.rid
,
756 r
->delta_union
.alias
,
759 case NETR_DELTA_ALIAS_MEMBER
:
760 status
= fetch_alias_mem(mem_ctx
,
761 r
->delta_id_union
.rid
,
762 r
->delta_union
.alias_member
,
765 case NETR_DELTA_DOMAIN
:
766 status
= fetch_domain_info(mem_ctx
,
767 r
->delta_id_union
.rid
,
768 r
->delta_union
.domain
);
770 /* The following types are recognised but not handled */
771 case NETR_DELTA_RENAME_GROUP
:
772 d_printf("NETR_DELTA_RENAME_GROUP not handled\n");
774 case NETR_DELTA_RENAME_USER
:
775 d_printf("NETR_DELTA_RENAME_USER not handled\n");
777 case NETR_DELTA_RENAME_ALIAS
:
778 d_printf("NETR_DELTA_RENAME_ALIAS not handled\n");
780 case NETR_DELTA_POLICY
:
781 d_printf("NETR_DELTA_POLICY not handled\n");
783 case NETR_DELTA_TRUSTED_DOMAIN
:
784 d_printf("NETR_DELTA_TRUSTED_DOMAIN not handled\n");
786 case NETR_DELTA_ACCOUNT
:
787 d_printf("NETR_DELTA_ACCOUNT not handled\n");
789 case NETR_DELTA_SECRET
:
790 d_printf("NETR_DELTA_SECRET not handled\n");
792 case NETR_DELTA_DELETE_GROUP
:
793 d_printf("NETR_DELTA_DELETE_GROUP not handled\n");
795 case NETR_DELTA_DELETE_USER
:
796 d_printf("NETR_DELTA_DELETE_USER not handled\n");
798 case NETR_DELTA_MODIFY_COUNT
:
799 d_printf("NETR_DELTA_MODIFY_COUNT not handled\n");
801 case NETR_DELTA_DELETE_ALIAS
:
802 d_printf("NETR_DELTA_DELETE_ALIAS not handled\n");
804 case NETR_DELTA_DELETE_TRUST
:
805 d_printf("NETR_DELTA_DELETE_TRUST not handled\n");
807 case NETR_DELTA_DELETE_ACCOUNT
:
808 d_printf("NETR_DELTA_DELETE_ACCOUNT not handled\n");
810 case NETR_DELTA_DELETE_SECRET
:
811 d_printf("NETR_DELTA_DELETE_SECRET not handled\n");
813 case NETR_DELTA_DELETE_GROUP2
:
814 d_printf("NETR_DELTA_DELETE_GROUP2 not handled\n");
816 case NETR_DELTA_DELETE_USER2
:
817 d_printf("NETR_DELTA_DELETE_USER2 not handled\n");
820 d_printf("Unknown delta record type %d\n", r
->delta_type
);
821 status
= NT_STATUS_INVALID_PARAMETER
;
828 /****************************************************************
829 ****************************************************************/
831 static NTSTATUS
fetch_sam_entries(TALLOC_CTX
*mem_ctx
,
832 enum netr_SamDatabaseID database_id
,
833 struct netr_DELTA_ENUM_ARRAY
*r
,
834 uint64_t *sequence_num
,
835 struct samsync_context
*ctx
)
839 for (i
= 0; i
< r
->num_deltas
; i
++) {
840 fetch_sam_entry(mem_ctx
, database_id
, &r
->delta_enum
[i
], ctx
);
846 /****************************************************************
847 ****************************************************************/
849 const struct samsync_ops libnet_samsync_passdb_ops
= {
850 .process_objects
= fetch_sam_entries
,