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

Update Samba 3.3 branch to 3.3.2

Location:
branches/samba-3.3.x/source/smbd
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/smbd/aio.c

    r206 r222  
    444444                 * client. */
    445445                if (errno == ECANCELED) {
    446                         srv_cancel_sign_response(aio_ex->mid);
     446                        srv_cancel_sign_response(aio_ex->mid, false);
    447447                        return 0;
    448448                }
     
    538538                 * client. */
    539539                if (errno == ECANCELED) {
    540                         srv_cancel_sign_response(aio_ex->mid);
     540                        srv_cancel_sign_response(aio_ex->mid, false);
    541541                        return 0;
    542542                }
     
    650650                        DEBUG(3,("process_aio_queue: Can't find record to "
    651651                                 "match mid %u.\n", (unsigned int)mid));
    652                         srv_cancel_sign_response(mid);
     652                        srv_cancel_sign_response(mid, false);
    653653                        continue;
    654654                }
     
    660660                        DEBUG( 3,( "process_aio_queue: file closed whilst "
    661661                                   "aio outstanding.\n"));
    662                         srv_cancel_sign_response(mid);
     662                        srv_cancel_sign_response(mid, false);
    663663                        continue;
    664664                }
  • branches/samba-3.3.x/source/smbd/close.c

    r221 r222  
    468468        struct timespec ts[2];
    469469        NTSTATUS status;
     470        int ret = -1;
    470471
    471472        ZERO_STRUCT(sbuf);
     
    482483        /* Ensure we have a valid stat struct for the source. */
    483484        if (fsp->fh->fd != -1) {
    484                 if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
    485                         return map_nt_error_from_unix(errno);
    486                 }
     485                ret = SMB_VFS_FSTAT(fsp, &sbuf);
    487486        } else {
    488                 if (SMB_VFS_STAT(fsp->conn,fsp->fsp_name,&sbuf) == -1) {
    489                         return map_nt_error_from_unix(errno);
    490                 }
     487                if (fsp->posix_open) {
     488                        ret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name,&sbuf);
     489                } else {
     490                        ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name,&sbuf);
     491                }
     492        }
     493
     494        if (ret == -1) {
     495                return map_nt_error_from_unix(errno);
    491496        }
    492497
     
    576581
    577582        saved_status4 = update_write_time_on_close(fsp);
     583        if (NT_STATUS_EQUAL(saved_status4, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
     584                /* Someone renamed the file or a parent directory containing
     585                 * this file. We can't do anything about this, we don't have
     586                 * an "update timestamp by fd" call in POSIX. Eat the error. */
     587
     588                saved_status4 = NT_STATUS_OK;
     589        }
    578590
    579591        if (NT_STATUS_IS_OK(status)) {
  • branches/samba-3.3.x/source/smbd/conn.c

    r206 r222  
    146146        }
    147147        conn->cnum = i;
     148        conn->force_group_gid = (gid_t)-1;
    148149
    149150        bitmap_set(bmap, i);
  • branches/samba-3.3.x/source/smbd/dnsregister.c

    r221 r222  
    109109
    110110        if (dns_state == NULL) {
    111                 *dns_state_ptr = dns_state = talloc(NULL, struct dns_reg_state);
     111                dns_state = talloc_zero(NULL, struct dns_reg_state);
     112                *dns_state_ptr = dns_state;
    112113                if (dns_state == NULL) {
    113114                        return;
  • branches/samba-3.3.x/source/smbd/file_access.c

    r221 r222  
    3434        uint32_t access_granted;
    3535        struct security_descriptor *secdesc = NULL;
     36
     37        if (conn->server_info->utok.uid == 0 || conn->admin_user) {
     38                /* I'm sorry sir, I didn't know you were root... */
     39                return true;
     40        }
    3641
    3742        status = SMB_VFS_GET_NT_ACL(conn, fname,
  • branches/samba-3.3.x/source/smbd/files.c

    r206 r222  
    378378
    379379/****************************************************************************
     380 Find any fsp open with a pathname below that of an already open path.
     381****************************************************************************/
     382
     383bool file_find_subpath(files_struct *dir_fsp)
     384{
     385        files_struct *fsp;
     386        size_t dlen;
     387        char *d_fullname = talloc_asprintf(talloc_tos(),
     388                                        "%s/%s",
     389                                        dir_fsp->conn->connectpath,
     390                                        dir_fsp->fsp_name);
     391
     392        if (!d_fullname) {
     393                return false;
     394        }
     395
     396        dlen = strlen(d_fullname);
     397
     398        for (fsp=Files;fsp;fsp=fsp->next) {
     399                char *d1_fullname;
     400
     401                if (fsp == dir_fsp) {
     402                        continue;
     403                }
     404
     405                d1_fullname = talloc_asprintf(talloc_tos(),
     406                                        "%s/%s",
     407                                        fsp->conn->connectpath,
     408                                        fsp->fsp_name);
     409
     410                if (strnequal(d_fullname, d1_fullname, dlen)) {
     411                        TALLOC_FREE(d_fullname);
     412                        TALLOC_FREE(d1_fullname);
     413                        return true;
     414                }
     415                TALLOC_FREE(d1_fullname);
     416        }
     417
     418        TALLOC_FREE(d_fullname);
     419        return false;
     420}
     421
     422/****************************************************************************
    380423 Sync open files on a connection.
    381424****************************************************************************/
  • branches/samba-3.3.x/source/smbd/nttrans.c

    r206 r222  
    10771077        remove_pending_change_notify_requests_by_mid(req->mid);
    10781078        remove_pending_lock_requests_by_mid(req->mid);
    1079         srv_cancel_sign_response(req->mid);
     1079        srv_cancel_sign_response(req->mid, true);
    10801080
    10811081        DEBUG(3,("reply_ntcancel: cancel called on mid = %d.\n", req->mid));
  • branches/samba-3.3.x/source/smbd/open.c

    r221 r222  
    5959
    6060        *access_granted = 0;
     61
     62        if (conn->server_info->utok.uid == 0 || conn->admin_user) {
     63                /* I'm sorry sir, I didn't know you were root... */
     64                *access_granted = access_mask;
     65                if (access_mask & SEC_FLAG_MAXIMUM_ALLOWED) {
     66                        *access_granted |= FILE_GENERIC_ALL;
     67                }
     68                return NT_STATUS_OK;
     69        }
    6170
    6271        status = SMB_VFS_GET_NT_ACL(conn, fname,
     
    23832392        }
    23842393
     2394        /* We need to support SeSecurityPrivilege for this. */
     2395        if (access_mask & SEC_RIGHT_SYSTEM_SECURITY) {
     2396                DEBUG(10, ("open_directory: open on %s "
     2397                        "failed - SEC_RIGHT_SYSTEM_SECURITY denied.\n",
     2398                        fname));
     2399                return NT_STATUS_PRIVILEGE_NOT_HELD;
     2400        }
     2401
    23852402        switch( create_disposition ) {
    23862403                case FILE_OPEN:
     
    24632480                                        access_mask,
    24642481                                        &access_granted);
     2482
     2483                /* Were we trying to do a directory open
     2484                 * for delete and didn't get DELETE
     2485                 * access (only) ? Check if the
     2486                 * directory allows DELETE_CHILD.
     2487                 * See here:
     2488                 * http://blogs.msdn.com/oldnewthing/archive/2004/06/04/148426.aspx
     2489                 * for details. */
     2490
     2491                if ((NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) &&
     2492                                (access_mask & DELETE_ACCESS) &&
     2493                                (access_granted == DELETE_ACCESS) &&
     2494                                can_delete_file_in_directory(conn, fname))) {
     2495                        DEBUG(10,("open_directory: overrode ACCESS_DENIED "
     2496                                "on directory %s\n",
     2497                                fname ));
     2498                        status = NT_STATUS_OK;
     2499                }
     2500
    24652501                if (!NT_STATUS_IS_OK(status)) {
    24662502                        DEBUG(10, ("open_directory: check_open_rights on "
     
    28972933                goto fail;
    28982934        }
     2935#else
     2936        /* We need to support SeSecurityPrivilege for this. */
     2937        if (access_mask & SEC_RIGHT_SYSTEM_SECURITY) {
     2938                status = NT_STATUS_PRIVILEGE_NOT_HELD;
     2939                goto fail;
     2940        }
     2941        /* Don't allow a SACL set from an NTtrans create until we
     2942         * support SeSecurityPrivilege. */
     2943        if (!VALID_STAT(sbuf) &&
     2944                        lp_nt_acl_support(SNUM(conn)) &&
     2945                        sd && (sd->sacl != NULL)) {
     2946                status = NT_STATUS_PRIVILEGE_NOT_HELD;
     2947                goto fail;
     2948        }
    28992949#endif
    29002950
  • branches/samba-3.3.x/source/smbd/reply.c

    r221 r222  
    22642264
    22652265        if (S_ISDIR(pst->st_mode)) {
     2266                if (fsp->posix_open) {
     2267                        return NT_STATUS_OK;
     2268                }
     2269
     2270                /* If no pathnames are open below this
     2271                   directory, allow the rename. */
     2272
     2273                if (file_find_subpath(fsp)) {
     2274                        return NT_STATUS_ACCESS_DENIED;
     2275                }
    22662276                return NT_STATUS_OK;
    22672277        }
     
    27802790                return;
    27812791        }
     2792
     2793normal_readbraw:
    27822794#endif
    2783 
    2784 normal_readbraw:
    27852795
    27862796        outbuf = TALLOC_ARRAY(NULL, char, nread+4);
  • branches/samba-3.3.x/source/smbd/service.c

    r206 r222  
    839839                        return NULL;
    840840                }
     841
     842                /*
     843                 * We need to cache this gid, to use within
     844                 * change_to_user() separately from the conn->server_info
     845                 * struct. We only use conn->server_info directly if
     846                 * "force_user" was set.
     847                 */
     848                conn->force_group_gid = conn->server_info->utok.gid;
    841849        }
    842850
  • branches/samba-3.3.x/source/smbd/trans2.c

    r206 r222  
    49904990
    49914991static NTSTATUS smb_set_file_dosmode(connection_struct *conn,
     4992                                files_struct *fsp,
    49924993                                const char *fname,
    49934994                                SMB_STRUCT_STAT *psbuf,
     
    49984999        }
    49995000
     5001        if (fsp) {
     5002                if (fsp->base_fsp) {
     5003                        fname = fsp->base_fsp->fsp_name;
     5004                } else {
     5005                        fname = fsp->fsp_name;
     5006                }
     5007        }
     5008               
    50005009        if (dosmode) {
    50015010                if (S_ISDIR(psbuf->st_mode)) {
     
    57235732        dosmode = IVAL(pdata,32);
    57245733        status = smb_set_file_dosmode(conn,
    5725                                         fname,
    5726                                         psbuf,
    5727                                         dosmode);
     5734                                fsp,
     5735                                fname,
     5736                                psbuf,
     5737                                dosmode);
     5738
    57285739        if (!NT_STATUS_IS_OK(status)) {
    57295740                return status;
     
    63906401        } else if((wire_open_mode & SMB_O_CREAT) == SMB_O_CREAT) {
    63916402                create_disp = FILE_OPEN_IF;
     6403        } else if ((wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL | SMB_O_TRUNC)) == 0) {
     6404                create_disp = FILE_OPEN;
    63926405        } else {
    63936406                DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n",
  • branches/samba-3.3.x/source/smbd/uid.c

    r206 r222  
    257257        if((group_c = *lp_force_group(snum))) {
    258258
     259                SMB_ASSERT(conn->force_group_gid != (gid_t)-1);
     260
    259261                if(group_c == '+') {
    260262
     
    269271                        for (i = 0; i < num_groups; i++) {
    270272                                if (group_list[i]
    271                                     == conn->server_info->utok.gid) {
    272                                         gid = conn->server_info->utok.gid;
     273                                    == conn->force_group_gid) {
     274                                        conn->server_info->utok.gid =
     275                                                conn->force_group_gid;
     276                                        gid = conn->force_group_gid;
    273277                                        gid_to_sid(&conn->server_info->ptok
    274278                                                   ->user_sids[1], gid);
     
    277281                        }
    278282                } else {
    279                         gid = conn->server_info->utok.gid;
     283                        conn->server_info->utok.gid = conn->force_group_gid;
     284                        gid = conn->force_group_gid;
    280285                        gid_to_sid(&conn->server_info->ptok->user_sids[1],
    281286                                   gid);
Note: See TracChangeset for help on using the changeset viewer.