Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/passdb/passdb.c

    r427 r740  
    2424
    2525#include "includes.h"
     26#include "passdb.h"
     27#include "system/passwd.h"
    2628#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"
    2733
    2834#undef DBGC_CLASS
     
    146152        const char *domain = global_myname();
    147153        char *fullname;
    148         uint32 urid;
     154        uint32_t urid;
    149155
    150156        if ( !pwd ) {
     
    194200
    195201        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)) {
    197203                        return NT_STATUS_NO_SUCH_USER;
    198204                }
     
    242248
    243249        if ( create && (pdb_capabilities() & PDB_CAP_STORE_RIDS)) {
    244                 uint32 user_rid;
    245                 DOM_SID user_sid;
     250                uint32_t user_rid;
     251                struct dom_sid user_sid;
    246252
    247253                if ( !pdb_new_rid( &user_rid ) ) {
     
    250256                }
    251257
    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);
    254259
    255260                if ( !pdb_set_user_sid(user, &user_sid, PDB_SET) ) {
     
    373378**************************************************************/
    374379
    375 void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32 acct_ctrl)
     380void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32_t acct_ctrl)
    376381{
    377382        if (pwd != NULL) {
     
    403408
    404409        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]);
    407412
    408413                p1 = strchr(hexchars, hinybble);
     
    453458
    454459        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]);
    457462
    458463                p1 = strchr(hexchars, hinybble);
     
    497502 ********************************************************************/
    498503
    499 uid_t algorithmic_pdb_user_rid_to_uid(uint32 user_rid)
     504uid_t algorithmic_pdb_user_rid_to_uid(uint32_t user_rid)
    500505{
    501506        int rid_offset = algorithmic_rid_base();
     
    512517 ********************************************************************/
    513518
    514 uint32 algorithmic_pdb_uid_to_user_rid(uid_t uid)
     519uint32_t algorithmic_pdb_uid_to_user_rid(uid_t uid)
    515520{
    516521        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);
    518523}
    519524
     
    522527 ********************************************************************/
    523528
    524 gid_t pdb_group_rid_to_gid(uint32 group_rid)
     529gid_t pdb_group_rid_to_gid(uint32_t group_rid)
    525530{
    526531        int rid_offset = algorithmic_rid_base();
     
    541546 ********************************************************************/
    542547
    543 uint32 algorithmic_pdb_gid_to_group_rid(gid_t gid)
     548uint32_t algorithmic_pdb_gid_to_group_rid(gid_t gid)
    544549{
    545550        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);
    547552}
    548553
     
    551556 ********************************************************************/
    552557
    553 static bool rid_is_well_known(uint32 rid)
     558static bool rid_is_well_known(uint32_t rid)
    554559{
    555560        /* Not using rid_offset here, because this is the actual
     
    563568 ********************************************************************/
    564569
    565 bool algorithmic_pdb_rid_is_user(uint32 rid)
     570bool algorithmic_pdb_rid_is_user(uint32_t rid)
    566571{
    567572        if ( rid_is_well_known(rid) ) {
    568573                /*
    569                  * The only well known user RIDs are DOMAIN_USER_RID_ADMIN
    570                  * and DOMAIN_USER_RID_GUEST.
     574                 * The only well known user RIDs are DOMAIN_RID_ADMINISTRATOR
     575                 * and DOMAIN_RID_GUEST.
    571576                 */
    572                 if(rid == DOMAIN_USER_RID_ADMIN || rid == DOMAIN_USER_RID_GUEST)
     577                if(rid == DOMAIN_RID_ADMINISTRATOR || rid == DOMAIN_RID_GUEST)
    573578                        return True;
    574579        } else if((rid & RID_TYPE_MASK) == USER_RID_TYPE) {
     
    594599
    595600        if ( strequal( name, "None" ) ) {
    596                 *rid = DOMAIN_GROUP_RID_USERS;
     601                *rid = DOMAIN_RID_USERS;
    597602                *type = SID_NAME_DOM_GRP;
    598603
     
    606611        if ((flags & LOOKUP_NAME_GROUP) == 0) {
    607612                struct samu *sam_account = NULL;
    608                 DOM_SID user_sid;
     613                struct dom_sid user_sid;
    609614
    610615                if ( !(sam_account = samu_new( NULL )) ) {
     
    927932*********************************************************************/
    928933
    929 static bool init_samu_from_buffer_v0(struct samu *sampass, uint8 *buf, uint32 buflen)
     934static bool init_samu_from_buffer_v0(struct samu *sampass, uint8_t *buf, uint32_t buflen)
    930935{
    931936
     
    933938           take care on system with 64bit wide time_t
    934939           --SSS */
    935         uint32  logon_time,
     940        uint32_t        logon_time,
    936941                logoff_time,
    937942                kickoff_time,
     
    951956        char *acct_desc = NULL;
    952957        char *workstations = NULL;
    953         uint32  username_len, domain_len, nt_username_len,
     958        uint32_t        username_len, domain_len, nt_username_len,
    954959                dir_drive_len, unknown_str_len, munged_dial_len,
    955960                fullname_len, homedir_len, logon_script_len,
    956961                profile_path_len, acct_desc_len, workstations_len;
    957962
    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;
    965970        bool ret = True;
    966971
     
    10051010                &unknown_6);                                            /* d */
    10061011
    1007         if (len == (uint32) -1)  {
     1012        if (len == (uint32_t) -1)  {
    10081013                ret = False;
    10091014                goto done;
     
    10861091        pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
    10871092        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);
    10891094
    10901095done:
     
    11121117*********************************************************************/
    11131118
    1114 static bool init_samu_from_buffer_v1(struct samu *sampass, uint8 *buf, uint32 buflen)
     1119static bool init_samu_from_buffer_v1(struct samu *sampass, uint8_t *buf, uint32_t buflen)
    11151120{
    11161121
     
    11181123           take care on system with 64bit wide time_t
    11191124           --SSS */
    1120         uint32  logon_time,
     1125        uint32_t        logon_time,
    11211126                logoff_time,
    11221127                kickoff_time,
     
    11371142        char *acct_desc = NULL;
    11381143        char *workstations = NULL;
    1139         uint32  username_len, domain_len, nt_username_len,
     1144        uint32_t        username_len, domain_len, nt_username_len,
    11401145                dir_drive_len, unknown_str_len, munged_dial_len,
    11411146                fullname_len, homedir_len, logon_script_len,
    11421147                profile_path_len, acct_desc_len, workstations_len;
    11431148
    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;
    11511156        bool ret = True;
    11521157
     
    11931198                &unknown_6);                                            /* d */
    11941199
    1195         if (len == (uint32) -1)  {
     1200        if (len == (uint32_t) -1)  {
    11961201                ret = False;
    11971202                goto done;
     
    12781283        pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
    12791284        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);
    12811286
    12821287done:
     
    13011306}
    13021307
    1303 static bool init_samu_from_buffer_v2(struct samu *sampass, uint8 *buf, uint32 buflen)
     1308static bool init_samu_from_buffer_v2(struct samu *sampass, uint8_t *buf, uint32_t buflen)
    13041309{
    13051310
     
    13071312           take care on system with 64bit wide time_t
    13081313           --SSS */
    1309         uint32  logon_time,
     1314        uint32_t        logon_time,
    13101315                logoff_time,
    13111316                kickoff_time,
     
    13261331        char *acct_desc = NULL;
    13271332        char *workstations = NULL;
    1328         uint32  username_len, domain_len, nt_username_len,
     1333        uint32_t        username_len, domain_len, nt_username_len,
    13291334                dir_drive_len, unknown_str_len, munged_dial_len,
    13301335                fullname_len, homedir_len, logon_script_len,
    13311336                profile_path_len, acct_desc_len, workstations_len;
    13321337
    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;
    13411346        bool ret = True;
    13421347        fstring tmp_string;
     
    13861391                &unknown_6);                                            /* d */
    13871392
    1388         if (len == (uint32) -1)  {
     1393        if (len == (uint32_t) -1)  {
    13891394                ret = False;
    13901395                goto done;
     
    14751480        pdb_get_account_policy(PDB_POLICY_PASSWORD_HISTORY, &pwHistLen);
    14761481        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);
    14781483                if (!pw_hist) {
    14791484                        ret = False;
     
    15091514        pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
    15101515        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);
    15121517
    15131518done:
     
    15361541*********************************************************************/
    15371542
    1538 static bool init_samu_from_buffer_v3(struct samu *sampass, uint8 *buf, uint32 buflen)
     1543static bool init_samu_from_buffer_v3(struct samu *sampass, uint8_t *buf, uint32_t buflen)
    15391544{
    15401545
     
    15421547           take care on system with 64bit wide time_t
    15431548           --SSS */
    1544         uint32  logon_time,
     1549        uint32_t        logon_time,
    15451550                logoff_time,
    15461551                kickoff_time,
     
    15611566        char *acct_desc = NULL;
    15621567        char *workstations = NULL;
    1563         uint32  username_len, domain_len, nt_username_len,
     1568        uint32_t        username_len, domain_len, nt_username_len,
    15641569                dir_drive_len, comment_len, munged_dial_len,
    15651570                fullname_len, homedir_len, logon_script_len,
    15661571                profile_path_len, acct_desc_len, workstations_len;
    15671572
    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;
    15761581        bool ret = True;
    15771582        fstring tmp_string;
     
    16121617                /* Change from V1 is addition of password history field. */
    16131618                &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 */
    16151620                &acct_ctrl,                                             /* d */
    16161621                /* Also "remove_me" field was removed. */
     
    16221627                &unknown_6);                                            /* d */
    16231628
    1624         if (len == (uint32) -1)  {
     1629        if (len == (uint32_t) -1)  {
    16251630                ret = False;
    16261631                goto done;
    16271632        }
    16281633
    1629         pdb_set_logon_time(sampass, convert_uint32_to_time_t(logon_time), PDB_SET);
    1630         pdb_set_logoff_time(sampass, convert_uint32_to_time_t(logoff_time), PDB_SET);
    1631         pdb_set_kickoff_time(sampass, convert_uint32_to_time_t(kickoff_time), PDB_SET);
    1632         pdb_set_bad_password_time(sampass, convert_uint32_to_time_t(bad_password_time), PDB_SET);
    1633         pdb_set_pass_can_change_time(sampass, convert_uint32_to_time_t(pass_can_change_time), PDB_SET);
    1634         pdb_set_pass_must_change_time(sampass, convert_uint32_to_time_t(pass_must_change_time), PDB_SET);
    1635         pdb_set_pass_last_set_time(sampass, convert_uint32_to_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);
    16361641
    16371642        pdb_set_username(sampass, username, PDB_SET);
     
    17101715        pdb_get_account_policy(PDB_POLICY_PASSWORD_HISTORY, &pwHistLen);
    17111716        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);
    17131718                if (!pw_hist) {
    17141719                        ret = False;
     
    17411746        pdb_set_logon_count(sampass, logon_count, PDB_SET);
    17421747        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 */
    17441749        pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
    17451750        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);
    17471752
    17481753done:
     
    17711776*********************************************************************/
    17721777
    1773 static uint32 init_buffer_from_samu_v3 (uint8 **buf, struct samu *sampass, bool size_only)
     1778static uint32_t init_buffer_from_samu_v3 (uint8_t **buf, struct samu *sampass, bool size_only)
    17741779{
    17751780        size_t len, buflen;
     
    17781783           take care on system with 64bit wide time_t
    17791784           --SSS */
    1780         uint32  logon_time,
     1785        uint32_t        logon_time,
    17811786                logoff_time,
    17821787                kickoff_time,
     
    17861791                pass_must_change_time;
    17871792
    1788         uint32  user_rid, group_rid;
     1793        uint32_t  user_rid, group_rid;
    17891794
    17901795        const char *username;
     
    18001805        const char *acct_desc;
    18011806        const char *workstations;
    1802         uint32  username_len, domain_len, nt_username_len,
     1807        uint32_t        username_len, domain_len, nt_username_len,
    18031808                dir_drive_len, comment_len, munged_dial_len,
    18041809                fullname_len, homedir_len, logon_script_len,
    18051810                profile_path_len, acct_desc_len, workstations_len;
    18061811
    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;
    18141819
    18151820        *buf = NULL;
    18161821        buflen = 0;
    18171822
    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));
    18251830
    18261831        user_rid = pdb_get_user_rid(sampass);
     
    19901995
    19911996        /* malloc the space needed */
    1992         if ( (*buf=(uint8*)SMB_MALLOC(len)) == NULL) {
     1997        if ( (*buf=(uint8_t*)SMB_MALLOC(len)) == NULL) {
    19931998                DEBUG(0,("init_buffer_from_samu_v3: Unable to malloc() memory for buffer!\n"));
    19941999                return (-1);
     
    20412046}
    20422047
    2043 static bool init_samu_from_buffer_v4(struct samu *sampass, uint8 *buf, uint32 buflen)
     2048static bool init_samu_from_buffer_v4(struct samu *sampass, uint8_t *buf, uint32_t buflen)
    20442049{
    20452050        /* nothing changed between V3 and V4 */
     
    20472052}
    20482053
    2049 static uint32 init_buffer_from_samu_v4(uint8 **buf, struct samu *sampass, bool size_only)
     2054static uint32_t init_buffer_from_samu_v4(uint8_t **buf, struct samu *sampass, bool size_only)
    20502055{
    20512056        /* nothing changed between V3 and V4 */
     
    20582063
    20592064bool init_samu_from_buffer(struct samu *sampass, uint32_t level,
    2060                            uint8 *buf, uint32 buflen)
     2065                           uint8_t *buf, uint32_t buflen)
    20612066{
    20622067        switch (level) {
     
    20802085 *********************************************************************/
    20812086
    2082 uint32 init_buffer_from_samu (uint8 **buf, struct samu *sampass, bool size_only)
     2087uint32_t init_buffer_from_samu (uint8_t **buf, struct samu *sampass, bool size_only)
    20832088{
    20842089        return init_buffer_from_samu_v4(buf, sampass, size_only);
     
    20902095bool pdb_copy_sam_account(struct samu *dst, struct samu *src )
    20912096{
    2092         uint8 *buf = NULL;
     2097        uint8_t *buf = NULL;
    20932098        int len;
    20942099
     
    21292134{
    21302135        time_t LastBadPassword;
    2131         uint16 BadPasswordCount;
    2132         uint32 resettime;
     2136        uint16_t BadPasswordCount;
     2137        uint32_t resettime;
    21332138        bool res;
    21342139
     
    21492154
    21502155        /* 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)) {
    21522157                DEBUG(9, ("No reset time, can't reset bad pw count\n"));
    21532158                return True;
     
    21562161        LastBadPassword = pdb_get_bad_password_time(sampass);
    21572162        DEBUG(7, ("LastBadPassword=%d, resettime=%d, current time=%d.\n",
    2158                    (uint32) LastBadPassword, resettime, (uint32)time(NULL)));
    2159         if (time(NULL) > (LastBadPassword + convert_uint32_to_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)){
    21602165                pdb_set_bad_password_count(sampass, 0, PDB_CHANGED);
    21612166                pdb_set_bad_password_time(sampass, 0, PDB_CHANGED);
     
    21742179bool pdb_update_autolock_flag(struct samu *sampass, bool *updated)
    21752180{
    2176         uint32 duration;
     2181        uint32_t duration;
    21772182        time_t LastBadPassword;
    21782183        bool res;
     
    21942199
    21952200        /* First, check if there is a duration to compare */
    2196         if ((duration == (uint32) -1)  || (duration == 0)) {
     2201        if ((duration == (uint32_t) -1)  || (duration == 0)) {
    21972202                DEBUG(9, ("pdb_update_autolock_flag: No reset duration, can't reset autolock\n"));
    21982203                return True;
     
    22012206        LastBadPassword = pdb_get_bad_password_time(sampass);
    22022207        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)));
    22042209
    22052210        if (LastBadPassword == (time_t)0) {
     
    22112216        }
    22122217
    2213         if ((time(NULL) > (LastBadPassword + convert_uint32_to_time_t(duration) * 60))) {
     2218        if ((time(NULL) > (LastBadPassword + convert_uint32_t_to_time_t(duration) * 60))) {
    22142219                pdb_set_acct_ctrl(sampass,
    22152220                                  pdb_get_acct_ctrl(sampass) & ~ACB_AUTOLOCK,
     
    22312236bool pdb_increment_bad_password_count(struct samu *sampass)
    22322237{
    2233         uint32 account_policy_lockout;
     2238        uint32_t account_policy_lockout;
    22342239        bool autolock_updated = False, badpw_updated = False;
    22352240        bool ret;
     
    23672372*******************************************************************/
    23682373
    2369 bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],
     2374bool get_trust_pw_hash(const char *domain, uint8_t ret_pwd[16],
    23702375                       const char **account_name,
    23712376                       enum netr_SchannelType *channel)
     
    23992404        return False;
    24002405}
    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.