Ignore:
Timestamp:
May 26, 2009, 9:44:50 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.6

Location:
branches/samba-3.2.x/source/rpc_client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/rpc_client/cli_pipe.c

    r204 r228  
    22222222
    22232223        if (fnum == -1) {
    2224                 DEBUG(1,("cli_rpc_pipe_open: cli_nt_create failed on pipe %s "
     2224                DEBUG(3,("cli_rpc_pipe_open: cli_nt_create failed on pipe %s "
    22252225                         "to machine %s.  Error was %s\n",
    22262226                         result->pipe_name, cli->desthost,
  • branches/samba-3.2.x/source/rpc_client/init_samr.c

    r138 r228  
    411411                           uint8_t lm_password_set,
    412412                           uint8_t password_expired,
    413                            uint8_t data[516],
    414                            uint8_t pw_len)
     413                           struct samr_CryptPassword *pwd_buf)
    415414{
    416415        memset(r, '\0', sizeof(*r));
     
    445444                              password_expired);
    446445
    447         memcpy(r->password.data, data, sizeof(r->password.data));
     446        r->password = *pwd_buf;
    448447}
    449448
     
    453452
    454453void init_samr_user_info24(struct samr_UserInfo24 *r,
    455                            uint8_t data[516],
    456                            uint8_t pw_len)
     454                           struct samr_CryptPassword *pwd_buf,
     455                           uint8_t password_expired)
    457456{
    458457        DEBUG(10, ("init_samr_user_info24:\n"));
    459458
    460         memcpy(r->password.data, data, sizeof(r->password.data));
    461         r->pw_len = pw_len;
    462 }
     459        r->password = *pwd_buf;
     460        r->password_expired = password_expired;
     461}
     462
     463/*************************************************************************
     464 init_samr_user_info25
     465 *************************************************************************/
     466
     467void init_samr_user_info25(struct samr_UserInfo25 *r,
     468                           NTTIME last_logon,
     469                           NTTIME last_logoff,
     470                           NTTIME last_password_change,
     471                           NTTIME acct_expiry,
     472                           NTTIME allow_password_change,
     473                           NTTIME force_password_change,
     474                           const char *account_name,
     475                           const char *full_name,
     476                           const char *home_directory,
     477                           const char *home_drive,
     478                           const char *logon_script,
     479                           const char *profile_path,
     480                           const char *description,
     481                           const char *workstations,
     482                           const char *comment,
     483                           struct lsa_BinaryString *parameters,
     484                           uint32_t rid,
     485                           uint32_t primary_gid,
     486                           uint32_t acct_flags,
     487                           uint32_t fields_present,
     488                           struct samr_LogonHours logon_hours,
     489                           uint16_t bad_password_count,
     490                           uint16_t logon_count,
     491                           uint16_t country_code,
     492                           uint16_t code_page,
     493                           uint8_t nt_password_set,
     494                           uint8_t lm_password_set,
     495                           uint8_t password_expired,
     496                           struct samr_CryptPasswordEx *pwd_buf)
     497{
     498        DEBUG(10, ("init_samr_user_info25:\n"));
     499
     500        memset(r, '\0', sizeof(*r));
     501        init_samr_user_info21(&r->info,
     502                              last_logon,
     503                              last_logoff,
     504                              last_password_change,
     505                              acct_expiry,
     506                              allow_password_change,
     507                              force_password_change,
     508                              account_name,
     509                              full_name,
     510                              home_directory,
     511                              home_drive,
     512                              logon_script,
     513                              profile_path,
     514                              description,
     515                              workstations,
     516                              comment,
     517                              parameters,
     518                              rid,
     519                              primary_gid,
     520                              acct_flags,
     521                              fields_present,
     522                              logon_hours,
     523                              bad_password_count,
     524                              logon_count,
     525                              country_code,
     526                              code_page,
     527                              nt_password_set,
     528                              lm_password_set,
     529                              password_expired);
     530
     531        r->password = *pwd_buf;
     532}
     533
     534/*************************************************************************
     535 init_samr_user_info26
     536 *************************************************************************/
     537
     538void init_samr_user_info26(struct samr_UserInfo26 *r,
     539                           struct samr_CryptPasswordEx *pwd_buf,
     540                           uint8_t password_expired)
     541{
     542        DEBUG(10, ("init_samr_user_info26:\n"));
     543
     544        r->password = *pwd_buf;
     545        r->password_expired = password_expired;
     546}
     547
     548/*************************************************************************
     549 inits a samr_CryptPasswordEx structure
     550 *************************************************************************/
     551
     552void init_samr_CryptPasswordEx(const char *pwd,
     553                               DATA_BLOB *session_key,
     554                               struct samr_CryptPasswordEx *pwd_buf)
     555{
     556        /* samr_CryptPasswordEx */
     557
     558        uchar pwbuf[532];
     559        struct MD5Context md5_ctx;
     560        uint8_t confounder[16];
     561        DATA_BLOB confounded_session_key = data_blob(NULL, 16);
     562
     563        encode_pw_buffer(pwbuf, pwd, STR_UNICODE);
     564
     565        generate_random_buffer((uint8_t *)confounder, 16);
     566
     567        MD5Init(&md5_ctx);
     568        MD5Update(&md5_ctx, confounder, 16);
     569        MD5Update(&md5_ctx, session_key->data,
     570                            session_key->length);
     571        MD5Final(confounded_session_key.data, &md5_ctx);
     572
     573        SamOEMhashBlob(pwbuf, 516, &confounded_session_key);
     574        memcpy(&pwbuf[516], confounder, 16);
     575
     576        memcpy(pwd_buf->data, pwbuf, sizeof(pwbuf));
     577        data_blob_free(&confounded_session_key);
     578}
     579
     580/*************************************************************************
     581 inits a samr_CryptPassword structure
     582 *************************************************************************/
     583
     584void init_samr_CryptPassword(const char *pwd,
     585                             DATA_BLOB *session_key,
     586                             struct samr_CryptPassword *pwd_buf)
     587{
     588        /* samr_CryptPassword */
     589
     590        encode_pw_buffer(pwd_buf->data, pwd, STR_UNICODE);
     591        SamOEMhashBlob(pwd_buf->data, 516, session_key);
     592}
Note: See TracChangeset for help on using the changeset viewer.