Changeset 222 for branches/samba-3.3.x/source/smbd
- Timestamp:
- May 24, 2009, 7:45:16 AM (16 years ago)
- 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 444 444 * client. */ 445 445 if (errno == ECANCELED) { 446 srv_cancel_sign_response(aio_ex->mid );446 srv_cancel_sign_response(aio_ex->mid, false); 447 447 return 0; 448 448 } … … 538 538 * client. */ 539 539 if (errno == ECANCELED) { 540 srv_cancel_sign_response(aio_ex->mid );540 srv_cancel_sign_response(aio_ex->mid, false); 541 541 return 0; 542 542 } … … 650 650 DEBUG(3,("process_aio_queue: Can't find record to " 651 651 "match mid %u.\n", (unsigned int)mid)); 652 srv_cancel_sign_response(mid );652 srv_cancel_sign_response(mid, false); 653 653 continue; 654 654 } … … 660 660 DEBUG( 3,( "process_aio_queue: file closed whilst " 661 661 "aio outstanding.\n")); 662 srv_cancel_sign_response(mid );662 srv_cancel_sign_response(mid, false); 663 663 continue; 664 664 } -
branches/samba-3.3.x/source/smbd/close.c
r221 r222 468 468 struct timespec ts[2]; 469 469 NTSTATUS status; 470 int ret = -1; 470 471 471 472 ZERO_STRUCT(sbuf); … … 482 483 /* Ensure we have a valid stat struct for the source. */ 483 484 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); 487 486 } 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); 491 496 } 492 497 … … 576 581 577 582 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 } 578 590 579 591 if (NT_STATUS_IS_OK(status)) { -
branches/samba-3.3.x/source/smbd/conn.c
r206 r222 146 146 } 147 147 conn->cnum = i; 148 conn->force_group_gid = (gid_t)-1; 148 149 149 150 bitmap_set(bmap, i); -
branches/samba-3.3.x/source/smbd/dnsregister.c
r221 r222 109 109 110 110 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; 112 113 if (dns_state == NULL) { 113 114 return; -
branches/samba-3.3.x/source/smbd/file_access.c
r221 r222 34 34 uint32_t access_granted; 35 35 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 } 36 41 37 42 status = SMB_VFS_GET_NT_ACL(conn, fname, -
branches/samba-3.3.x/source/smbd/files.c
r206 r222 378 378 379 379 /**************************************************************************** 380 Find any fsp open with a pathname below that of an already open path. 381 ****************************************************************************/ 382 383 bool 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 /**************************************************************************** 380 423 Sync open files on a connection. 381 424 ****************************************************************************/ -
branches/samba-3.3.x/source/smbd/nttrans.c
r206 r222 1077 1077 remove_pending_change_notify_requests_by_mid(req->mid); 1078 1078 remove_pending_lock_requests_by_mid(req->mid); 1079 srv_cancel_sign_response(req->mid );1079 srv_cancel_sign_response(req->mid, true); 1080 1080 1081 1081 DEBUG(3,("reply_ntcancel: cancel called on mid = %d.\n", req->mid)); -
branches/samba-3.3.x/source/smbd/open.c
r221 r222 59 59 60 60 *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 } 61 70 62 71 status = SMB_VFS_GET_NT_ACL(conn, fname, … … 2383 2392 } 2384 2393 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 2385 2402 switch( create_disposition ) { 2386 2403 case FILE_OPEN: … … 2463 2480 access_mask, 2464 2481 &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 2465 2501 if (!NT_STATUS_IS_OK(status)) { 2466 2502 DEBUG(10, ("open_directory: check_open_rights on " … … 2897 2933 goto fail; 2898 2934 } 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 } 2899 2949 #endif 2900 2950 -
branches/samba-3.3.x/source/smbd/reply.c
r221 r222 2264 2264 2265 2265 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 } 2266 2276 return NT_STATUS_OK; 2267 2277 } … … 2780 2790 return; 2781 2791 } 2792 2793 normal_readbraw: 2782 2794 #endif 2783 2784 normal_readbraw:2785 2795 2786 2796 outbuf = TALLOC_ARRAY(NULL, char, nread+4); -
branches/samba-3.3.x/source/smbd/service.c
r206 r222 839 839 return NULL; 840 840 } 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; 841 849 } 842 850 -
branches/samba-3.3.x/source/smbd/trans2.c
r206 r222 4990 4990 4991 4991 static NTSTATUS smb_set_file_dosmode(connection_struct *conn, 4992 files_struct *fsp, 4992 4993 const char *fname, 4993 4994 SMB_STRUCT_STAT *psbuf, … … 4998 4999 } 4999 5000 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 5000 5009 if (dosmode) { 5001 5010 if (S_ISDIR(psbuf->st_mode)) { … … 5723 5732 dosmode = IVAL(pdata,32); 5724 5733 status = smb_set_file_dosmode(conn, 5725 fname, 5726 psbuf, 5727 dosmode); 5734 fsp, 5735 fname, 5736 psbuf, 5737 dosmode); 5738 5728 5739 if (!NT_STATUS_IS_OK(status)) { 5729 5740 return status; … … 6390 6401 } else if((wire_open_mode & SMB_O_CREAT) == SMB_O_CREAT) { 6391 6402 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; 6392 6405 } else { 6393 6406 DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n", -
branches/samba-3.3.x/source/smbd/uid.c
r206 r222 257 257 if((group_c = *lp_force_group(snum))) { 258 258 259 SMB_ASSERT(conn->force_group_gid != (gid_t)-1); 260 259 261 if(group_c == '+') { 260 262 … … 269 271 for (i = 0; i < num_groups; i++) { 270 272 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; 273 277 gid_to_sid(&conn->server_info->ptok 274 278 ->user_sids[1], gid); … … 277 281 } 278 282 } else { 279 gid = conn->server_info->utok.gid; 283 conn->server_info->utok.gid = conn->force_group_gid; 284 gid = conn->force_group_gid; 280 285 gid_to_sid(&conn->server_info->ptok->user_sids[1], 281 286 gid);
Note:
See TracChangeset
for help on using the changeset viewer.