Ignore:
Timestamp:
May 12, 2014, 8:58:38 PM (11 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.6: updated vendor to latest version

Location:
vendor/current/source3/rpc_server
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/rpc_server/netlogon/srv_netlog_nt.c

    r746 r860  
    587587                goto out;
    588588        }
    589         if (rids.count != types.count) {
     589        if (types.count != 1) {
    590590                status = NT_STATUS_INVALID_PARAMETER;
    591591                goto out;
  • vendor/current/source3/rpc_server/samr/srv_samr_chgpasswd.c

    r740 r860  
    7474
    7575#if defined(HAVE_GRANTPT)
     76#if defined(HAVE_POSIX_OPENPT)
     77        master = posix_openpt(O_RDWR|O_NOCTTY);
     78#else
    7679        /* Try to open /dev/ptmx. If that fails, fall through to old method. */
    77         if ((master = sys_open("/dev/ptmx", O_RDWR, 0)) >= 0) {
     80        master = sys_open("/dev/ptmx", O_RDWR, 0);
     81#endif
     82        if (master >= 0) {
    7883                grantpt(master);
    7984                unlockpt(master);
     
    11021107        NTSTATUS nt_status;
    11031108        bool ret = false;
     1109        bool updated_badpw = false;
     1110        NTSTATUS update_login_attempts_status;
    11041111
    11051112        if (!(sampass = samu_new(NULL))) {
     
    11151122                TALLOC_FREE(sampass);
    11161123                return NT_STATUS_NO_SUCH_USER;
     1124        }
     1125
     1126        /* Quit if the account was locked out. */
     1127        if (pdb_get_acct_ctrl(sampass) & ACB_AUTOLOCK) {
     1128                DEBUG(3,("check_sam_security: Account for user %s was locked out.\n", user));
     1129                TALLOC_FREE(sampass);
     1130                return NT_STATUS_ACCOUNT_LOCKED_OUT;
    11171131        }
    11181132
     
    11251139                                       &new_passwd);
    11261140
     1141        /*
     1142         * Notify passdb backend of login success/failure. If not
     1143         * NT_STATUS_OK the backend doesn't like the login
     1144         */
     1145        update_login_attempts_status = pdb_update_login_attempts(sampass,
     1146                                                NT_STATUS_IS_OK(nt_status));
     1147
     1148        if (!NT_STATUS_IS_OK(nt_status)) {
     1149                bool increment_bad_pw_count = false;
     1150
     1151                if (NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD) &&
     1152                    (pdb_get_acct_ctrl(sampass) & ACB_NORMAL) &&
     1153                    NT_STATUS_IS_OK(update_login_attempts_status))
     1154                {
     1155                        increment_bad_pw_count = true;
     1156                }
     1157
     1158                if (increment_bad_pw_count) {
     1159                        pdb_increment_bad_password_count(sampass);
     1160                        updated_badpw = true;
     1161                } else {
     1162                        pdb_update_bad_password_count(sampass,
     1163                                                      &updated_badpw);
     1164                }
     1165        } else {
     1166
     1167                if ((pdb_get_acct_ctrl(sampass) & ACB_NORMAL) &&
     1168                    (pdb_get_bad_password_count(sampass) > 0)){
     1169                        pdb_set_bad_password_count(sampass, 0, PDB_CHANGED);
     1170                        pdb_set_bad_password_time(sampass, 0, PDB_CHANGED);
     1171                        updated_badpw = true;
     1172                }
     1173        }
     1174
     1175        if (updated_badpw) {
     1176                NTSTATUS update_status;
     1177                become_root();
     1178                update_status = pdb_update_sam_account(sampass);
     1179                unbecome_root();
     1180
     1181                if (!NT_STATUS_IS_OK(update_status)) {
     1182                        DEBUG(1, ("Failed to modify entry: %s\n",
     1183                                  nt_errstr(update_status)));
     1184                }
     1185        }
     1186
    11271187        if (!NT_STATUS_IS_OK(nt_status)) {
    11281188                TALLOC_FREE(sampass);
  • vendor/current/source3/rpc_server/samr/srv_samr_nt.c

    r746 r860  
    17071707
    17081708/****************************************************************
    1709  _samr_ChangePasswordUser
     1709 _samr_ChangePasswordUser.
     1710
     1711 So old it is just not worth implementing
     1712 because it does not supply a plaintext and so we can't do password
     1713 complexity checking and cannot update other services that use a
     1714 plaintext password via passwd chat/pam password change/ldap password
     1715 sync.
    17101716****************************************************************/
    17111717
     
    17131719                                  struct samr_ChangePasswordUser *r)
    17141720{
    1715         NTSTATUS status;
    1716         bool ret = false;
    1717         struct samr_user_info *uinfo;
    1718         struct samu *pwd;
    1719         struct samr_Password new_lmPwdHash, new_ntPwdHash, checkHash;
    1720         struct samr_Password lm_pwd, nt_pwd;
    1721 
    1722         uinfo = policy_handle_find(p, r->in.user_handle,
    1723                                    SAMR_USER_ACCESS_SET_PASSWORD, NULL,
    1724                                    struct samr_user_info, &status);
    1725         if (!NT_STATUS_IS_OK(status)) {
    1726                 return status;
    1727         }
    1728 
    1729         DEBUG(5,("_samr_ChangePasswordUser: sid:%s\n",
    1730                   sid_string_dbg(&uinfo->sid)));
    1731 
    1732         if (!(pwd = samu_new(NULL))) {
    1733                 return NT_STATUS_NO_MEMORY;
    1734         }
    1735 
    1736         become_root();
    1737         ret = pdb_getsampwsid(pwd, &uinfo->sid);
    1738         unbecome_root();
    1739 
    1740         if (!ret) {
    1741                 TALLOC_FREE(pwd);
    1742                 return NT_STATUS_WRONG_PASSWORD;
    1743         }
    1744 
    1745         {
    1746                 const uint8_t *lm_pass, *nt_pass;
    1747 
    1748                 lm_pass = pdb_get_lanman_passwd(pwd);
    1749                 nt_pass = pdb_get_nt_passwd(pwd);
    1750 
    1751                 if (!lm_pass || !nt_pass) {
    1752                         status = NT_STATUS_WRONG_PASSWORD;
    1753                         goto out;
    1754                 }
    1755 
    1756                 memcpy(&lm_pwd.hash, lm_pass, sizeof(lm_pwd.hash));
    1757                 memcpy(&nt_pwd.hash, nt_pass, sizeof(nt_pwd.hash));
    1758         }
    1759 
    1760         /* basic sanity checking on parameters.  Do this before any database ops */
    1761         if (!r->in.lm_present || !r->in.nt_present ||
    1762             !r->in.old_lm_crypted || !r->in.new_lm_crypted ||
    1763             !r->in.old_nt_crypted || !r->in.new_nt_crypted) {
    1764                 /* we should really handle a change with lm not
    1765                    present */
    1766                 status = NT_STATUS_INVALID_PARAMETER_MIX;
    1767                 goto out;
    1768         }
    1769 
    1770         /* decrypt and check the new lm hash */
    1771         D_P16(lm_pwd.hash, r->in.new_lm_crypted->hash, new_lmPwdHash.hash);
    1772         D_P16(new_lmPwdHash.hash, r->in.old_lm_crypted->hash, checkHash.hash);
    1773         if (memcmp(checkHash.hash, lm_pwd.hash, 16) != 0) {
    1774                 status = NT_STATUS_WRONG_PASSWORD;
    1775                 goto out;
    1776         }
    1777 
    1778         /* decrypt and check the new nt hash */
    1779         D_P16(nt_pwd.hash, r->in.new_nt_crypted->hash, new_ntPwdHash.hash);
    1780         D_P16(new_ntPwdHash.hash, r->in.old_nt_crypted->hash, checkHash.hash);
    1781         if (memcmp(checkHash.hash, nt_pwd.hash, 16) != 0) {
    1782                 status = NT_STATUS_WRONG_PASSWORD;
    1783                 goto out;
    1784         }
    1785 
    1786         /* The NT Cross is not required by Win2k3 R2, but if present
    1787            check the nt cross hash */
    1788         if (r->in.cross1_present && r->in.nt_cross) {
    1789                 D_P16(lm_pwd.hash, r->in.nt_cross->hash, checkHash.hash);
    1790                 if (memcmp(checkHash.hash, new_ntPwdHash.hash, 16) != 0) {
    1791                         status = NT_STATUS_WRONG_PASSWORD;
    1792                         goto out;
    1793                 }
    1794         }
    1795 
    1796         /* The LM Cross is not required by Win2k3 R2, but if present
    1797            check the lm cross hash */
    1798         if (r->in.cross2_present && r->in.lm_cross) {
    1799                 D_P16(nt_pwd.hash, r->in.lm_cross->hash, checkHash.hash);
    1800                 if (memcmp(checkHash.hash, new_lmPwdHash.hash, 16) != 0) {
    1801                         status = NT_STATUS_WRONG_PASSWORD;
    1802                         goto out;
    1803                 }
    1804         }
    1805 
    1806         if (!pdb_set_nt_passwd(pwd, new_ntPwdHash.hash, PDB_CHANGED) ||
    1807             !pdb_set_lanman_passwd(pwd, new_lmPwdHash.hash, PDB_CHANGED)) {
    1808                 status = NT_STATUS_ACCESS_DENIED;
    1809                 goto out;
    1810         }
    1811 
    1812         status = pdb_update_sam_account(pwd);
    1813  out:
    1814         TALLOC_FREE(pwd);
    1815 
    1816         return status;
     1721        return NT_STATUS_NOT_IMPLEMENTED;
    18171722}
    18181723
  • vendor/current/source3/rpc_server/spoolss/srv_spoolss_nt.c

    r746 r860  
    17451745        result = open_printer_hnd(p, r->out.handle, r->in.printername, 0);
    17461746        if (!W_ERROR_IS_OK(result)) {
    1747                 DEBUG(0,("_spoolss_OpenPrinterEx: Cannot open a printer handle "
     1747                DEBUG(3,("_spoolss_OpenPrinterEx: Cannot open a printer handle "
    17481748                        "for printer %s\n", r->in.printername));
    17491749                ZERO_STRUCTP(r->out.handle);
     
    19431943         */
    19441944
    1945          if ((Printer->printer_type != SPLHND_SERVER) &&
    1946              r->in.devmode_ctr.devmode) {
     1945         if ((Printer->printer_type != SPLHND_SERVER)
     1946          && (r->in.devmode_ctr.devmode != NULL)) {
    19471947                copy_devicemode(NULL, r->in.devmode_ctr.devmode,
    19481948                                &Printer->devmode);
    19491949         }
    1950 
    1951 #if 0   /* JERRY -- I'm doubtful this is really effective */
    1952         /* HACK ALERT!!! Sleep for 1/3 of a second to try trigger a LAN/WAN
    1953            optimization in Windows 2000 clients  --jerry */
    1954 
    1955         if ( (r->in.access_mask == PRINTER_ACCESS_ADMINISTER)
    1956                 && (RA_WIN2K == get_remote_arch()) )
    1957         {
    1958                 DEBUG(10,("_spoolss_OpenPrinterEx: Enabling LAN/WAN hack for Win2k clients.\n"));
    1959                 sys_usleep( 500000 );
    1960         }
    1961 #endif
    19621950
    19631951        return WERR_OK;
     
    40384026        r->averageppm           = info2->averageppm;
    40394027
    4040         copy_devicemode(mem_ctx, info2->devmode, &r->devmode);
    4041         if (!r->devmode) {
     4028        if (info2->devmode != NULL) {
     4029                result = copy_devicemode(mem_ctx,
     4030                                         info2->devmode,
     4031                                         &r->devmode);
     4032                if (!W_ERROR_IS_OK(result)) {
     4033                        return result;
     4034                }
     4035        } else if (lp_default_devmode(snum)) {
     4036                result = spoolss_create_default_devmode(mem_ctx,
     4037                                                        info2->printername,
     4038                                                        &r->devmode);
     4039                if (!W_ERROR_IS_OK(result)) {
     4040                        return result;
     4041                }
     4042        } else {
     4043                r->devmode = NULL;
    40424044                DEBUG(8,("Returning NULL Devicemode!\n"));
    40434045        }
     
    41754177{
    41764178        struct auth_serversupplied_info *session_info;
    4177         struct GUID guid;
     4179        char *printer;
    41784180        NTSTATUS status;
    4179 
    4180         status = make_session_info_system(mem_ctx, &session_info);
     4181        WERROR werr;
     4182        TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
     4183        if (tmp_ctx == NULL) {
     4184                return WERR_NOMEM;
     4185        }
     4186
     4187        status = make_session_info_system(tmp_ctx, &session_info);
    41814188        if (!NT_STATUS_IS_OK(status)) {
    41824189                DEBUG(0, ("construct_printer_info7: "
    41834190                          "Could not create system session_info\n"));
    4184                 return WERR_NOMEM;
    4185         }
    4186 
    4187         if (is_printer_published(mem_ctx, session_info, msg_ctx,
    4188                                  servername,
    4189                                  lp_servicename(snum), &guid, NULL)) {
     4191                werr = WERR_NOMEM;
     4192                goto out_tmp_free;
     4193        }
     4194
     4195        printer = lp_servicename(snum);
     4196        if (printer == NULL) {
     4197                DEBUG(0, ("invalid printer snum %d\n", snum));
     4198                werr = WERR_INVALID_PARAM;
     4199                goto out_tmp_free;
     4200        }
     4201
     4202        if (is_printer_published(tmp_ctx, session_info, msg_ctx,
     4203                                 servername, printer, NULL)) {
     4204                struct GUID guid;
     4205                werr = nt_printer_guid_get(tmp_ctx, session_info, msg_ctx,
     4206                                           printer, &guid);
     4207                if (!W_ERROR_IS_OK(werr)) {
     4208                        goto out_tmp_free;
     4209                }
    41904210                r->guid = talloc_strdup_upper(mem_ctx, GUID_string2(mem_ctx, &guid));
    41914211                r->action = DSPRINT_PUBLISH;
     
    41944214                r->action = DSPRINT_UNPUBLISH;
    41954215        }
    4196         W_ERROR_HAVE_NO_MEMORY(r->guid);
    4197 
    4198         TALLOC_FREE(session_info);
    4199         return WERR_OK;
     4216        if (r->guid == NULL) {
     4217                werr = WERR_NOMEM;
     4218                goto out_tmp_free;
     4219        }
     4220
     4221        werr = WERR_OK;
     4222out_tmp_free:
     4223        talloc_free(tmp_ctx);
     4224        return werr;
    42004225}
    42014226
     
    42194244        }
    42204245
    4221         copy_devicemode(mem_ctx, info2->devmode, &r->devmode);
    4222         if (!r->devmode) {
     4246        if (info2->devmode != NULL) {
     4247                result = copy_devicemode(mem_ctx,
     4248                                         info2->devmode,
     4249                                         &r->devmode);
     4250                if (!W_ERROR_IS_OK(result)) {
     4251                        return result;
     4252                }
     4253        } else if (lp_default_devmode(snum)) {
     4254                result = spoolss_create_default_devmode(mem_ctx,
     4255                                                        info2->printername,
     4256                                                        &r->devmode);
     4257                if (!W_ERROR_IS_OK(result)) {
     4258                        return result;
     4259                }
     4260        } else {
     4261                r->devmode = NULL;
    42234262                DEBUG(8,("Returning NULL Devicemode!\n"));
    42244263        }
     
    44274466        DEBUG(4,("enum_all_printers_info_1_name\n"));
    44284467
    4429         if ((servername[0] == '\\') && (servername[1] == '\\')) {
     4468        if (servername != NULL &&
     4469            (servername[0] == '\\') && (servername[1] == '\\')) {
    44304470                s = servername + 2;
    44314471        }
     
    44624502           WERR_CAN_NOT_COMPLETE so we should do the same. */
    44634503
    4464         if (servername[0] == '\\' && servername[1] == '\\') {
     4504        if (servername != NULL &&
     4505            (servername[0] == '\\') && (servername[1] == '\\')) {
    44654506                 s = servername + 2;
    44664507        }
     
    55925633        struct printer_handle *printer;
    55935634        WERROR result;
     5635        uint32_t version = r->in.client_major_version;
    55945636
    55955637        int snum;
     
    56145656        if (!get_printer_snum(p, r->in.handle, &snum, NULL)) {
    56155657                return WERR_BADFID;
     5658        }
     5659
     5660        if (r->in.client_major_version == SPOOLSS_DRIVER_VERSION_2012) {
     5661                DEBUG(3,("_spoolss_GetPrinterDriver2: v4 driver requested, "
     5662                        "downgrading to v3\n"));
     5663                version = SPOOLSS_DRIVER_VERSION_200X;
    56165664        }
    56175665
     
    56225670                                                     snum, printer->servername,
    56235671                                                     r->in.architecture,
    5624                                                      r->in.client_major_version);
     5672                                                     version);
    56255673        if (!W_ERROR_IS_OK(result)) {
    56265674                TALLOC_FREE(r->out.info);
     
    57225770
    57235771        if (info_1->datatype) {
    5724                 if (strcmp(info_1->datatype, "RAW") != 0) {
     5772                /*
     5773                 * The v4 driver model used in Windows 8 declares print jobs
     5774                 * intended to bypass the XPS processing layer by setting
     5775                 * datatype to "XPS_PASS" instead of "RAW".
     5776                 */
     5777                if ((strcmp(info_1->datatype, "RAW") != 0)
     5778                 && (strcmp(info_1->datatype, "XPS_PASS") != 0)) {
    57255779                        *r->out.job_id = 0;
    57265780                        return WERR_INVALID_DATATYPE;
  • vendor/current/source3/rpc_server/wkssvc/srv_wkssvc_nt.c

    r746 r860  
    580580                r->out.info->level = r->in.info->level;
    581581                *r->out.entries_read = r->out.info->ctr.user0->entries_read;
    582                 *r->out.resume_handle = 0;
     582                if (r->out.resume_handle != NULL) {
     583                        *r->out.resume_handle = 0;
     584                }
    583585                break;
    584586        case 1:
     
    589591                r->out.info->level = r->in.info->level;
    590592                *r->out.entries_read = r->out.info->ctr.user1->entries_read;
    591                 *r->out.resume_handle = 0;
     593                if (r->out.resume_handle != NULL) {
     594                        *r->out.resume_handle = 0;
     595                }
    592596                break;
    593597        default:
Note: See TracChangeset for help on using the changeset viewer.