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"
29 /* Convert a struct samu_DELTA to a struct samu. */
30 #define STRING_CHANGED (old_string && !new_string) ||\
31 (!old_string && new_string) ||\
32 (old_string && new_string && (strcmp(old_string, new_string) != 0))
34 #define STRING_CHANGED_NC(s1,s2) ((s1) && !(s2)) ||\
36 ((s1) && (s2) && (strcmp((s1), (s2)) != 0))
38 /****************************************************************
39 ****************************************************************/
41 static NTSTATUS
sam_account_from_delta(struct samu
*account
,
42 struct netr_DELTA_USER
*r
)
44 const char *old_string
, *new_string
;
45 time_t unix_time
, stored_time
;
48 memset(zero_buf
, '\0', sizeof(zero_buf
));
50 /* Username, fullname, home dir, dir drive, logon script, acct
51 desc, workstations, profile. */
53 if (r
->account_name
.string
) {
54 old_string
= pdb_get_nt_username(account
);
55 new_string
= r
->account_name
.string
;
58 pdb_set_nt_username(account
, new_string
, PDB_CHANGED
);
61 /* Unix username is the same - for sanity */
62 old_string
= pdb_get_username( account
);
64 pdb_set_username(account
, new_string
, PDB_CHANGED
);
68 if (r
->full_name
.string
) {
69 old_string
= pdb_get_fullname(account
);
70 new_string
= r
->full_name
.string
;
73 pdb_set_fullname(account
, new_string
, PDB_CHANGED
);
76 if (r
->home_directory
.string
) {
77 old_string
= pdb_get_homedir(account
);
78 new_string
= r
->home_directory
.string
;
81 pdb_set_homedir(account
, new_string
, PDB_CHANGED
);
84 if (r
->home_drive
.string
) {
85 old_string
= pdb_get_dir_drive(account
);
86 new_string
= r
->home_drive
.string
;
89 pdb_set_dir_drive(account
, new_string
, PDB_CHANGED
);
92 if (r
->logon_script
.string
) {
93 old_string
= pdb_get_logon_script(account
);
94 new_string
= r
->logon_script
.string
;
97 pdb_set_logon_script(account
, new_string
, PDB_CHANGED
);
100 if (r
->description
.string
) {
101 old_string
= pdb_get_acct_desc(account
);
102 new_string
= r
->description
.string
;
105 pdb_set_acct_desc(account
, new_string
, PDB_CHANGED
);
108 if (r
->workstations
.string
) {
109 old_string
= pdb_get_workstations(account
);
110 new_string
= r
->workstations
.string
;
113 pdb_set_workstations(account
, new_string
, PDB_CHANGED
);
116 if (r
->profile_path
.string
) {
117 old_string
= pdb_get_profile_path(account
);
118 new_string
= r
->profile_path
.string
;
121 pdb_set_profile_path(account
, new_string
, PDB_CHANGED
);
124 if (r
->parameters
.array
) {
127 old_string
= pdb_get_munged_dial(account
);
128 mung
.length
= r
->parameters
.length
* 2;
129 mung
.data
= (uint8_t *) r
->parameters
.array
;
130 newstr
= (mung
.length
== 0) ? NULL
:
131 base64_encode_data_blob(talloc_tos(), mung
);
133 if (STRING_CHANGED_NC(old_string
, newstr
))
134 pdb_set_munged_dial(account
, newstr
, PDB_CHANGED
);
138 /* User and group sid */
139 if (pdb_get_user_rid(account
) != r
->rid
)
140 pdb_set_user_sid_from_rid(account
, r
->rid
, PDB_CHANGED
);
141 if (pdb_get_group_rid(account
) != r
->primary_gid
)
142 pdb_set_group_sid_from_rid(account
, r
->primary_gid
, PDB_CHANGED
);
144 /* Logon and password information */
145 if (!nt_time_is_zero(&r
->last_logon
)) {
146 unix_time
= nt_time_to_unix(r
->last_logon
);
147 stored_time
= pdb_get_logon_time(account
);
148 if (stored_time
!= unix_time
)
149 pdb_set_logon_time(account
, unix_time
, PDB_CHANGED
);
152 if (!nt_time_is_zero(&r
->last_logoff
)) {
153 unix_time
= nt_time_to_unix(r
->last_logoff
);
154 stored_time
= pdb_get_logoff_time(account
);
155 if (stored_time
!= unix_time
)
156 pdb_set_logoff_time(account
, unix_time
,PDB_CHANGED
);
160 if (pdb_get_logon_divs(account
) != r
->logon_hours
.units_per_week
)
161 pdb_set_logon_divs(account
, r
->logon_hours
.units_per_week
, PDB_CHANGED
);
164 /* no idea what to do with this one - gd */
165 /* Max Logon Hours */
166 if (delta
->unknown1
!= pdb_get_unknown_6(account
)) {
167 pdb_set_unknown_6(account
, delta
->unknown1
, PDB_CHANGED
);
170 /* Logon Hours Len */
171 if (r
->logon_hours
.units_per_week
/8 != pdb_get_hours_len(account
)) {
172 pdb_set_hours_len(account
, r
->logon_hours
.units_per_week
/8, PDB_CHANGED
);
176 if (r
->logon_hours
.bits
) {
177 char oldstr
[44], newstr
[44];
178 pdb_sethexhours(oldstr
, pdb_get_hours(account
));
179 pdb_sethexhours(newstr
, r
->logon_hours
.bits
);
180 if (!strequal(oldstr
, newstr
))
181 pdb_set_hours(account
, r
->logon_hours
.bits
, PDB_CHANGED
);
184 if (pdb_get_bad_password_count(account
) != r
->bad_password_count
)
185 pdb_set_bad_password_count(account
, r
->bad_password_count
, PDB_CHANGED
);
187 if (pdb_get_logon_count(account
) != r
->logon_count
)
188 pdb_set_logon_count(account
, r
->logon_count
, PDB_CHANGED
);
190 if (!nt_time_is_zero(&r
->last_password_change
)) {
191 unix_time
= nt_time_to_unix(r
->last_password_change
);
192 stored_time
= pdb_get_pass_last_set_time(account
);
193 if (stored_time
!= unix_time
)
194 pdb_set_pass_last_set_time(account
, unix_time
, PDB_CHANGED
);
196 /* no last set time, make it now */
197 pdb_set_pass_last_set_time(account
, time(NULL
), PDB_CHANGED
);
200 if (!nt_time_is_zero(&r
->acct_expiry
)) {
201 unix_time
= nt_time_to_unix(r
->acct_expiry
);
202 stored_time
= pdb_get_kickoff_time(account
);
203 if (stored_time
!= unix_time
)
204 pdb_set_kickoff_time(account
, unix_time
, PDB_CHANGED
);
207 /* Decode hashes from password hash
208 Note that win2000 may send us all zeros for the hashes if it doesn't
209 think this channel is secure enough - don't set the passwords at all
212 if (memcmp(r
->lmpassword
.hash
, zero_buf
, 16) != 0) {
213 pdb_set_lanman_passwd(account
, r
->lmpassword
.hash
, PDB_CHANGED
);
216 if (memcmp(r
->ntpassword
.hash
, zero_buf
, 16) != 0) {
217 pdb_set_nt_passwd(account
, r
->ntpassword
.hash
, PDB_CHANGED
);
220 /* TODO: account expiry time */
222 pdb_set_acct_ctrl(account
, r
->acct_flags
, PDB_CHANGED
);
224 pdb_set_domain(account
, lp_workgroup(), PDB_CHANGED
);
230 /****************************************************************
231 ****************************************************************/
233 static NTSTATUS
smb_create_user(TALLOC_CTX
*mem_ctx
,
236 struct passwd
**passwd_p
)
238 struct passwd
*passwd
;
239 char *add_script
= NULL
;
241 passwd
= Get_Pwnam_alloc(mem_ctx
, account
);
247 /* Create appropriate user */
248 if (acct_flags
& ACB_NORMAL
) {
249 add_script
= talloc_strdup(mem_ctx
, lp_adduser_script());
250 } else if ( (acct_flags
& ACB_WSTRUST
) ||
251 (acct_flags
& ACB_SVRTRUST
) ||
252 (acct_flags
& ACB_DOMTRUST
) ) {
253 add_script
= talloc_strdup(mem_ctx
, lp_addmachine_script());
255 DEBUG(1, ("Unknown user type: %s\n",
256 pdb_encode_acct_ctrl(acct_flags
, NEW_PW_FORMAT_SPACE_PADDED_LEN
)));
257 return NT_STATUS_UNSUCCESSFUL
;
261 return NT_STATUS_NO_MEMORY
;
266 add_script
= talloc_all_string_sub(mem_ctx
, add_script
,
269 return NT_STATUS_NO_MEMORY
;
271 add_ret
= smbrun(add_script
, NULL
);
272 DEBUG(add_ret
? 0 : 1,("fetch_account: Running the command `%s' "
273 "gave %d\n", add_script
, add_ret
));
275 smb_nscd_flush_user_cache();
279 /* try and find the possible unix account again */
280 passwd
= Get_Pwnam_alloc(mem_ctx
, account
);
282 return NT_STATUS_NO_SUCH_USER
;
289 /****************************************************************
290 ****************************************************************/
292 static NTSTATUS
fetch_account_info(TALLOC_CTX
*mem_ctx
,
294 struct netr_DELTA_USER
*r
)
297 NTSTATUS nt_ret
= NT_STATUS_UNSUCCESSFUL
;
299 struct samu
*sam_account
=NULL
;
302 struct dom_sid user_sid
;
303 struct dom_sid group_sid
;
304 struct passwd
*passwd
= NULL
;
307 fstrcpy(account
, r
->account_name
.string
);
308 d_printf("Creating account: %s\n", account
);
310 if ( !(sam_account
= samu_new(mem_ctx
)) ) {
311 return NT_STATUS_NO_MEMORY
;
314 nt_ret
= smb_create_user(sam_account
, r
->acct_flags
, account
, &passwd
);
315 if (!NT_STATUS_IS_OK(nt_ret
)) {
316 d_fprintf(stderr
, "Could not create posix account info for '%s'\n",
321 sid_compose(&user_sid
, get_global_sam_sid(), r
->rid
);
323 DEBUG(3, ("Attempting to find SID %s for user %s in the passdb\n",
324 sid_to_fstring(sid_string
, &user_sid
), account
));
325 if (!pdb_getsampwsid(sam_account
, &user_sid
)) {
326 sam_account_from_delta(sam_account
, r
);
327 DEBUG(3, ("Attempting to add user SID %s for user %s in the passdb\n",
328 sid_to_fstring(sid_string
, &user_sid
),
329 pdb_get_username(sam_account
)));
330 if (!NT_STATUS_IS_OK(pdb_add_sam_account(sam_account
))) {
331 DEBUG(1, ("SAM Account for %s failed to be added to the passdb!\n",
333 return NT_STATUS_ACCESS_DENIED
;
336 sam_account_from_delta(sam_account
, r
);
337 DEBUG(3, ("Attempting to update user SID %s for user %s in the passdb\n",
338 sid_to_fstring(sid_string
, &user_sid
),
339 pdb_get_username(sam_account
)));
340 if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_account
))) {
341 DEBUG(1, ("SAM Account for %s failed to be updated in the passdb!\n",
343 TALLOC_FREE(sam_account
);
344 return NT_STATUS_ACCESS_DENIED
;
348 if (pdb_get_group_sid(sam_account
) == NULL
) {
349 return NT_STATUS_UNSUCCESSFUL
;
352 group_sid
= *pdb_get_group_sid(sam_account
);
354 if (!pdb_getgrsid(&map
, group_sid
)) {
355 DEBUG(0, ("Primary group of %s has no mapping!\n",
356 pdb_get_username(sam_account
)));
358 if (map
.gid
!= passwd
->pw_gid
) {
359 if (!(grp
= getgrgid(map
.gid
))) {
360 DEBUG(0, ("Could not find unix group %lu for user %s (group SID=%s)\n",
361 (unsigned long)map
.gid
, pdb_get_username(sam_account
), sid_string_tos(&group_sid
)));
363 smb_set_primary_group(grp
->gr_name
, pdb_get_username(sam_account
));
369 DEBUG(1, ("No unix user for this account (%s), cannot adjust mappings\n",
370 pdb_get_username(sam_account
)));
374 TALLOC_FREE(sam_account
);
378 /****************************************************************
379 ****************************************************************/
381 static NTSTATUS
fetch_group_info(TALLOC_CTX
*mem_ctx
,
383 struct netr_DELTA_GROUP
*r
)
387 struct group
*grp
= NULL
;
388 struct dom_sid group_sid
;
393 fstrcpy(name
, r
->group_name
.string
);
394 fstrcpy(comment
, r
->description
.string
);
396 /* add the group to the mapping table */
397 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
398 sid_to_fstring(sid_string
, &group_sid
);
400 if (pdb_getgrsid(&map
, group_sid
)) {
402 grp
= getgrgid(map
.gid
);
409 /* No group found from mapping, find it from its name. */
410 if ((grp
= getgrnam(name
)) == NULL
) {
412 /* No appropriate group found, create one */
414 d_printf("Creating unix group: '%s'\n", name
);
416 if (smb_create_group(name
, &gid
) != 0)
417 return NT_STATUS_ACCESS_DENIED
;
419 if ((grp
= getgrnam(name
)) == NULL
)
420 return NT_STATUS_ACCESS_DENIED
;
424 map
.gid
= grp
->gr_gid
;
426 map
.sid_name_use
= SID_NAME_DOM_GRP
;
427 fstrcpy(map
.nt_name
, name
);
428 if (r
->description
.string
) {
429 fstrcpy(map
.comment
, comment
);
431 fstrcpy(map
.comment
, "");
435 pdb_add_group_mapping_entry(&map
);
437 pdb_update_group_mapping_entry(&map
);
442 /****************************************************************
443 ****************************************************************/
445 static NTSTATUS
fetch_group_mem_info(TALLOC_CTX
*mem_ctx
,
447 struct netr_DELTA_GROUP_MEMBER
*r
)
450 char **nt_members
= NULL
;
452 struct dom_sid group_sid
;
456 if (r
->num_rids
== 0) {
460 sid_compose(&group_sid
, get_global_sam_sid(), rid
);
462 if (!get_domain_group_from_sid(group_sid
, &map
)) {
463 DEBUG(0, ("Could not find global group %d\n", rid
));
464 return NT_STATUS_NO_SUCH_GROUP
;
467 if (!(grp
= getgrgid(map
.gid
))) {
468 DEBUG(0, ("Could not find unix group %lu\n", (unsigned long)map
.gid
));
469 return NT_STATUS_NO_SUCH_GROUP
;
472 d_printf("Group members of %s: ", grp
->gr_name
);
475 if ((nt_members
= TALLOC_ZERO_ARRAY(mem_ctx
, char *, r
->num_rids
)) == NULL
) {
476 DEBUG(0, ("talloc failed\n"));
477 return NT_STATUS_NO_MEMORY
;
483 for (i
=0; i
< r
->num_rids
; i
++) {
484 struct samu
*member
= NULL
;
485 struct dom_sid member_sid
;
487 if ( !(member
= samu_new(mem_ctx
)) ) {
488 return NT_STATUS_NO_MEMORY
;
491 sid_compose(&member_sid
, get_global_sam_sid(), r
->rids
[i
]);
493 if (!pdb_getsampwsid(member
, &member_sid
)) {
494 DEBUG(1, ("Found bogus group member: %d (member_sid=%s group=%s)\n",
495 r
->rids
[i
], sid_string_tos(&member_sid
), grp
->gr_name
));
500 if (pdb_get_group_rid(member
) == rid
) {
501 d_printf("%s(primary),", pdb_get_username(member
));
506 d_printf("%s,", pdb_get_username(member
));
507 nt_members
[i
] = talloc_strdup(mem_ctx
, pdb_get_username(member
));
513 unix_members
= grp
->gr_mem
;
515 while (*unix_members
) {
516 bool is_nt_member
= false;
517 for (i
=0; i
< r
->num_rids
; i
++) {
518 if (nt_members
[i
] == NULL
) {
519 /* This was a primary group */
523 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
529 /* We look at a unix group member that is not
530 an nt group member. So, remove it. NT is
532 smb_delete_user_group(grp
->gr_name
, *unix_members
);
537 for (i
=0; i
< r
->num_rids
; i
++) {
538 bool is_unix_member
= false;
540 if (nt_members
[i
] == NULL
) {
541 /* This was the primary group */
545 unix_members
= grp
->gr_mem
;
547 while (*unix_members
) {
548 if (strcmp(*unix_members
, nt_members
[i
]) == 0) {
549 is_unix_member
= true;
555 if (!is_unix_member
) {
556 /* We look at a nt group member that is not a
557 unix group member currently. So, add the nt
559 smb_add_user_group(grp
->gr_name
, nt_members
[i
]);
566 /****************************************************************
567 ****************************************************************/
569 static NTSTATUS
fetch_alias_info(TALLOC_CTX
*mem_ctx
,
571 struct netr_DELTA_ALIAS
*r
,
572 const struct dom_sid
*dom_sid
)
576 struct group
*grp
= NULL
;
577 struct dom_sid alias_sid
;
582 fstrcpy(name
, r
->alias_name
.string
);
583 fstrcpy(comment
, r
->description
.string
);
585 /* Find out whether the group is already mapped */
586 sid_compose(&alias_sid
, dom_sid
, rid
);
587 sid_to_fstring(sid_string
, &alias_sid
);
589 if (pdb_getgrsid(&map
, alias_sid
)) {
590 grp
= getgrgid(map
.gid
);
597 /* No group found from mapping, find it from its name. */
598 if ((grp
= getgrnam(name
)) == NULL
) {
599 /* No appropriate group found, create one */
600 d_printf("Creating unix group: '%s'\n", name
);
601 if (smb_create_group(name
, &gid
) != 0)
602 return NT_STATUS_ACCESS_DENIED
;
603 if ((grp
= getgrgid(gid
)) == NULL
)
604 return NT_STATUS_ACCESS_DENIED
;
608 map
.gid
= grp
->gr_gid
;
611 if (sid_equal(dom_sid
, &global_sid_Builtin
))
612 map
.sid_name_use
= SID_NAME_WKN_GRP
;
614 map
.sid_name_use
= SID_NAME_ALIAS
;
616 fstrcpy(map
.nt_name
, name
);
617 fstrcpy(map
.comment
, comment
);
620 pdb_add_group_mapping_entry(&map
);
622 pdb_update_group_mapping_entry(&map
);
627 /****************************************************************
628 ****************************************************************/
630 static NTSTATUS
fetch_alias_mem(TALLOC_CTX
*mem_ctx
,
632 struct netr_DELTA_ALIAS_MEMBER
*r
,
633 const struct dom_sid
*dom_sid
)
638 /****************************************************************
639 ****************************************************************/
641 static NTSTATUS
fetch_domain_info(TALLOC_CTX
*mem_ctx
,
643 struct netr_DELTA_DOMAIN
*r
)
645 time_t u_max_age
, u_min_age
, u_logout
;
646 NTSTATUS nt_status
= NT_STATUS_UNSUCCESSFUL
;
648 struct netr_AcctLockStr
*lockstr
= NULL
;
651 status
= pull_netr_AcctLockStr(mem_ctx
, &r
->account_lockout
,
653 if (!NT_STATUS_IS_OK(status
)) {
654 d_printf("failed to pull account lockout string: %s\n",
658 u_max_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->max_password_age
);
659 u_min_age
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->min_password_age
);
660 u_logout
= uint64s_nt_time_to_unix_abs((uint64
*)&r
->force_logoff_time
);
662 domname
= r
->domain_name
.string
;
664 return NT_STATUS_NO_MEMORY
;
667 /* we don't handle BUILTIN account policies */
668 if (!strequal(domname
, get_global_sam_name())) {
669 printf("skipping SAM_DOMAIN_INFO delta for '%s' (is not my domain)\n", domname
);
674 if (!pdb_set_account_policy(PDB_POLICY_PASSWORD_HISTORY
,
675 r
->password_history_length
))
678 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_LEN
,
679 r
->min_password_length
))
682 if (!pdb_set_account_policy(PDB_POLICY_MAX_PASSWORD_AGE
,
686 if (!pdb_set_account_policy(PDB_POLICY_MIN_PASSWORD_AGE
,
690 if (!pdb_set_account_policy(PDB_POLICY_TIME_TO_LOGOUT
,
695 time_t u_lockoutreset
, u_lockouttime
;
697 u_lockoutreset
= uint64s_nt_time_to_unix_abs(&lockstr
->reset_count
);
698 u_lockouttime
= uint64s_nt_time_to_unix_abs((uint64_t *)&lockstr
->lockout_duration
);
700 if (!pdb_set_account_policy(PDB_POLICY_BAD_ATTEMPT_LOCKOUT
,
701 lockstr
->bad_attempt_lockout
))
704 if (!pdb_set_account_policy(PDB_POLICY_RESET_COUNT_TIME
,
705 (uint32_t)u_lockoutreset
/60))
708 if (u_lockouttime
!= -1)
711 if (!pdb_set_account_policy(PDB_POLICY_LOCK_ACCOUNT_DURATION
,
712 (uint32_t)u_lockouttime
))
716 if (!pdb_set_account_policy(PDB_POLICY_USER_MUST_LOGON_TO_CHG_PASS
,
717 r
->logon_to_chgpass
))
723 /****************************************************************
724 ****************************************************************/
726 static NTSTATUS
fetch_sam_entry(TALLOC_CTX
*mem_ctx
,
727 enum netr_SamDatabaseID database_id
,
728 struct netr_DELTA_ENUM
*r
,
729 struct samsync_context
*ctx
)
731 NTSTATUS status
= NT_STATUS_NOT_IMPLEMENTED
;
733 switch (r
->delta_type
) {
734 case NETR_DELTA_USER
:
735 status
= fetch_account_info(mem_ctx
,
736 r
->delta_id_union
.rid
,
737 r
->delta_union
.user
);
739 case NETR_DELTA_GROUP
:
740 status
= fetch_group_info(mem_ctx
,
741 r
->delta_id_union
.rid
,
742 r
->delta_union
.group
);
744 case NETR_DELTA_GROUP_MEMBER
:
745 status
= fetch_group_mem_info(mem_ctx
,
746 r
->delta_id_union
.rid
,
747 r
->delta_union
.group_member
);
749 case NETR_DELTA_ALIAS
:
750 status
= fetch_alias_info(mem_ctx
,
751 r
->delta_id_union
.rid
,
752 r
->delta_union
.alias
,
755 case NETR_DELTA_ALIAS_MEMBER
:
756 status
= fetch_alias_mem(mem_ctx
,
757 r
->delta_id_union
.rid
,
758 r
->delta_union
.alias_member
,
761 case NETR_DELTA_DOMAIN
:
762 status
= fetch_domain_info(mem_ctx
,
763 r
->delta_id_union
.rid
,
764 r
->delta_union
.domain
);
766 /* The following types are recognised but not handled */
767 case NETR_DELTA_RENAME_GROUP
:
768 d_printf("NETR_DELTA_RENAME_GROUP not handled\n");
770 case NETR_DELTA_RENAME_USER
:
771 d_printf("NETR_DELTA_RENAME_USER not handled\n");
773 case NETR_DELTA_RENAME_ALIAS
:
774 d_printf("NETR_DELTA_RENAME_ALIAS not handled\n");
776 case NETR_DELTA_POLICY
:
777 d_printf("NETR_DELTA_POLICY not handled\n");
779 case NETR_DELTA_TRUSTED_DOMAIN
:
780 d_printf("NETR_DELTA_TRUSTED_DOMAIN not handled\n");
782 case NETR_DELTA_ACCOUNT
:
783 d_printf("NETR_DELTA_ACCOUNT not handled\n");
785 case NETR_DELTA_SECRET
:
786 d_printf("NETR_DELTA_SECRET not handled\n");
788 case NETR_DELTA_DELETE_GROUP
:
789 d_printf("NETR_DELTA_DELETE_GROUP not handled\n");
791 case NETR_DELTA_DELETE_USER
:
792 d_printf("NETR_DELTA_DELETE_USER not handled\n");
794 case NETR_DELTA_MODIFY_COUNT
:
795 d_printf("NETR_DELTA_MODIFY_COUNT not handled\n");
797 case NETR_DELTA_DELETE_ALIAS
:
798 d_printf("NETR_DELTA_DELETE_ALIAS not handled\n");
800 case NETR_DELTA_DELETE_TRUST
:
801 d_printf("NETR_DELTA_DELETE_TRUST not handled\n");
803 case NETR_DELTA_DELETE_ACCOUNT
:
804 d_printf("NETR_DELTA_DELETE_ACCOUNT not handled\n");
806 case NETR_DELTA_DELETE_SECRET
:
807 d_printf("NETR_DELTA_DELETE_SECRET not handled\n");
809 case NETR_DELTA_DELETE_GROUP2
:
810 d_printf("NETR_DELTA_DELETE_GROUP2 not handled\n");
812 case NETR_DELTA_DELETE_USER2
:
813 d_printf("NETR_DELTA_DELETE_USER2 not handled\n");
816 d_printf("Unknown delta record type %d\n", r
->delta_type
);
817 status
= NT_STATUS_INVALID_PARAMETER
;
824 /****************************************************************
825 ****************************************************************/
827 static NTSTATUS
fetch_sam_entries(TALLOC_CTX
*mem_ctx
,
828 enum netr_SamDatabaseID database_id
,
829 struct netr_DELTA_ENUM_ARRAY
*r
,
830 uint64_t *sequence_num
,
831 struct samsync_context
*ctx
)
835 for (i
= 0; i
< r
->num_deltas
; i
++) {
836 fetch_sam_entry(mem_ctx
, database_id
, &r
->delta_enum
[i
], ctx
);
842 /****************************************************************
843 ****************************************************************/
845 const struct samsync_ops libnet_samsync_passdb_ops
= {
846 .process_objects
= fetch_sam_entries
,