Ignore:
Timestamp:
May 24, 2009, 7:55:48 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 branch to 3.3.4

Location:
branches/samba-3.3.x/source/rpc_server
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/rpc_server/srv_lsa_nt.c

    r223 r224  
    829829                                           &mapped_count);
    830830
    831         if (NT_STATUS_IS_ERR(status)) {
     831        /* Only return here when there is a real error.
     832           NT_STATUS_NONE_MAPPED is a special case as it indicates that none of
     833           the requested sids could be resolved. Older versions of XP (pre SP3)
     834           rely that we return with the string representations of those SIDs in
     835           that case. If we don't, XP crashes - Guenther
     836           */
     837
     838        if (NT_STATUS_IS_ERR(status) &&
     839            !NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
    832840                return status;
    833841        }
  • branches/samba-3.3.x/source/rpc_server/srv_pipe.c

    r222 r224  
    995995        for (i=0; i<rpc_lookup_size; i++) {
    996996                DEBUGADD(10, ("checking %s\n", rpc_lookup[i].pipe.clnt));
    997                 if (strequal(rpc_lookup[i].pipe.clnt, p->name)
    998                     && ndr_syntax_id_equal(
     997                if (ndr_syntax_id_equal(
    999998                            abstract, &rpc_lookup[i].rpc_interface)
    1000999                    && ndr_syntax_id_equal(
  • branches/samba-3.3.x/source/rpc_server/srv_samr_nt.c

    r221 r224  
    621621                return NT_STATUS_INVALID_HANDLE;
    622622
    623         status = access_check_samr_function(info->acc_granted,
    624                                             SAMR_ACCESS_OPEN_DOMAIN,
    625                                             "_samr_OpenDomain" );
    626 
    627         if ( !NT_STATUS_IS_OK(status) )
    628                 return status;
    629 
    630623        /*check if access can be granted as requested by client. */
    631624        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
     
    28982891
    28992892        status = access_check_samr_function(info->acc_granted,
    2900                                             SAMR_ACCESS_OPEN_DOMAIN,
     2893                                            SAMR_ACCESS_LOOKUP_DOMAIN,
    29012894                                            "_samr_QueryDomainInfo" );
    29022895
     
    33233316
    33243317        se_map_generic( &des_access, &sam_generic_mapping );
    3325         info->acc_granted = des_access & (SAMR_ACCESS_ENUM_DOMAINS|SAMR_ACCESS_OPEN_DOMAIN);
     3318        info->acc_granted = des_access & (SAMR_ACCESS_ENUM_DOMAINS|SAMR_ACCESS_LOOKUP_DOMAIN);
    33263319
    33273320        /* get a (unique) handle.  open a policy on it. */
     
    34593452
    34603453        status = access_check_samr_function(info->acc_granted,
    3461                                             SAMR_ACCESS_OPEN_DOMAIN,
     3454                                            SAMR_ACCESS_LOOKUP_DOMAIN,
    34623455                                            "_samr_LookupDomain");
    34633456        if (!NT_STATUS_IS_OK(status)) {
     
    37443737        }
    37453738
    3746         if (id18->password_expired) {
    3747                 pdb_set_pass_last_set_time(pwd, 0, PDB_CHANGED);
    3748         } else {
    3749                 /* FIXME */
    3750                 pdb_set_pass_last_set_time(pwd, time(NULL), PDB_CHANGED);
    3751         }
     3739        copy_id18_to_sam_passwd(pwd, id18);
    37523740
    37533741        return pdb_update_sam_account(pwd);
     
    39563944 ********************************************************************/
    39573945
    3958 static bool set_user_info_pw(uint8 *pass, struct samu *pwd,
    3959                              int level)
     3946static bool set_user_info_pw(uint8 *pass, struct samu *pwd)
    39603947{
    39613948        uint32 len = 0;
    39623949        char *plaintext_buf = NULL;
    39633950        uint32 acct_ctrl;
    3964         time_t last_set_time;
    3965         enum pdb_value_state last_set_state;
    39663951
    39673952        DEBUG(5, ("Attempting administrator password change for user %s\n",
     
    39693954
    39703955        acct_ctrl = pdb_get_acct_ctrl(pwd);
    3971         /* we need to know if it's expired, because this is an admin change, not a
    3972            user change, so it's still expired when we're done */
    3973         last_set_state = pdb_get_init_flags(pwd, PDB_PASSLASTSET);
    3974         last_set_time = pdb_get_pass_last_set_time(pwd);
    39753956
    39763957        if (!decode_pw_buffer(talloc_tos(),
     
    40153996        memset(plaintext_buf, '\0', strlen(plaintext_buf));
    40163997
    4017         /*
    4018          * A level 25 change does reset the pwdlastset field, a level 24
    4019          * change does not. I know this is probably not the full story, but
    4020          * it is needed to make XP join LDAP correctly, without it the later
    4021          * auth2 check can fail with PWD_MUST_CHANGE.
    4022          */
    4023         if (level != 25) {
    4024                 /*
    4025                  * restore last set time as this is an admin change, not a
    4026                  * user pw change
    4027                  */
    4028                 pdb_set_pass_last_set_time (pwd, last_set_time,
    4029                                             last_set_state);
    4030         }
    4031 
    40323998        DEBUG(5,("set_user_info_pw: pdb_update_pwd()\n"));
    40333999
    4034         /* update the SAMBA password */
    4035         if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
    4036                 return False;
     4000        return True;
     4001}
     4002
     4003/*******************************************************************
     4004 set_user_info_24
     4005 ********************************************************************/
     4006
     4007static NTSTATUS set_user_info_24(TALLOC_CTX *mem_ctx,
     4008                                 struct samr_UserInfo24 *id24,
     4009                                 struct samu *pwd)
     4010{
     4011        NTSTATUS status;
     4012
     4013        if (id24 == NULL) {
     4014                DEBUG(5, ("set_user_info_24: NULL id24\n"));
     4015                return NT_STATUS_INVALID_PARAMETER;
     4016        }
     4017
     4018        if (!set_user_info_pw(id24->password.data, pwd)) {
     4019                return NT_STATUS_WRONG_PASSWORD;
     4020        }
     4021
     4022        copy_id24_to_sam_passwd(pwd, id24);
     4023
     4024        status = pdb_update_sam_account(pwd);
     4025        if (!NT_STATUS_IS_OK(status)) {
     4026                return status;
    40374027        }
    40384028
    4039         return True;
     4029        return NT_STATUS_OK;
    40404030}
    40414031
     
    40614051        if (id25->info.fields_present & SAMR_FIELD_LAST_PWD_CHANGE) {
    40624052                return NT_STATUS_ACCESS_DENIED;
     4053        }
     4054
     4055        if ((id25->info.fields_present & SAMR_FIELD_NT_PASSWORD_PRESENT) ||
     4056            (id25->info.fields_present & SAMR_FIELD_LM_PASSWORD_PRESENT)) {
     4057
     4058                if (!set_user_info_pw(id25->password.data, pwd)) {
     4059                        return NT_STATUS_WRONG_PASSWORD;
     4060                }
    40634061        }
    40644062
     
    40874085        return NT_STATUS_OK;
    40884086}
     4087
     4088/*******************************************************************
     4089 set_user_info_26
     4090 ********************************************************************/
     4091
     4092static NTSTATUS set_user_info_26(TALLOC_CTX *mem_ctx,
     4093                                 struct samr_UserInfo26 *id26,
     4094                                 struct samu *pwd)
     4095{
     4096        NTSTATUS status;
     4097
     4098        if (id26 == NULL) {
     4099                DEBUG(5, ("set_user_info_26: NULL id26\n"));
     4100                return NT_STATUS_INVALID_PARAMETER;
     4101        }
     4102
     4103        if (!set_user_info_pw(id26->password.data, pwd)) {
     4104                return NT_STATUS_WRONG_PASSWORD;
     4105        }
     4106
     4107        copy_id26_to_sam_passwd(pwd, id26);
     4108
     4109        status = pdb_update_sam_account(pwd);
     4110        if (!NT_STATUS_IS_OK(status)) {
     4111                return status;
     4112        }
     4113
     4114        return NT_STATUS_OK;
     4115}
     4116
    40894117
    40904118/*******************************************************************
     
    42484276                        dump_data(100, info->info24.password.data, 516);
    42494277
    4250                         if (!set_user_info_pw(info->info24.password.data, pwd,
    4251                                               switch_value)) {
    4252                                 status = NT_STATUS_WRONG_PASSWORD;
    4253                         }
     4278                        status = set_user_info_24(p->mem_ctx,
     4279                                                  &info->info24, pwd);
    42544280                        break;
    42554281
     
    42664292                        status = set_user_info_25(p->mem_ctx,
    42674293                                                  &info->info25, pwd);
    4268                         if (!NT_STATUS_IS_OK(status)) {
    4269                                 goto done;
    4270                         }
    4271                         if (!set_user_info_pw(info->info25.password.data, pwd,
    4272                                               switch_value)) {
    4273                                 status = NT_STATUS_WRONG_PASSWORD;
    4274                         }
    42754294                        break;
    42764295
     
    42854304                        dump_data(100, info->info26.password.data, 516);
    42864305
    4287                         if (!set_user_info_pw(info->info26.password.data, pwd,
    4288                                               switch_value)) {
    4289                                 status = NT_STATUS_WRONG_PASSWORD;
    4290                         }
     4306                        status = set_user_info_26(p->mem_ctx,
     4307                                                  &info->info26, pwd);
    42914308                        break;
    42924309
     
    42944311                        status = NT_STATUS_INVALID_INFO_CLASS;
    42954312        }
    4296 
    4297  done:
    42984313
    42994314        TALLOC_FREE(pwd);
  • branches/samba-3.3.x/source/rpc_server/srv_samr_util.c

    r206 r224  
    3535                    (!(s1) && (s2)) ||\
    3636                ((s1) && (s2) && (strcmp((s1), (s2)) != 0))
     37
     38/*************************************************************
     39 Copies a struct samr_UserInfo18 to a struct samu
     40**************************************************************/
     41
     42void copy_id18_to_sam_passwd(struct samu *to,
     43                             struct samr_UserInfo18 *from)
     44{
     45        struct samr_UserInfo21 i;
     46
     47        if (from == NULL || to == NULL) {
     48                return;
     49        }
     50
     51        ZERO_STRUCT(i);
     52
     53        i.fields_present        = SAMR_FIELD_EXPIRED_FLAG;
     54        i.password_expired      = from->password_expired;
     55
     56        copy_id21_to_sam_passwd("INFO_18", to, &i);
     57}
    3758
    3859/*************************************************************
     
    337358                DEBUG(10,("%s SAMR_FIELD_EXPIRED_FLAG: %02X\n", l,
    338359                        from->password_expired));
    339                 if (from->password_expired == PASS_MUST_CHANGE_AT_NEXT_LOGON) {
     360                if (from->password_expired != 0) {
    340361                        pdb_set_pass_last_set_time(to, 0, PDB_CHANGED);
    341362                } else {
     
    346367                           for example, to clear an autolocked acct.
    347368                           We must check to see if it's expired first. jmcd */
     369
     370                        uint32_t pwd_max_age = 0;
     371                        time_t now = time(NULL);
     372
     373                        pdb_get_account_policy(AP_MAX_PASSWORD_AGE, &pwd_max_age);
     374
     375                        if (pwd_max_age == (uint32_t)-1 || pwd_max_age == 0) {
     376                                pwd_max_age = get_time_t_max();
     377                        }
     378
    348379                        stored_time = pdb_get_pass_last_set_time(to);
    349                         if (stored_time == 0)
    350                                 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED);
     380
     381                        /* we will only *set* a pwdlastset date when
     382                           a) the last pwdlastset time was 0 (user was forced to
     383                              change password).
     384                           b) the users password has not expired. gd. */
     385
     386                        if ((stored_time == 0) ||
     387                            ((now - stored_time) > pwd_max_age)) {
     388                                pdb_set_pass_last_set_time(to, now, PDB_CHANGED);
     389                        }
    351390                }
    352391        }
     
    369408
    370409/*************************************************************
     410 Copies a struct samr_UserInfo24 to a struct samu
     411**************************************************************/
     412
     413void copy_id24_to_sam_passwd(struct samu *to,
     414                             struct samr_UserInfo24 *from)
     415{
     416        struct samr_UserInfo21 i;
     417
     418        if (from == NULL || to == NULL) {
     419                return;
     420        }
     421
     422        ZERO_STRUCT(i);
     423
     424        i.fields_present        = SAMR_FIELD_EXPIRED_FLAG;
     425        i.password_expired      = from->password_expired;
     426
     427        copy_id21_to_sam_passwd("INFO_24", to, &i);
     428}
     429
     430/*************************************************************
    371431 Copies a struct samr_UserInfo25 to a struct samu
    372432**************************************************************/
     
    381441        copy_id21_to_sam_passwd("INFO_25", to, &from->info);
    382442}
     443
     444/*************************************************************
     445 Copies a struct samr_UserInfo26 to a struct samu
     446**************************************************************/
     447
     448void copy_id26_to_sam_passwd(struct samu *to,
     449                             struct samr_UserInfo26 *from)
     450{
     451        struct samr_UserInfo21 i;
     452
     453        if (from == NULL || to == NULL) {
     454                return;
     455        }
     456
     457        ZERO_STRUCT(i);
     458
     459        i.fields_present        = SAMR_FIELD_EXPIRED_FLAG;
     460        i.password_expired      = from->password_expired;
     461
     462        copy_id21_to_sam_passwd("INFO_26", to, &i);
     463}
Note: See TracChangeset for help on using the changeset viewer.