Changeset 745 for trunk/server/source3/passdb/pdb_interface.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/passdb/pdb_interface.c
r596 r745 22 22 23 23 #include "includes.h" 24 #include "system/passwd.h" 25 #include "passdb.h" 26 #include "secrets.h" 27 #include "../librpc/gen_ndr/samr.h" 28 #include "memcache.h" 29 #include "nsswitch/winbind_client.h" 30 #include "../libcli/security/security.h" 31 #include "../lib/util/util_pw.h" 24 32 25 33 #undef DBGC_CLASS … … 217 225 } 218 226 227 /** 228 * @brief Check if the user account has been locked out and try to unlock it. 229 * 230 * If the user has been automatically locked out and a lockout duration is set, 231 * then check if we can unlock the account and reset the bad password values. 232 * 233 * @param[in] sampass The sam user to check. 234 * 235 * @return True if the function was successfull, false on an error. 236 */ 237 static bool pdb_try_account_unlock(struct samu *sampass) 238 { 239 uint32_t acb_info = pdb_get_acct_ctrl(sampass); 240 241 if ((acb_info & ACB_NORMAL) && (acb_info & ACB_AUTOLOCK)) { 242 uint32_t lockout_duration; 243 time_t bad_password_time; 244 time_t now = time(NULL); 245 bool ok; 246 247 ok = pdb_get_account_policy(PDB_POLICY_LOCK_ACCOUNT_DURATION, 248 &lockout_duration); 249 if (!ok) { 250 DEBUG(0, ("pdb_try_account_unlock: " 251 "pdb_get_account_policy failed.\n")); 252 return false; 253 } 254 255 if (lockout_duration == (uint32_t) -1 || 256 lockout_duration == 0) { 257 DEBUG(9, ("pdb_try_account_unlock: No reset duration, " 258 "can't reset autolock\n")); 259 return false; 260 } 261 lockout_duration *= 60; 262 263 bad_password_time = pdb_get_bad_password_time(sampass); 264 if (bad_password_time == (time_t) 0) { 265 DEBUG(2, ("pdb_try_account_unlock: Account %s " 266 "administratively locked out " 267 "with no bad password " 268 "time. Leaving locked out.\n", 269 pdb_get_username(sampass))); 270 return true; 271 } 272 273 if ((bad_password_time + 274 convert_uint32_t_to_time_t(lockout_duration)) < now) { 275 NTSTATUS status; 276 277 pdb_set_acct_ctrl(sampass, acb_info & ~ACB_AUTOLOCK, 278 PDB_CHANGED); 279 pdb_set_bad_password_count(sampass, 0, PDB_CHANGED); 280 pdb_set_bad_password_time(sampass, 0, PDB_CHANGED); 281 282 become_root(); 283 status = pdb_update_sam_account(sampass); 284 unbecome_root(); 285 if (!NT_STATUS_IS_OK(status)) { 286 DEBUG(0, ("_samr_OpenUser: Couldn't " 287 "update account %s - %s\n", 288 pdb_get_username(sampass), 289 nt_errstr(status))); 290 return false; 291 } 292 } 293 } 294 295 return true; 296 } 297 298 /** 299 * @brief Get a sam user structure by the given username. 300 * 301 * This functions also checks if the account has been automatically locked out 302 * and unlocks it if a lockout duration time has been defined and the time has 303 * elapsed. 304 * 305 * @param[in] sam_acct The sam user structure to fill. 306 * 307 * @param[in] username The username to look for. 308 * 309 * @return True on success, false on error. 310 */ 219 311 bool pdb_getsampwnam(struct samu *sam_acct, const char *username) 220 312 { … … 222 314 struct samu *for_cache; 223 315 const struct dom_sid *user_sid; 224 225 if (!NT_STATUS_IS_OK(pdb->getsampwnam(pdb, sam_acct, username))) { 226 return False; 316 NTSTATUS status; 317 bool ok; 318 319 status = pdb->getsampwnam(pdb, sam_acct, username); 320 if (!NT_STATUS_IS_OK(status)) { 321 return false; 322 } 323 324 ok = pdb_try_account_unlock(sam_acct); 325 if (!ok) { 326 DEBUG(1, ("pdb_getsampwnam: Failed to unlock account %s\n", 327 username)); 227 328 } 228 329 … … 249 350 **********************************************************************/ 250 351 251 bool guest_user_info( struct samu *user )352 static bool guest_user_info( struct samu *user ) 252 353 { 253 354 struct passwd *pwd; … … 255 356 const char *guestname = lp_guestaccount(); 256 357 257 if ( !(pwd = Get_Pwnam_alloc(talloc_autofree_context(), guestname ) ) ) { 358 pwd = Get_Pwnam_alloc(talloc_tos(), guestname); 359 if (pwd == NULL) { 258 360 DEBUG(0,("guest_user_info: Unable to locate guest account [%s]!\n", 259 361 guestname)); … … 268 370 } 269 371 270 /********************************************************************** 271 **********************************************************************/ 272 273 bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) 274 { 275 struct pdb_methods *pdb = pdb_get_methods(); 276 uint32 rid; 372 /** 373 * @brief Get a sam user structure by the given username. 374 * 375 * This functions also checks if the account has been automatically locked out 376 * and unlocks it if a lockout duration time has been defined and the time has 377 * elapsed. 378 * 379 * 380 * @param[in] sam_acct The sam user structure to fill. 381 * 382 * @param[in] sid The user SDI to look up. 383 * 384 * @return True on success, false on error. 385 */ 386 bool pdb_getsampwsid(struct samu *sam_acct, const struct dom_sid *sid) 387 { 388 struct pdb_methods *pdb = pdb_get_methods(); 389 uint32_t rid; 277 390 void *cache_data; 391 bool ok = false; 278 392 279 393 /* hard code the Guest RID of 501 */ … … 282 396 return False; 283 397 284 if ( rid == DOMAIN_ USER_RID_GUEST ) {398 if ( rid == DOMAIN_RID_GUEST ) { 285 399 DEBUG(6,("pdb_getsampwsid: Building guest account\n")); 286 400 return guest_user_info( sam_acct ); … … 296 410 cache_data, struct samu); 297 411 298 return pdb_copy_sam_account(sam_acct, cache_copy); 299 } 300 301 return NT_STATUS_IS_OK(pdb->getsampwsid(pdb, sam_acct, sid)); 412 ok = pdb_copy_sam_account(sam_acct, cache_copy); 413 } else { 414 ok = NT_STATUS_IS_OK(pdb->getsampwsid(pdb, sam_acct, sid)); 415 } 416 417 if (!ok) { 418 return false; 419 } 420 421 ok = pdb_try_account_unlock(sam_acct); 422 if (!ok) { 423 DEBUG(1, ("pdb_getsampwsid: Failed to unlock account %s\n", 424 sam_acct->username)); 425 } 426 427 return true; 302 428 } 303 429 304 430 static NTSTATUS pdb_default_create_user(struct pdb_methods *methods, 305 431 TALLOC_CTX *tmp_ctx, const char *name, 306 uint32 acb_info, uint32*rid)432 uint32_t acb_info, uint32_t *rid) 307 433 { 308 434 struct samu *sam_pass; … … 354 480 355 481 pwd = Get_Pwnam_alloc(tmp_ctx, name); 482 483 if(pwd == NULL) { 484 DEBUG(3, ("Could not find user %s, add script did not work\n", name)); 485 return NT_STATUS_NO_SUCH_USER; 486 } 356 487 } 357 488 … … 390 521 } 391 522 392 NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32 flags,393 uint32 *rid)523 NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, 524 uint32_t *rid) 394 525 { 395 526 struct pdb_methods *pdb = pdb_get_methods(); … … 538 669 } 539 670 540 bool pdb_getgrsid(GROUP_MAP *map, DOM_SIDsid)671 bool pdb_getgrsid(GROUP_MAP *map, struct dom_sid sid) 541 672 { 542 673 struct pdb_methods *pdb = pdb_get_methods(); … … 559 690 TALLOC_CTX *mem_ctx, 560 691 const char *name, 561 uint32 *rid)562 { 563 DOM_SIDgroup_sid;692 uint32_t *rid) 693 { 694 struct dom_sid group_sid; 564 695 struct group *grp; 565 696 fstring tmp; … … 596 727 597 728 NTSTATUS pdb_create_dom_group(TALLOC_CTX *mem_ctx, const char *name, 598 uint32 *rid)729 uint32_t *rid) 599 730 { 600 731 struct pdb_methods *pdb = pdb_get_methods(); … … 604 735 static NTSTATUS pdb_default_delete_dom_group(struct pdb_methods *methods, 605 736 TALLOC_CTX *mem_ctx, 606 uint32 rid)607 { 608 DOM_SIDgroup_sid;737 uint32_t rid) 738 { 739 struct dom_sid group_sid; 609 740 GROUP_MAP map; 610 741 NTSTATUS status; … … 653 784 } 654 785 655 NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32 rid)786 NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32_t rid) 656 787 { 657 788 struct pdb_methods *pdb = pdb_get_methods(); … … 671 802 } 672 803 673 NTSTATUS pdb_delete_group_mapping_entry( DOM_SIDsid)804 NTSTATUS pdb_delete_group_mapping_entry(struct dom_sid sid) 674 805 { 675 806 struct pdb_methods *pdb = pdb_get_methods(); … … 677 808 } 678 809 679 bool pdb_enum_group_mapping(const DOM_SID*sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap,810 bool pdb_enum_group_mapping(const struct dom_sid *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, 680 811 size_t *p_num_entries, bool unix_only) 681 812 { … … 686 817 687 818 NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx, 688 const DOM_SID*sid,689 uint32 **pp_member_rids,819 const struct dom_sid *sid, 820 uint32_t **pp_member_rids, 690 821 size_t *p_num_members) 691 822 { … … 699 830 700 831 if ( !NT_STATUS_IS_OK( result ) ) { 701 uint32 rid;832 uint32_t rid; 702 833 703 834 sid_peek_rid( sid, &rid ); 704 835 705 if ( rid == DOMAIN_ GROUP_RID_USERS ) {836 if ( rid == DOMAIN_RID_USERS ) { 706 837 *p_num_members = 0; 707 838 *pp_member_rids = NULL; … … 715 846 716 847 NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user, 717 DOM_SID**pp_sids, gid_t **pp_gids,718 size_t *p_num_groups)848 struct dom_sid **pp_sids, gid_t **pp_gids, 849 uint32_t *p_num_groups) 719 850 { 720 851 struct pdb_methods *pdb = pdb_get_methods(); … … 757 888 758 889 static bool pdb_user_in_group(TALLOC_CTX *mem_ctx, struct samu *account, 759 const DOM_SID*group_sid)760 { 761 DOM_SID*sids;890 const struct dom_sid *group_sid) 891 { 892 struct dom_sid *sids; 762 893 gid_t *gids; 763 size_t i, num_groups;894 uint32_t i, num_groups; 764 895 765 896 if (!NT_STATUS_IS_OK(pdb_enum_group_memberships(mem_ctx, account, … … 770 901 771 902 for (i=0; i<num_groups; i++) { 772 if ( sid_equal(group_sid, &sids[i])) {903 if (dom_sid_equal(group_sid, &sids[i])) { 773 904 return True; 774 905 } … … 779 910 static NTSTATUS pdb_default_add_groupmem(struct pdb_methods *methods, 780 911 TALLOC_CTX *mem_ctx, 781 uint32 group_rid,782 uint32 member_rid)783 { 784 DOM_SIDgroup_sid, member_sid;912 uint32_t group_rid, 913 uint32_t member_rid) 914 { 915 struct dom_sid group_sid, member_sid; 785 916 struct samu *account = NULL; 786 917 GROUP_MAP map; … … 835 966 } 836 967 837 NTSTATUS pdb_add_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid,838 uint32 member_rid)968 NTSTATUS pdb_add_groupmem(TALLOC_CTX *mem_ctx, uint32_t group_rid, 969 uint32_t member_rid) 839 970 { 840 971 struct pdb_methods *pdb = pdb_get_methods(); … … 844 975 static NTSTATUS pdb_default_del_groupmem(struct pdb_methods *methods, 845 976 TALLOC_CTX *mem_ctx, 846 uint32 group_rid,847 uint32 member_rid)848 { 849 DOM_SIDgroup_sid, member_sid;977 uint32_t group_rid, 978 uint32_t member_rid) 979 { 980 struct dom_sid group_sid, member_sid; 850 981 struct samu *account = NULL; 851 982 GROUP_MAP map; … … 897 1028 } 898 1029 899 NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid,900 uint32 member_rid)1030 NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32_t group_rid, 1031 uint32_t member_rid) 901 1032 { 902 1033 struct pdb_methods *pdb = pdb_get_methods(); … … 904 1035 } 905 1036 906 NTSTATUS pdb_create_alias(const char *name, uint32 *rid)1037 NTSTATUS pdb_create_alias(const char *name, uint32_t *rid) 907 1038 { 908 1039 struct pdb_methods *pdb = pdb_get_methods(); … … 910 1041 } 911 1042 912 NTSTATUS pdb_delete_alias(const DOM_SID*sid)1043 NTSTATUS pdb_delete_alias(const struct dom_sid *sid) 913 1044 { 914 1045 struct pdb_methods *pdb = pdb_get_methods(); … … 916 1047 } 917 1048 918 NTSTATUS pdb_get_aliasinfo(const DOM_SID*sid, struct acct_info *info)1049 NTSTATUS pdb_get_aliasinfo(const struct dom_sid *sid, struct acct_info *info) 919 1050 { 920 1051 struct pdb_methods *pdb = pdb_get_methods(); … … 922 1053 } 923 1054 924 NTSTATUS pdb_set_aliasinfo(const DOM_SID*sid, struct acct_info *info)1055 NTSTATUS pdb_set_aliasinfo(const struct dom_sid *sid, struct acct_info *info) 925 1056 { 926 1057 struct pdb_methods *pdb = pdb_get_methods(); … … 928 1059 } 929 1060 930 NTSTATUS pdb_add_aliasmem(const DOM_SID *alias, const DOM_SID*member)1061 NTSTATUS pdb_add_aliasmem(const struct dom_sid *alias, const struct dom_sid *member) 931 1062 { 932 1063 struct pdb_methods *pdb = pdb_get_methods(); … … 934 1065 } 935 1066 936 NTSTATUS pdb_del_aliasmem(const DOM_SID *alias, const DOM_SID*member)1067 NTSTATUS pdb_del_aliasmem(const struct dom_sid *alias, const struct dom_sid *member) 937 1068 { 938 1069 struct pdb_methods *pdb = pdb_get_methods(); … … 940 1071 } 941 1072 942 NTSTATUS pdb_enum_aliasmem(const DOM_SID*alias, TALLOC_CTX *mem_ctx,943 DOM_SID**pp_members, size_t *p_num_members)1073 NTSTATUS pdb_enum_aliasmem(const struct dom_sid *alias, TALLOC_CTX *mem_ctx, 1074 struct dom_sid **pp_members, size_t *p_num_members) 944 1075 { 945 1076 struct pdb_methods *pdb = pdb_get_methods(); … … 949 1080 950 1081 NTSTATUS pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx, 951 const DOM_SID*domain_sid,952 const DOM_SID*members, size_t num_members,953 uint32 **pp_alias_rids,1082 const struct dom_sid *domain_sid, 1083 const struct dom_sid *members, size_t num_members, 1084 uint32_t **pp_alias_rids, 954 1085 size_t *p_num_alias_rids) 955 1086 { … … 962 1093 } 963 1094 964 NTSTATUS pdb_lookup_rids(const DOM_SID*domain_sid,1095 NTSTATUS pdb_lookup_rids(const struct dom_sid *domain_sid, 965 1096 int num_rids, 966 uint32 *rids,1097 uint32_t *rids, 967 1098 const char **names, 968 1099 enum lsa_SidType *attrs) … … 984 1115 */ 985 1116 #if 0 986 NTSTATUS pdb_lookup_names(const DOM_SID*domain_sid,1117 NTSTATUS pdb_lookup_names(const struct dom_sid *domain_sid, 987 1118 int num_names, 988 1119 const char **names, 989 uint32 *rids,1120 uint32_t *rids, 990 1121 enum lsa_SidType *attrs) 991 1122 { … … 1025 1156 } 1026 1157 1027 bool pdb_uid_to_sid(uid_t uid, DOM_SID*sid)1158 bool pdb_uid_to_sid(uid_t uid, struct dom_sid *sid) 1028 1159 { 1029 1160 struct pdb_methods *pdb = pdb_get_methods(); … … 1031 1162 } 1032 1163 1033 bool pdb_gid_to_sid(gid_t gid, DOM_SID*sid)1164 bool pdb_gid_to_sid(gid_t gid, struct dom_sid *sid) 1034 1165 { 1035 1166 struct pdb_methods *pdb = pdb_get_methods(); … … 1037 1168 } 1038 1169 1039 bool pdb_sid_to_id(const DOM_SID*sid, union unid_t *id,1170 bool pdb_sid_to_id(const struct dom_sid *sid, union unid_t *id, 1040 1171 enum lsa_SidType *type) 1041 1172 { … … 1057 1188 ********************************************************************/ 1058 1189 1059 bool pdb_new_rid(uint32 *rid)1190 bool pdb_new_rid(uint32_t *rid) 1060 1191 { 1061 1192 struct pdb_methods *pdb = pdb_get_methods(); 1062 1193 const char *name = NULL; 1063 1194 enum lsa_SidType type; 1064 uint32 allocated_rid = 0;1195 uint32_t allocated_rid = 0; 1065 1196 int i; 1066 1197 TALLOC_CTX *ctx; … … 1137 1268 } 1138 1269 1139 static NTSTATUS pdb_default_getsampwsid(struct pdb_methods *my_methods, struct samu * user, const DOM_SID*sid)1270 static NTSTATUS pdb_default_getsampwsid(struct pdb_methods *my_methods, struct samu * user, const struct dom_sid *sid) 1140 1271 { 1141 1272 return NT_STATUS_NO_SUCH_USER; … … 1186 1317 1187 1318 static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid, 1188 DOM_SID*sid)1319 struct dom_sid *sid) 1189 1320 { 1190 1321 struct samu *sampw = NULL; … … 1225 1356 1226 1357 static bool pdb_default_gid_to_sid(struct pdb_methods *methods, gid_t gid, 1227 DOM_SID*sid)1358 struct dom_sid *sid) 1228 1359 { 1229 1360 GROUP_MAP map; … … 1238 1369 1239 1370 static bool pdb_default_sid_to_id(struct pdb_methods *methods, 1240 const DOM_SID*sid,1371 const struct dom_sid *sid, 1241 1372 union unid_t *id, enum lsa_SidType *type) 1242 1373 { … … 1244 1375 bool ret = False; 1245 1376 const char *name; 1246 uint32 rid;1377 uint32_t rid; 1247 1378 1248 1379 mem_ctx = talloc_new(NULL); … … 1311 1442 } 1312 1443 1313 static bool get_memberuids(TALLOC_CTX *mem_ctx, gid_t gid, uid_t **pp_uids, size_t *p_num)1444 static bool get_memberuids(TALLOC_CTX *mem_ctx, gid_t gid, uid_t **pp_uids, uint32_t *p_num) 1314 1445 { 1315 1446 struct group *grp; … … 1368 1499 static NTSTATUS pdb_default_enum_group_members(struct pdb_methods *methods, 1369 1500 TALLOC_CTX *mem_ctx, 1370 const DOM_SID*group,1371 uint32 **pp_member_rids,1501 const struct dom_sid *group, 1502 uint32_t **pp_member_rids, 1372 1503 size_t *p_num_members) 1373 1504 { 1374 1505 gid_t gid; 1375 1506 uid_t *uids; 1376 size_t i, num_uids;1507 uint32_t i, num_uids; 1377 1508 1378 1509 *pp_member_rids = NULL; … … 1388 1519 return NT_STATUS_OK; 1389 1520 1390 *pp_member_rids = TALLOC_ZERO_ARRAY(mem_ctx, uint32 , num_uids);1521 *pp_member_rids = TALLOC_ZERO_ARRAY(mem_ctx, uint32_t, num_uids); 1391 1522 1392 1523 for (i=0; i<num_uids; i++) { 1393 DOM_SIDsid;1524 struct dom_sid sid; 1394 1525 1395 1526 uid_to_sid(&sid, uids[i]); … … 1411 1542 TALLOC_CTX *mem_ctx, 1412 1543 struct samu *user, 1413 DOM_SID**pp_sids,1544 struct dom_sid **pp_sids, 1414 1545 gid_t **pp_gids, 1415 size_t *p_num_groups)1546 uint32_t *p_num_groups) 1416 1547 { 1417 1548 size_t i; … … 1440 1571 } 1441 1572 1442 *pp_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, *p_num_groups);1573 *pp_sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, *p_num_groups); 1443 1574 1444 1575 if (*pp_sids == NULL) { … … 1458 1589 ********************************************************************/ 1459 1590 1460 static bool lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid,1591 static bool lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32_t rid, 1461 1592 const char **name, 1462 1593 enum lsa_SidType *psid_name_use, … … 1466 1597 GROUP_MAP map; 1467 1598 bool ret; 1468 DOM_SIDsid;1599 struct dom_sid sid; 1469 1600 1470 1601 *psid_name_use = SID_NAME_UNKNOWN; … … 1473 1604 (unsigned int)rid)); 1474 1605 1475 sid_copy(&sid, get_global_sam_sid()); 1476 sid_append_rid(&sid, rid); 1606 sid_compose(&sid, get_global_sam_sid(), rid); 1477 1607 1478 1608 /* see if the passdb can help us with the name of the user */ … … 1482 1612 } 1483 1613 1484 /* BEING ROOT BL LOCK */1614 /* BEING ROOT BLOCK */ 1485 1615 become_root(); 1486 1616 if (pdb_getsampwsid(sam_account, &sid)) { … … 1538 1668 } 1539 1669 1540 if ( rid == DOMAIN_ GROUP_RID_USERS ) {1670 if ( rid == DOMAIN_RID_USERS ) { 1541 1671 *name = talloc_strdup(mem_ctx, "None" ); 1542 1672 *psid_name_use = SID_NAME_DOM_GRP; … … 1549 1679 1550 1680 static NTSTATUS pdb_default_lookup_rids(struct pdb_methods *methods, 1551 const DOM_SID*domain_sid,1681 const struct dom_sid *domain_sid, 1552 1682 int num_rids, 1553 uint32 *rids,1683 uint32_t *rids, 1554 1684 const char **names, 1555 1685 enum lsa_SidType *attrs) … … 1613 1743 #if 0 1614 1744 static NTSTATUS pdb_default_lookup_names(struct pdb_methods *methods, 1615 const DOM_SID*domain_sid,1745 const struct dom_sid *domain_sid, 1616 1746 int num_names, 1617 1747 const char **names, 1618 uint32 *rids,1748 uint32_t *rids, 1619 1749 enum lsa_SidType *attrs) 1620 1750 { … … 1627 1757 1628 1758 for (i=0; i<num_names; i++) { 1629 uint32 rid;1759 uint32_t rid; 1630 1760 1631 1761 if (lookup_builtin_name(names[i], &rid)) { … … 1705 1835 } 1706 1836 1707 static void fill_displayentry(TALLOC_CTX *mem_ctx, uint32 rid,1708 uint16 acct_flags,1837 static void fill_displayentry(TALLOC_CTX *mem_ctx, uint32_t rid, 1838 uint16_t acct_flags, 1709 1839 const char *account_name, 1710 1840 const char *fullname, … … 1740 1870 { 1741 1871 struct group_search *state = (struct group_search *)s->private_data; 1742 uint32 rid;1872 uint32_t rid; 1743 1873 GROUP_MAP *map = &state->groups[state->current_group]; 1744 1874 … … 1762 1892 1763 1893 static bool pdb_search_grouptype(struct pdb_search *search, 1764 const DOM_SID*sid, enum lsa_SidType type)1894 const struct dom_sid *sid, enum lsa_SidType type) 1765 1895 { 1766 1896 struct group_search *state; … … 1793 1923 static bool pdb_default_search_aliases(struct pdb_methods *methods, 1794 1924 struct pdb_search *search, 1795 const DOM_SID*sid)1925 const struct dom_sid *sid) 1796 1926 { 1797 1927 … … 1800 1930 1801 1931 static struct samr_displayentry *pdb_search_getentry(struct pdb_search *search, 1802 uint32 idx)1932 uint32_t idx) 1803 1933 { 1804 1934 if (idx < search->num_entries) … … 1825 1955 } 1826 1956 1827 struct pdb_search *pdb_search_users(TALLOC_CTX *mem_ctx, uint32 acct_flags)1957 struct pdb_search *pdb_search_users(TALLOC_CTX *mem_ctx, uint32_t acct_flags) 1828 1958 { 1829 1959 struct pdb_methods *pdb = pdb_get_methods(); … … 1859 1989 } 1860 1990 1861 struct pdb_search *pdb_search_aliases(TALLOC_CTX *mem_ctx, const DOM_SID*sid)1991 struct pdb_search *pdb_search_aliases(TALLOC_CTX *mem_ctx, const struct dom_sid *sid) 1862 1992 { 1863 1993 struct pdb_methods *pdb = pdb_get_methods(); … … 1878 2008 } 1879 2009 1880 uint32 pdb_search_entries(struct pdb_search *search,1881 uint32 start_idx, uint32max_entries,2010 uint32_t pdb_search_entries(struct pdb_search *search, 2011 uint32_t start_idx, uint32_t max_entries, 1882 2012 struct samr_displayentry **result) 1883 2013 { 1884 2014 struct samr_displayentry *end_entry; 1885 uint32 end_idx = start_idx+max_entries-1;2015 uint32_t end_idx = start_idx+max_entries-1; 1886 2016 1887 2017 /* The first entry needs to be searched after the last. Otherwise the … … 1905 2035 *******************************************************************/ 1906 2036 1907 bool pdb_get_trusteddom_pw(const char *domain, char** pwd, DOM_SID *sid,2037 bool pdb_get_trusteddom_pw(const char *domain, char** pwd, struct dom_sid *sid, 1908 2038 time_t *pass_last_set_time) 1909 2039 { … … 1914 2044 1915 2045 bool pdb_set_trusteddom_pw(const char* domain, const char* pwd, 1916 const DOM_SID*sid)2046 const struct dom_sid *sid) 1917 2047 { 1918 2048 struct pdb_methods *pdb = pdb_get_methods(); … … 1926 2056 } 1927 2057 1928 NTSTATUS pdb_enum_trusteddoms(TALLOC_CTX *mem_ctx, uint32 *num_domains,2058 NTSTATUS pdb_enum_trusteddoms(TALLOC_CTX *mem_ctx, uint32_t *num_domains, 1929 2059 struct trustdom_info ***domains) 1930 2060 { … … 1942 2072 const char *domain, 1943 2073 char** pwd, 1944 DOM_SID *sid,2074 struct dom_sid *sid, 1945 2075 time_t *pass_last_set_time) 1946 2076 { … … 1953 2083 const char* domain, 1954 2084 const char* pwd, 1955 const DOM_SID*sid)2085 const struct dom_sid *sid) 1956 2086 { 1957 2087 return secrets_store_trusted_domain_password(domain, pwd, sid); … … 1966 2096 static NTSTATUS pdb_default_enum_trusteddoms(struct pdb_methods *methods, 1967 2097 TALLOC_CTX *mem_ctx, 1968 uint32 *num_domains,2098 uint32_t *num_domains, 1969 2099 struct trustdom_info ***domains) 1970 2100 { 1971 2101 return secrets_trusted_domains(mem_ctx, num_domains, domains); 2102 } 2103 2104 /******************************************************************* 2105 trusted_domain methods 2106 *******************************************************************/ 2107 2108 NTSTATUS pdb_get_trusted_domain(TALLOC_CTX *mem_ctx, const char *domain, 2109 struct pdb_trusted_domain **td) 2110 { 2111 struct pdb_methods *pdb = pdb_get_methods(); 2112 return pdb->get_trusted_domain(pdb, mem_ctx, domain, td); 2113 } 2114 2115 NTSTATUS pdb_get_trusted_domain_by_sid(TALLOC_CTX *mem_ctx, struct dom_sid *sid, 2116 struct pdb_trusted_domain **td) 2117 { 2118 struct pdb_methods *pdb = pdb_get_methods(); 2119 return pdb->get_trusted_domain_by_sid(pdb, mem_ctx, sid, td); 2120 } 2121 2122 NTSTATUS pdb_set_trusted_domain(const char* domain, 2123 const struct pdb_trusted_domain *td) 2124 { 2125 struct pdb_methods *pdb = pdb_get_methods(); 2126 return pdb->set_trusted_domain(pdb, domain, td); 2127 } 2128 2129 NTSTATUS pdb_del_trusted_domain(const char *domain) 2130 { 2131 struct pdb_methods *pdb = pdb_get_methods(); 2132 return pdb->del_trusted_domain(pdb, domain); 2133 } 2134 2135 NTSTATUS pdb_enum_trusted_domains(TALLOC_CTX *mem_ctx, uint32_t *num_domains, 2136 struct pdb_trusted_domain ***domains) 2137 { 2138 struct pdb_methods *pdb = pdb_get_methods(); 2139 return pdb->enum_trusted_domains(pdb, mem_ctx, num_domains, domains); 2140 } 2141 2142 static NTSTATUS pdb_default_get_trusted_domain(struct pdb_methods *methods, 2143 TALLOC_CTX *mem_ctx, 2144 const char *domain, 2145 struct pdb_trusted_domain **td) 2146 { 2147 return NT_STATUS_NOT_IMPLEMENTED; 2148 } 2149 2150 static NTSTATUS pdb_default_get_trusted_domain_by_sid(struct pdb_methods *methods, 2151 TALLOC_CTX *mem_ctx, 2152 struct dom_sid *sid, 2153 struct pdb_trusted_domain **td) 2154 { 2155 return NT_STATUS_NOT_IMPLEMENTED; 2156 } 2157 2158 static NTSTATUS pdb_default_set_trusted_domain(struct pdb_methods *methods, 2159 const char* domain, 2160 const struct pdb_trusted_domain *td) 2161 { 2162 return NT_STATUS_NOT_IMPLEMENTED; 2163 } 2164 2165 static NTSTATUS pdb_default_del_trusted_domain(struct pdb_methods *methods, 2166 const char *domain) 2167 { 2168 return NT_STATUS_NOT_IMPLEMENTED; 2169 } 2170 2171 static NTSTATUS pdb_default_enum_trusted_domains(struct pdb_methods *methods, 2172 TALLOC_CTX *mem_ctx, 2173 uint32_t *num_domains, 2174 struct pdb_trusted_domain ***domains) 2175 { 2176 return NT_STATUS_NOT_IMPLEMENTED; 1972 2177 } 1973 2178 … … 1989 2194 /* allocate memory for the structure as its own talloc CTX */ 1990 2195 1991 *methods = talloc_zero( talloc_autofree_context(), struct pdb_methods);2196 *methods = talloc_zero(NULL, struct pdb_methods); 1992 2197 if (*methods == NULL) { 1993 2198 return NT_STATUS_NO_MEMORY; … … 2043 2248 (*methods)->enum_trusteddoms = pdb_default_enum_trusteddoms; 2044 2249 2250 (*methods)->get_trusted_domain = pdb_default_get_trusted_domain; 2251 (*methods)->get_trusted_domain_by_sid = pdb_default_get_trusted_domain_by_sid; 2252 (*methods)->set_trusted_domain = pdb_default_set_trusted_domain; 2253 (*methods)->del_trusted_domain = pdb_default_del_trusted_domain; 2254 (*methods)->enum_trusted_domains = pdb_default_enum_trusted_domains; 2255 2045 2256 return NT_STATUS_OK; 2046 2257 }
Note:
See TracChangeset
for help on using the changeset viewer.