Changeset 740 for vendor/current/source3/passdb/passdb.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/passdb/passdb.c
r427 r740 24 24 25 25 #include "includes.h" 26 #include "passdb.h" 27 #include "system/passwd.h" 26 28 #include "../libcli/auth/libcli_auth.h" 29 #include "secrets.h" 30 #include "../libcli/security/security.h" 31 #include "../lib/util/util_pw.h" 32 #include "util_tdb.h" 27 33 28 34 #undef DBGC_CLASS … … 146 152 const char *domain = global_myname(); 147 153 char *fullname; 148 uint32 urid;154 uint32_t urid; 149 155 150 156 if ( !pwd ) { … … 194 200 195 201 if ( strequal( pwd->pw_name, guest_account ) ) { 196 if ( !pdb_set_user_sid_from_rid(user, DOMAIN_ USER_RID_GUEST, PDB_DEFAULT)) {202 if ( !pdb_set_user_sid_from_rid(user, DOMAIN_RID_GUEST, PDB_DEFAULT)) { 197 203 return NT_STATUS_NO_SUCH_USER; 198 204 } … … 242 248 243 249 if ( create && (pdb_capabilities() & PDB_CAP_STORE_RIDS)) { 244 uint32 user_rid;245 DOM_SIDuser_sid;250 uint32_t user_rid; 251 struct dom_sid user_sid; 246 252 247 253 if ( !pdb_new_rid( &user_rid ) ) { … … 250 256 } 251 257 252 sid_copy( &user_sid, get_global_sam_sid() ); 253 sid_append_rid( &user_sid, user_rid ); 258 sid_compose(&user_sid, get_global_sam_sid(), user_rid); 254 259 255 260 if ( !pdb_set_user_sid(user, &user_sid, PDB_SET) ) { … … 373 378 **************************************************************/ 374 379 375 void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32 acct_ctrl)380 void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32_t acct_ctrl) 376 381 { 377 382 if (pwd != NULL) { … … 403 408 404 409 for (i = 0; i < 32; i += 2) { 405 hinybble = toupper_ ascii(p[i]);406 lonybble = toupper_ ascii(p[i + 1]);410 hinybble = toupper_m(p[i]); 411 lonybble = toupper_m(p[i + 1]); 407 412 408 413 p1 = strchr(hexchars, hinybble); … … 453 458 454 459 for (i = 0; i < 42; i += 2) { 455 hinybble = toupper_ ascii(p[i]);456 lonybble = toupper_ ascii(p[i + 1]);460 hinybble = toupper_m(p[i]); 461 lonybble = toupper_m(p[i + 1]); 457 462 458 463 p1 = strchr(hexchars, hinybble); … … 497 502 ********************************************************************/ 498 503 499 uid_t algorithmic_pdb_user_rid_to_uid(uint32 user_rid)504 uid_t algorithmic_pdb_user_rid_to_uid(uint32_t user_rid) 500 505 { 501 506 int rid_offset = algorithmic_rid_base(); … … 512 517 ********************************************************************/ 513 518 514 uint32 algorithmic_pdb_uid_to_user_rid(uid_t uid)519 uint32_t algorithmic_pdb_uid_to_user_rid(uid_t uid) 515 520 { 516 521 int rid_offset = algorithmic_rid_base(); 517 return (((((uint32 )uid)*RID_MULTIPLIER) + rid_offset) | USER_RID_TYPE);522 return (((((uint32_t)uid)*RID_MULTIPLIER) + rid_offset) | USER_RID_TYPE); 518 523 } 519 524 … … 522 527 ********************************************************************/ 523 528 524 gid_t pdb_group_rid_to_gid(uint32 group_rid)529 gid_t pdb_group_rid_to_gid(uint32_t group_rid) 525 530 { 526 531 int rid_offset = algorithmic_rid_base(); … … 541 546 ********************************************************************/ 542 547 543 uint32 algorithmic_pdb_gid_to_group_rid(gid_t gid)548 uint32_t algorithmic_pdb_gid_to_group_rid(gid_t gid) 544 549 { 545 550 int rid_offset = algorithmic_rid_base(); 546 return (((((uint32 )gid)*RID_MULTIPLIER) + rid_offset) | GROUP_RID_TYPE);551 return (((((uint32_t)gid)*RID_MULTIPLIER) + rid_offset) | GROUP_RID_TYPE); 547 552 } 548 553 … … 551 556 ********************************************************************/ 552 557 553 static bool rid_is_well_known(uint32 rid)558 static bool rid_is_well_known(uint32_t rid) 554 559 { 555 560 /* Not using rid_offset here, because this is the actual … … 563 568 ********************************************************************/ 564 569 565 bool algorithmic_pdb_rid_is_user(uint32 rid)570 bool algorithmic_pdb_rid_is_user(uint32_t rid) 566 571 { 567 572 if ( rid_is_well_known(rid) ) { 568 573 /* 569 * The only well known user RIDs are DOMAIN_ USER_RID_ADMIN570 * and DOMAIN_ USER_RID_GUEST.574 * The only well known user RIDs are DOMAIN_RID_ADMINISTRATOR 575 * and DOMAIN_RID_GUEST. 571 576 */ 572 if(rid == DOMAIN_ USER_RID_ADMIN || rid == DOMAIN_USER_RID_GUEST)577 if(rid == DOMAIN_RID_ADMINISTRATOR || rid == DOMAIN_RID_GUEST) 573 578 return True; 574 579 } else if((rid & RID_TYPE_MASK) == USER_RID_TYPE) { … … 594 599 595 600 if ( strequal( name, "None" ) ) { 596 *rid = DOMAIN_ GROUP_RID_USERS;601 *rid = DOMAIN_RID_USERS; 597 602 *type = SID_NAME_DOM_GRP; 598 603 … … 606 611 if ((flags & LOOKUP_NAME_GROUP) == 0) { 607 612 struct samu *sam_account = NULL; 608 DOM_SIDuser_sid;613 struct dom_sid user_sid; 609 614 610 615 if ( !(sam_account = samu_new( NULL )) ) { … … 927 932 *********************************************************************/ 928 933 929 static bool init_samu_from_buffer_v0(struct samu *sampass, uint8 *buf, uint32buflen)934 static bool init_samu_from_buffer_v0(struct samu *sampass, uint8_t *buf, uint32_t buflen) 930 935 { 931 936 … … 933 938 take care on system with 64bit wide time_t 934 939 --SSS */ 935 uint32 logon_time,940 uint32_t logon_time, 936 941 logoff_time, 937 942 kickoff_time, … … 951 956 char *acct_desc = NULL; 952 957 char *workstations = NULL; 953 uint32 username_len, domain_len, nt_username_len,958 uint32_t username_len, domain_len, nt_username_len, 954 959 dir_drive_len, unknown_str_len, munged_dial_len, 955 960 fullname_len, homedir_len, logon_script_len, 956 961 profile_path_len, acct_desc_len, workstations_len; 957 962 958 uint32 user_rid, group_rid, remove_me, hours_len, unknown_6;959 uint16 acct_ctrl, logon_divs;960 uint16 bad_password_count, logon_count;961 uint8 *hours = NULL;962 uint8 *lm_pw_ptr = NULL, *nt_pw_ptr = NULL;963 uint32 len = 0;964 uint32 lm_pw_len, nt_pw_len, hourslen;963 uint32_t user_rid, group_rid, remove_me, hours_len, unknown_6; 964 uint16_t acct_ctrl, logon_divs; 965 uint16_t bad_password_count, logon_count; 966 uint8_t *hours = NULL; 967 uint8_t *lm_pw_ptr = NULL, *nt_pw_ptr = NULL; 968 uint32_t len = 0; 969 uint32_t lm_pw_len, nt_pw_len, hourslen; 965 970 bool ret = True; 966 971 … … 1005 1010 &unknown_6); /* d */ 1006 1011 1007 if (len == (uint32 ) -1) {1012 if (len == (uint32_t) -1) { 1008 1013 ret = False; 1009 1014 goto done; … … 1086 1091 pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET); 1087 1092 pdb_set_logon_divs(sampass, logon_divs, PDB_SET); 1088 pdb_set_hours(sampass, hours, PDB_SET);1093 pdb_set_hours(sampass, hours, hours_len, PDB_SET); 1089 1094 1090 1095 done: … … 1112 1117 *********************************************************************/ 1113 1118 1114 static bool init_samu_from_buffer_v1(struct samu *sampass, uint8 *buf, uint32buflen)1119 static bool init_samu_from_buffer_v1(struct samu *sampass, uint8_t *buf, uint32_t buflen) 1115 1120 { 1116 1121 … … 1118 1123 take care on system with 64bit wide time_t 1119 1124 --SSS */ 1120 uint32 logon_time,1125 uint32_t logon_time, 1121 1126 logoff_time, 1122 1127 kickoff_time, … … 1137 1142 char *acct_desc = NULL; 1138 1143 char *workstations = NULL; 1139 uint32 username_len, domain_len, nt_username_len,1144 uint32_t username_len, domain_len, nt_username_len, 1140 1145 dir_drive_len, unknown_str_len, munged_dial_len, 1141 1146 fullname_len, homedir_len, logon_script_len, 1142 1147 profile_path_len, acct_desc_len, workstations_len; 1143 1148 1144 uint32 user_rid, group_rid, remove_me, hours_len, unknown_6;1145 uint16 acct_ctrl, logon_divs;1146 uint16 bad_password_count, logon_count;1147 uint8 *hours = NULL;1148 uint8 *lm_pw_ptr = NULL, *nt_pw_ptr = NULL;1149 uint32 len = 0;1150 uint32 lm_pw_len, nt_pw_len, hourslen;1149 uint32_t user_rid, group_rid, remove_me, hours_len, unknown_6; 1150 uint16_t acct_ctrl, logon_divs; 1151 uint16_t bad_password_count, logon_count; 1152 uint8_t *hours = NULL; 1153 uint8_t *lm_pw_ptr = NULL, *nt_pw_ptr = NULL; 1154 uint32_t len = 0; 1155 uint32_t lm_pw_len, nt_pw_len, hourslen; 1151 1156 bool ret = True; 1152 1157 … … 1193 1198 &unknown_6); /* d */ 1194 1199 1195 if (len == (uint32 ) -1) {1200 if (len == (uint32_t) -1) { 1196 1201 ret = False; 1197 1202 goto done; … … 1278 1283 pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET); 1279 1284 pdb_set_logon_divs(sampass, logon_divs, PDB_SET); 1280 pdb_set_hours(sampass, hours, PDB_SET);1285 pdb_set_hours(sampass, hours, hours_len, PDB_SET); 1281 1286 1282 1287 done: … … 1301 1306 } 1302 1307 1303 static bool init_samu_from_buffer_v2(struct samu *sampass, uint8 *buf, uint32buflen)1308 static bool init_samu_from_buffer_v2(struct samu *sampass, uint8_t *buf, uint32_t buflen) 1304 1309 { 1305 1310 … … 1307 1312 take care on system with 64bit wide time_t 1308 1313 --SSS */ 1309 uint32 logon_time,1314 uint32_t logon_time, 1310 1315 logoff_time, 1311 1316 kickoff_time, … … 1326 1331 char *acct_desc = NULL; 1327 1332 char *workstations = NULL; 1328 uint32 username_len, domain_len, nt_username_len,1333 uint32_t username_len, domain_len, nt_username_len, 1329 1334 dir_drive_len, unknown_str_len, munged_dial_len, 1330 1335 fullname_len, homedir_len, logon_script_len, 1331 1336 profile_path_len, acct_desc_len, workstations_len; 1332 1337 1333 uint32 user_rid, group_rid, hours_len, unknown_6;1334 uint16 acct_ctrl, logon_divs;1335 uint16 bad_password_count, logon_count;1336 uint8 *hours = NULL;1337 uint8 *lm_pw_ptr = NULL, *nt_pw_ptr = NULL, *nt_pw_hist_ptr = NULL;1338 uint32 len = 0;1339 uint32 lm_pw_len, nt_pw_len, nt_pw_hist_len, hourslen;1340 uint32 pwHistLen = 0;1338 uint32_t user_rid, group_rid, hours_len, unknown_6; 1339 uint16_t acct_ctrl, logon_divs; 1340 uint16_t bad_password_count, logon_count; 1341 uint8_t *hours = NULL; 1342 uint8_t *lm_pw_ptr = NULL, *nt_pw_ptr = NULL, *nt_pw_hist_ptr = NULL; 1343 uint32_t len = 0; 1344 uint32_t lm_pw_len, nt_pw_len, nt_pw_hist_len, hourslen; 1345 uint32_t pwHistLen = 0; 1341 1346 bool ret = True; 1342 1347 fstring tmp_string; … … 1386 1391 &unknown_6); /* d */ 1387 1392 1388 if (len == (uint32 ) -1) {1393 if (len == (uint32_t) -1) { 1389 1394 ret = False; 1390 1395 goto done; … … 1475 1480 pdb_get_account_policy(PDB_POLICY_PASSWORD_HISTORY, &pwHistLen); 1476 1481 if (pwHistLen) { 1477 uint8 *pw_hist = SMB_MALLOC_ARRAY(uint8, pwHistLen * PW_HISTORY_ENTRY_LEN);1482 uint8_t *pw_hist = SMB_MALLOC_ARRAY(uint8_t, pwHistLen * PW_HISTORY_ENTRY_LEN); 1478 1483 if (!pw_hist) { 1479 1484 ret = False; … … 1509 1514 pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET); 1510 1515 pdb_set_logon_divs(sampass, logon_divs, PDB_SET); 1511 pdb_set_hours(sampass, hours, PDB_SET);1516 pdb_set_hours(sampass, hours, hours_len, PDB_SET); 1512 1517 1513 1518 done: … … 1536 1541 *********************************************************************/ 1537 1542 1538 static bool init_samu_from_buffer_v3(struct samu *sampass, uint8 *buf, uint32buflen)1543 static bool init_samu_from_buffer_v3(struct samu *sampass, uint8_t *buf, uint32_t buflen) 1539 1544 { 1540 1545 … … 1542 1547 take care on system with 64bit wide time_t 1543 1548 --SSS */ 1544 uint32 logon_time,1549 uint32_t logon_time, 1545 1550 logoff_time, 1546 1551 kickoff_time, … … 1561 1566 char *acct_desc = NULL; 1562 1567 char *workstations = NULL; 1563 uint32 username_len, domain_len, nt_username_len,1568 uint32_t username_len, domain_len, nt_username_len, 1564 1569 dir_drive_len, comment_len, munged_dial_len, 1565 1570 fullname_len, homedir_len, logon_script_len, 1566 1571 profile_path_len, acct_desc_len, workstations_len; 1567 1572 1568 uint32 user_rid, group_rid, hours_len, unknown_6, acct_ctrl;1569 uint16 logon_divs;1570 uint16 bad_password_count, logon_count;1571 uint8 *hours = NULL;1572 uint8 *lm_pw_ptr = NULL, *nt_pw_ptr = NULL, *nt_pw_hist_ptr = NULL;1573 uint32 len = 0;1574 uint32 lm_pw_len, nt_pw_len, nt_pw_hist_len, hourslen;1575 uint32 pwHistLen = 0;1573 uint32_t user_rid, group_rid, hours_len, unknown_6, acct_ctrl; 1574 uint16_t logon_divs; 1575 uint16_t bad_password_count, logon_count; 1576 uint8_t *hours = NULL; 1577 uint8_t *lm_pw_ptr = NULL, *nt_pw_ptr = NULL, *nt_pw_hist_ptr = NULL; 1578 uint32_t len = 0; 1579 uint32_t lm_pw_len, nt_pw_len, nt_pw_hist_len, hourslen; 1580 uint32_t pwHistLen = 0; 1576 1581 bool ret = True; 1577 1582 fstring tmp_string; … … 1612 1617 /* Change from V1 is addition of password history field. */ 1613 1618 &nt_pw_hist_len, &nt_pw_hist_ptr, /* B */ 1614 /* Change from V2 is the uint32 acb_mask */1619 /* Change from V2 is the uint32_t acb_mask */ 1615 1620 &acct_ctrl, /* d */ 1616 1621 /* Also "remove_me" field was removed. */ … … 1622 1627 &unknown_6); /* d */ 1623 1628 1624 if (len == (uint32 ) -1) {1629 if (len == (uint32_t) -1) { 1625 1630 ret = False; 1626 1631 goto done; 1627 1632 } 1628 1633 1629 pdb_set_logon_time(sampass, convert_uint32_t o_time_t(logon_time), PDB_SET);1630 pdb_set_logoff_time(sampass, convert_uint32_t o_time_t(logoff_time), PDB_SET);1631 pdb_set_kickoff_time(sampass, convert_uint32_t o_time_t(kickoff_time), PDB_SET);1632 pdb_set_bad_password_time(sampass, convert_uint32_t o_time_t(bad_password_time), PDB_SET);1633 pdb_set_pass_can_change_time(sampass, convert_uint32_t o_time_t(pass_can_change_time), PDB_SET);1634 pdb_set_pass_must_change_time(sampass, convert_uint32_t o_time_t(pass_must_change_time), PDB_SET);1635 pdb_set_pass_last_set_time(sampass, convert_uint32_t o_time_t(pass_last_set_time), PDB_SET);1634 pdb_set_logon_time(sampass, convert_uint32_t_to_time_t(logon_time), PDB_SET); 1635 pdb_set_logoff_time(sampass, convert_uint32_t_to_time_t(logoff_time), PDB_SET); 1636 pdb_set_kickoff_time(sampass, convert_uint32_t_to_time_t(kickoff_time), PDB_SET); 1637 pdb_set_bad_password_time(sampass, convert_uint32_t_to_time_t(bad_password_time), PDB_SET); 1638 pdb_set_pass_can_change_time(sampass, convert_uint32_t_to_time_t(pass_can_change_time), PDB_SET); 1639 pdb_set_pass_must_change_time(sampass, convert_uint32_t_to_time_t(pass_must_change_time), PDB_SET); 1640 pdb_set_pass_last_set_time(sampass, convert_uint32_t_to_time_t(pass_last_set_time), PDB_SET); 1636 1641 1637 1642 pdb_set_username(sampass, username, PDB_SET); … … 1710 1715 pdb_get_account_policy(PDB_POLICY_PASSWORD_HISTORY, &pwHistLen); 1711 1716 if (pwHistLen) { 1712 uint8 *pw_hist = (uint8*)SMB_MALLOC(pwHistLen * PW_HISTORY_ENTRY_LEN);1717 uint8_t *pw_hist = (uint8_t *)SMB_MALLOC(pwHistLen * PW_HISTORY_ENTRY_LEN); 1713 1718 if (!pw_hist) { 1714 1719 ret = False; … … 1741 1746 pdb_set_logon_count(sampass, logon_count, PDB_SET); 1742 1747 pdb_set_unknown_6(sampass, unknown_6, PDB_SET); 1743 /* Change from V2 is the uint32 acct_ctrl */1748 /* Change from V2 is the uint32_t acct_ctrl */ 1744 1749 pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET); 1745 1750 pdb_set_logon_divs(sampass, logon_divs, PDB_SET); 1746 pdb_set_hours(sampass, hours, PDB_SET);1751 pdb_set_hours(sampass, hours, hours_len, PDB_SET); 1747 1752 1748 1753 done: … … 1771 1776 *********************************************************************/ 1772 1777 1773 static uint32 init_buffer_from_samu_v3 (uint8**buf, struct samu *sampass, bool size_only)1778 static uint32_t init_buffer_from_samu_v3 (uint8_t **buf, struct samu *sampass, bool size_only) 1774 1779 { 1775 1780 size_t len, buflen; … … 1778 1783 take care on system with 64bit wide time_t 1779 1784 --SSS */ 1780 uint32 logon_time,1785 uint32_t logon_time, 1781 1786 logoff_time, 1782 1787 kickoff_time, … … 1786 1791 pass_must_change_time; 1787 1792 1788 uint32 user_rid, group_rid;1793 uint32_t user_rid, group_rid; 1789 1794 1790 1795 const char *username; … … 1800 1805 const char *acct_desc; 1801 1806 const char *workstations; 1802 uint32 username_len, domain_len, nt_username_len,1807 uint32_t username_len, domain_len, nt_username_len, 1803 1808 dir_drive_len, comment_len, munged_dial_len, 1804 1809 fullname_len, homedir_len, logon_script_len, 1805 1810 profile_path_len, acct_desc_len, workstations_len; 1806 1811 1807 const uint8 *lm_pw;1808 const uint8 *nt_pw;1809 const uint8 *nt_pw_hist;1810 uint32 lm_pw_len = 16;1811 uint32 nt_pw_len = 16;1812 uint32 nt_pw_hist_len;1813 uint32 pwHistLen = 0;1812 const uint8_t *lm_pw; 1813 const uint8_t *nt_pw; 1814 const uint8_t *nt_pw_hist; 1815 uint32_t lm_pw_len = 16; 1816 uint32_t nt_pw_len = 16; 1817 uint32_t nt_pw_hist_len; 1818 uint32_t pwHistLen = 0; 1814 1819 1815 1820 *buf = NULL; 1816 1821 buflen = 0; 1817 1822 1818 logon_time = convert_time_t_to_uint32 (pdb_get_logon_time(sampass));1819 logoff_time = convert_time_t_to_uint32 (pdb_get_logoff_time(sampass));1820 kickoff_time = convert_time_t_to_uint32 (pdb_get_kickoff_time(sampass));1821 bad_password_time = convert_time_t_to_uint32 (pdb_get_bad_password_time(sampass));1822 pass_can_change_time = convert_time_t_to_uint32 (pdb_get_pass_can_change_time_noncalc(sampass));1823 pass_must_change_time = convert_time_t_to_uint32 (pdb_get_pass_must_change_time(sampass));1824 pass_last_set_time = convert_time_t_to_uint32 (pdb_get_pass_last_set_time(sampass));1823 logon_time = convert_time_t_to_uint32_t(pdb_get_logon_time(sampass)); 1824 logoff_time = convert_time_t_to_uint32_t(pdb_get_logoff_time(sampass)); 1825 kickoff_time = convert_time_t_to_uint32_t(pdb_get_kickoff_time(sampass)); 1826 bad_password_time = convert_time_t_to_uint32_t(pdb_get_bad_password_time(sampass)); 1827 pass_can_change_time = convert_time_t_to_uint32_t(pdb_get_pass_can_change_time_noncalc(sampass)); 1828 pass_must_change_time = convert_time_t_to_uint32_t(pdb_get_pass_must_change_time(sampass)); 1829 pass_last_set_time = convert_time_t_to_uint32_t(pdb_get_pass_last_set_time(sampass)); 1825 1830 1826 1831 user_rid = pdb_get_user_rid(sampass); … … 1990 1995 1991 1996 /* malloc the space needed */ 1992 if ( (*buf=(uint8 *)SMB_MALLOC(len)) == NULL) {1997 if ( (*buf=(uint8_t*)SMB_MALLOC(len)) == NULL) { 1993 1998 DEBUG(0,("init_buffer_from_samu_v3: Unable to malloc() memory for buffer!\n")); 1994 1999 return (-1); … … 2041 2046 } 2042 2047 2043 static bool init_samu_from_buffer_v4(struct samu *sampass, uint8 *buf, uint32buflen)2048 static bool init_samu_from_buffer_v4(struct samu *sampass, uint8_t *buf, uint32_t buflen) 2044 2049 { 2045 2050 /* nothing changed between V3 and V4 */ … … 2047 2052 } 2048 2053 2049 static uint32 init_buffer_from_samu_v4(uint8**buf, struct samu *sampass, bool size_only)2054 static uint32_t init_buffer_from_samu_v4(uint8_t **buf, struct samu *sampass, bool size_only) 2050 2055 { 2051 2056 /* nothing changed between V3 and V4 */ … … 2058 2063 2059 2064 bool init_samu_from_buffer(struct samu *sampass, uint32_t level, 2060 uint8 *buf, uint32buflen)2065 uint8_t *buf, uint32_t buflen) 2061 2066 { 2062 2067 switch (level) { … … 2080 2085 *********************************************************************/ 2081 2086 2082 uint32 init_buffer_from_samu (uint8**buf, struct samu *sampass, bool size_only)2087 uint32_t init_buffer_from_samu (uint8_t **buf, struct samu *sampass, bool size_only) 2083 2088 { 2084 2089 return init_buffer_from_samu_v4(buf, sampass, size_only); … … 2090 2095 bool pdb_copy_sam_account(struct samu *dst, struct samu *src ) 2091 2096 { 2092 uint8 *buf = NULL;2097 uint8_t *buf = NULL; 2093 2098 int len; 2094 2099 … … 2129 2134 { 2130 2135 time_t LastBadPassword; 2131 uint16 BadPasswordCount;2132 uint32 resettime;2136 uint16_t BadPasswordCount; 2137 uint32_t resettime; 2133 2138 bool res; 2134 2139 … … 2149 2154 2150 2155 /* First, check if there is a reset time to compare */ 2151 if ((resettime == (uint32 ) -1) || (resettime == 0)) {2156 if ((resettime == (uint32_t) -1) || (resettime == 0)) { 2152 2157 DEBUG(9, ("No reset time, can't reset bad pw count\n")); 2153 2158 return True; … … 2156 2161 LastBadPassword = pdb_get_bad_password_time(sampass); 2157 2162 DEBUG(7, ("LastBadPassword=%d, resettime=%d, current time=%d.\n", 2158 (uint32 ) LastBadPassword, resettime, (uint32)time(NULL)));2159 if (time(NULL) > (LastBadPassword + convert_uint32_t o_time_t(resettime)*60)){2163 (uint32_t) LastBadPassword, resettime, (uint32_t)time(NULL))); 2164 if (time(NULL) > (LastBadPassword + convert_uint32_t_to_time_t(resettime)*60)){ 2160 2165 pdb_set_bad_password_count(sampass, 0, PDB_CHANGED); 2161 2166 pdb_set_bad_password_time(sampass, 0, PDB_CHANGED); … … 2174 2179 bool pdb_update_autolock_flag(struct samu *sampass, bool *updated) 2175 2180 { 2176 uint32 duration;2181 uint32_t duration; 2177 2182 time_t LastBadPassword; 2178 2183 bool res; … … 2194 2199 2195 2200 /* First, check if there is a duration to compare */ 2196 if ((duration == (uint32 ) -1) || (duration == 0)) {2201 if ((duration == (uint32_t) -1) || (duration == 0)) { 2197 2202 DEBUG(9, ("pdb_update_autolock_flag: No reset duration, can't reset autolock\n")); 2198 2203 return True; … … 2201 2206 LastBadPassword = pdb_get_bad_password_time(sampass); 2202 2207 DEBUG(7, ("pdb_update_autolock_flag: Account %s, LastBadPassword=%d, duration=%d, current time =%d.\n", 2203 pdb_get_username(sampass), (uint32 )LastBadPassword, duration*60, (uint32)time(NULL)));2208 pdb_get_username(sampass), (uint32_t)LastBadPassword, duration*60, (uint32_t)time(NULL))); 2204 2209 2205 2210 if (LastBadPassword == (time_t)0) { … … 2211 2216 } 2212 2217 2213 if ((time(NULL) > (LastBadPassword + convert_uint32_t o_time_t(duration) * 60))) {2218 if ((time(NULL) > (LastBadPassword + convert_uint32_t_to_time_t(duration) * 60))) { 2214 2219 pdb_set_acct_ctrl(sampass, 2215 2220 pdb_get_acct_ctrl(sampass) & ~ACB_AUTOLOCK, … … 2231 2236 bool pdb_increment_bad_password_count(struct samu *sampass) 2232 2237 { 2233 uint32 account_policy_lockout;2238 uint32_t account_policy_lockout; 2234 2239 bool autolock_updated = False, badpw_updated = False; 2235 2240 bool ret; … … 2367 2372 *******************************************************************/ 2368 2373 2369 bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],2374 bool get_trust_pw_hash(const char *domain, uint8_t ret_pwd[16], 2370 2375 const char **account_name, 2371 2376 enum netr_SchannelType *channel) … … 2399 2404 return False; 2400 2405 } 2401 2402 struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,2403 struct samu *pw)2404 {2405 struct samr_LogonHours hours;2406 const int units_per_week = 168;2407 2408 ZERO_STRUCT(hours);2409 hours.bits = talloc_array(mem_ctx, uint8_t, units_per_week);2410 if (!hours.bits) {2411 return hours;2412 }2413 2414 hours.units_per_week = units_per_week;2415 memset(hours.bits, 0xFF, units_per_week);2416 2417 if (pdb_get_hours(pw)) {2418 memcpy(hours.bits, pdb_get_hours(pw),2419 MIN(pdb_get_hours_len(pw), units_per_week));2420 }2421 2422 return hours;2423 }
Note:
See TracChangeset
for help on using the changeset viewer.