Changeset 224 for branches/samba-3.3.x/source/smbd
- Timestamp:
- May 24, 2009, 7:55:48 AM (16 years ago)
- Location:
- branches/samba-3.3.x/source/smbd
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/smbd/filename.c
r221 r224 34 34 SMB_STRUCT_STAT *pst, 35 35 char **path); 36 static int get_real_filename_mangled(connection_struct *conn, const char *path, 37 const char *name, TALLOC_CTX *mem_ctx, 38 char **found_name); 36 39 37 40 /**************************************************************************** … … 448 451 449 452 if (name_has_wildcard || 450 ( SMB_VFS_GET_REAL_FILENAME(453 (get_real_filename_mangled( 451 454 conn, dirpath, start, 452 455 talloc_tos(), &found_name) == -1)) { … … 790 793 ****************************************************************************/ 791 794 792 int get_real_filename(connection_struct *conn, const char *path,793 794 795 static int get_real_filename_mangled(connection_struct *conn, const char *path, 796 const char *name, TALLOC_CTX *mem_ctx, 797 char **found_name) 795 798 { 796 struct smb_Dir *cur_dir;797 const char *dname;798 799 bool mangled; 799 800 char *unmangled_name = NULL; 800 long curpos;801 801 802 802 mangled = mangle_is_mangled(name, conn->params); … … 839 839 name = unmangled_name; 840 840 } 841 } 841 return get_real_filename(conn, path, name, mem_ctx, 842 found_name); 843 } 844 845 return SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, 846 found_name); 847 } 848 849 int get_real_filename(connection_struct *conn, const char *path, 850 const char *name, TALLOC_CTX *mem_ctx, 851 char **found_name) 852 { 853 struct smb_Dir *cur_dir; 854 const char *dname; 855 bool mangled; 856 char *unmangled_name = NULL; 857 long curpos; 842 858 843 859 /* open the directory */ -
branches/samba-3.3.x/source/smbd/ipc.c
r206 r224 662 662 } 663 663 664 talloc_steal(talloc_tos(), state); 665 664 666 handle_trans(conn, req, state); 665 667 … … 790 792 */ 791 793 SCVAL(req->inbuf,smb_com,SMBtrans); 794 795 talloc_steal(talloc_tos(), state); 792 796 793 797 handle_trans(conn, req, state); -
branches/samba-3.3.x/source/smbd/notify.c
r206 r224 235 235 fsp->fsp_name) == -1) { 236 236 DEBUG(0, ("asprintf failed\n")); 237 TALLOC_FREE(fsp->notify); 237 238 return NT_STATUS_NO_MEMORY; 238 239 } -
branches/samba-3.3.x/source/smbd/open.c
r223 r224 3283 3283 ea_list, sd, fname)); 3284 3284 3285 /* MSDFS pathname processing must be done FIRST. 3286 MSDFS pathnames containing IPv6 addresses can 3287 be confused with NTFS stream names (they contain 3288 ":" characters. JRA. */ 3289 3290 if ((req != NULL) && (req->flags2 & FLAGS2_DFS_PATHNAMES)) { 3291 char *resolved_fname; 3292 3293 status = resolve_dfspath(talloc_tos(), conn, true, fname, 3294 &resolved_fname); 3295 3296 if (!NT_STATUS_IS_OK(status)) { 3297 /* 3298 * For PATH_NOT_COVERED we had 3299 * reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, 3300 * ERRSRV, ERRbadpath); 3301 * Need to fix in callers 3302 */ 3303 goto fail; 3304 } 3305 fname = resolved_fname; 3306 } 3307 3285 3308 /* 3286 3309 * Get the file name. … … 3410 3433 } 3411 3434 3412 if ((req != NULL) && (req->flags2 & FLAGS2_DFS_PATHNAMES)) {3413 char *resolved_fname;3414 3415 status = resolve_dfspath(talloc_tos(), conn, true, fname,3416 &resolved_fname);3417 3418 if (!NT_STATUS_IS_OK(status)) {3419 /*3420 * For PATH_NOT_COVERED we had3421 * reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,3422 * ERRSRV, ERRbadpath);3423 * Need to fix in callers3424 */3425 goto fail;3426 }3427 fname = resolved_fname;3428 }3429 3430 3435 /* 3431 3436 * Check if POSIX semantics are wanted. -
branches/samba-3.3.x/source/smbd/oplock.c
r206 r224 413 413 message_to_share_mode_entry(&msg, (char *)data->data); 414 414 415 DEBUG(10, ("Got oplock async level 2 break message from pid %d: %s/%lu\n", 416 (int)procid_to_pid(&src), file_id_string_tos(&msg.id), msg.share_file_id)); 415 DEBUG(10, ("Got oplock async level 2 break message from pid %s: " 416 "%s/%lu\n", procid_str(debug_ctx(), &src), 417 file_id_string_tos(&msg.id), msg.share_file_id)); 417 418 418 419 fsp = initial_break_processing(msg.id, msg.share_file_id); … … 456 457 457 458 /* Need to wait before sending a break message if we sent ourselves this message. */ 458 if (procid_ to_pid(&src) == sys_getpid()) {459 if (procid_is_me(&src)) { 459 460 wait_before_sending_break(); 460 461 } … … 508 509 message_to_share_mode_entry(&msg, (char *)data->data); 509 510 510 DEBUG(10, ("Got oplock break message from pid %d: %s/%lu\n", 511 (int)procid_to_pid(&src), file_id_string_tos(&msg.id), msg.share_file_id)); 511 DEBUG(10, ("Got oplock break message from pid %s: %s/%lu\n", 512 procid_str(debug_ctx(), &src), file_id_string_tos(&msg.id), 513 msg.share_file_id)); 512 514 513 515 fsp = initial_break_processing(msg.id, msg.share_file_id); … … 563 565 564 566 /* Need to wait before sending a break message if we sent ourselves this message. */ 565 if (procid_ to_pid(&src) == sys_getpid()) {567 if (procid_is_me(&src)) { 566 568 wait_before_sending_break(); 567 569 } … … 622 624 file_id = (unsigned long)IVAL(data->data, 16); 623 625 624 DEBUG(10, ("Got kernel oplock break message from pid % d: %s/%u\n",625 (int)procid_to_pid(&src), file_id_string_tos(&id),626 DEBUG(10, ("Got kernel oplock break message from pid %s: %s/%u\n", 627 procid_str(debug_ctx(), &src), file_id_string_tos(&id), 626 628 (unsigned int)file_id)); 627 629 … … 714 716 message_to_share_mode_entry(&msg, (char *)data->data); 715 717 716 DEBUG(10, ("Got oplock break response from pid % d: %s/%lu mid %u\n",717 (int)procid_to_pid(&src), file_id_string_tos(&msg.id), msg.share_file_id,718 (unsigned int)msg.op_mid));718 DEBUG(10, ("Got oplock break response from pid %s: %s/%lu mid %u\n", 719 procid_str(debug_ctx(), &src), file_id_string_tos(&msg.id), 720 msg.share_file_id, (unsigned int)msg.op_mid)); 719 721 720 722 /* Here's the hack from open.c, store the mid in the 'port' field */ … … 743 745 message_to_share_mode_entry(&msg, (char *)data->data); 744 746 745 DEBUG(10, ("Got open retry msg from pid % d: %s mid %u\n",746 (int)procid_to_pid(&src), file_id_string_tos(&msg.id),747 DEBUG(10, ("Got open retry msg from pid %s: %s mid %u\n", 748 procid_str(debug_ctx(), &src), file_id_string_tos(&msg.id), 747 749 (unsigned int)msg.op_mid)); 748 750 -
branches/samba-3.3.x/source/smbd/posix_acls.c
r221 r224 4 4 Copyright (C) Jeremy Allison 1994-2000. 5 5 Copyright (C) Andreas Gruenbacher 2002. 6 Copyright (C) Simo Sorce <idra@samba.org> 2009. 6 7 7 8 This program is free software; you can redistribute it and/or modify … … 2815 2816 } 2816 2817 2818 /* 2819 * Add or Replace ACE entry. 2820 * In some cases we need to add a specific ACE for compatibility reasons. 2821 * When doing that we must make sure we are not actually creating a duplicate 2822 * entry. So we need to search whether an ACE entry already exist and eventually 2823 * replacce the access mask, or add a completely new entry if none was found. 2824 * 2825 * This function assumes the array has enough space to add a new entry without 2826 * any reallocation of memory. 2827 */ 2828 2829 static void add_or_replace_ace(SEC_ACE *nt_ace_list, size_t *num_aces, 2830 const DOM_SID *sid, enum security_ace_type type, 2831 uint32_t mask, uint8_t flags) 2832 { 2833 int i; 2834 2835 /* first search for a duplicate */ 2836 for (i = 0; i < *num_aces; i++) { 2837 if (sid_equal(&nt_ace_list[i].trustee, sid) && 2838 (nt_ace_list[i].flags == flags)) break; 2839 } 2840 2841 if (i < *num_aces) { /* found */ 2842 nt_ace_list[i].type = type; 2843 nt_ace_list[i].access_mask = mask; 2844 DEBUG(10, ("Replacing ACE %d with SID %s and flags %02x\n", 2845 i, sid_string_dbg(sid), flags)); 2846 return; 2847 } 2848 2849 /* not found, append it */ 2850 init_sec_ace(&nt_ace_list[(*num_aces)++], sid, type, mask, flags); 2851 } 2852 2853 2817 2854 /**************************************************************************** 2818 2855 Reply to query a security descriptor from an fsp. If it succeeds it allocates … … 2842 2879 SEC_ACE *nt_ace_list = NULL; 2843 2880 size_t num_profile_acls = 0; 2881 DOM_SID orig_owner_sid; 2844 2882 SEC_DESC *psd = NULL; 2883 int i; 2845 2884 2846 2885 /* … … 2848 2887 */ 2849 2888 2889 create_file_sids(sbuf, &owner_sid, &group_sid); 2890 2850 2891 if (lp_profile_acls(SNUM(conn))) { 2851 2892 /* For WXP SP1 the owner must be administrators. */ 2893 sid_copy(&orig_owner_sid, &owner_sid); 2852 2894 sid_copy(&owner_sid, &global_sid_Builtin_Administrators); 2853 2895 sid_copy(&group_sid, &global_sid_Builtin_Users); 2854 num_profile_acls = 2; 2855 } else { 2856 create_file_sids(sbuf, &owner_sid, &group_sid); 2896 num_profile_acls = 3; 2857 2897 } 2858 2898 … … 2976 3016 * if we can't map the SID. */ 2977 3017 if (lp_profile_acls(SNUM(conn))) { 2978 init_sec_ace(&nt_ace_list[num_aces++],2979 &global_sid_Builtin_Users,2980 SEC_ACE_TYPE_ACCESS_ALLOWED,2981 FILE_GENERIC_ALL, 0);3018 add_or_replace_ace(nt_ace_list, &num_aces, 3019 &global_sid_Builtin_Users, 3020 SEC_ACE_TYPE_ACCESS_ALLOWED, 3021 FILE_GENERIC_ALL, 0); 2982 3022 } 2983 3023 … … 3001 3041 * if we can't map the SID. */ 3002 3042 if (lp_profile_acls(SNUM(conn))) { 3003 init_sec_ace(&nt_ace_list[num_aces++], &global_sid_Builtin_Users, SEC_ACE_TYPE_ACCESS_ALLOWED, FILE_GENERIC_ALL, 3004 SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT| 3005 SEC_ACE_FLAG_INHERIT_ONLY|0); 3043 add_or_replace_ace(nt_ace_list, &num_aces, 3044 &global_sid_Builtin_Users, 3045 SEC_ACE_TYPE_ACCESS_ALLOWED, 3046 FILE_GENERIC_ALL, 3047 SEC_ACE_FLAG_OBJECT_INHERIT | 3048 SEC_ACE_FLAG_CONTAINER_INHERIT | 3049 SEC_ACE_FLAG_INHERIT_ONLY); 3006 3050 } 3007 3051 … … 3014 3058 num_aces = merge_default_aces(nt_ace_list, num_aces); 3015 3059 3060 if (lp_profile_acls(SNUM(conn))) { 3061 for (i = 0; i < num_aces; i++) { 3062 if (sid_equal(&nt_ace_list[i].trustee, &owner_sid)) { 3063 add_or_replace_ace(nt_ace_list, &num_aces, 3064 &orig_owner_sid, 3065 nt_ace_list[i].type, 3066 nt_ace_list[i].access_mask, 3067 nt_ace_list[i].flags); 3068 break; 3069 } 3070 } 3071 } 3016 3072 } 3017 3073 -
branches/samba-3.3.x/source/smbd/uid.c
r222 r224 167 167 if (ent->vuid == vuid) { 168 168 ent->vuid = UID_FIELD_INVALID; 169 /* Ensure we're not freeing an active pointer. */ 170 if (conn->server_info == ent->server_info) { 171 conn->server_info = NULL; 172 } 169 173 TALLOC_FREE(ent->server_info); 170 174 ent->read_only = False; … … 218 222 219 223 server_info = vuser ? vuser->server_info : conn->server_info; 224 225 if (!server_info) { 226 /* Invalid vuid sent - even with security = share. */ 227 DEBUG(2,("change_to_user: Invalid vuid %d used on " 228 "share %s.\n",vuid, lp_servicename(snum) )); 229 return false; 230 } 220 231 221 232 if (!check_user_ok(conn, vuid, server_info, snum)) {
Note:
See TracChangeset
for help on using the changeset viewer.