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

Update Samba 3.3 branch to 3.3.4

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  
    3434                                  SMB_STRUCT_STAT *pst,
    3535                                  char **path);
     36static int get_real_filename_mangled(connection_struct *conn, const char *path,
     37                                     const char *name, TALLOC_CTX *mem_ctx,
     38                                     char **found_name);
    3639
    3740/****************************************************************************
     
    448451
    449452                        if (name_has_wildcard ||
    450                             (SMB_VFS_GET_REAL_FILENAME(
     453                            (get_real_filename_mangled(
    451454                                     conn, dirpath, start,
    452455                                     talloc_tos(), &found_name) == -1)) {
     
    790793****************************************************************************/
    791794
    792 int get_real_filename(connection_struct *conn, const char *path,
    793                       const char *name, TALLOC_CTX *mem_ctx,
    794                       char **found_name)
     795static int get_real_filename_mangled(connection_struct *conn, const char *path,
     796                                     const char *name, TALLOC_CTX *mem_ctx,
     797                                     char **found_name)
    795798{
    796         struct smb_Dir *cur_dir;
    797         const char *dname;
    798799        bool mangled;
    799800        char *unmangled_name = NULL;
    800         long curpos;
    801801
    802802        mangled = mangle_is_mangled(name, conn->params);
     
    839839                        name = unmangled_name;
    840840                }
    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
     849int 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;
    842858
    843859        /* open the directory */
  • branches/samba-3.3.x/source/smbd/ipc.c

    r206 r224  
    662662        }
    663663
     664        talloc_steal(talloc_tos(), state);
     665
    664666        handle_trans(conn, req, state);
    665667
     
    790792         */
    791793        SCVAL(req->inbuf,smb_com,SMBtrans);
     794
     795        talloc_steal(talloc_tos(), state);
    792796
    793797        handle_trans(conn, req, state);
  • branches/samba-3.3.x/source/smbd/notify.c

    r206 r224  
    235235                     fsp->fsp_name) == -1) {
    236236                DEBUG(0, ("asprintf failed\n"));
     237                TALLOC_FREE(fsp->notify);
    237238                return NT_STATUS_NO_MEMORY;
    238239        }
  • branches/samba-3.3.x/source/smbd/open.c

    r223 r224  
    32833283                  ea_list, sd, fname));
    32843284
     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
    32853308        /*
    32863309         * Get the file name.
     
    34103433        }
    34113434
    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 had
    3421                          * reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
    3422                          *                 ERRSRV, ERRbadpath);
    3423                          * Need to fix in callers
    3424                          */
    3425                         goto fail;
    3426                 }
    3427                 fname = resolved_fname;
    3428         }
    3429 
    34303435        /*
    34313436         * Check if POSIX semantics are wanted.
  • branches/samba-3.3.x/source/smbd/oplock.c

    r206 r224  
    413413        message_to_share_mode_entry(&msg, (char *)data->data);
    414414
    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));
    417418
    418419        fsp = initial_break_processing(msg.id, msg.share_file_id);
     
    456457
    457458        /* 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)) {
    459460                wait_before_sending_break();
    460461        }
     
    508509        message_to_share_mode_entry(&msg, (char *)data->data);
    509510
    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));
    512514
    513515        fsp = initial_break_processing(msg.id, msg.share_file_id);
     
    563565
    564566        /* 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)) {
    566568                wait_before_sending_break();
    567569        }
     
    622624        file_id = (unsigned long)IVAL(data->data, 16);
    623625
    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),
    626628                   (unsigned int)file_id));
    627629
     
    714716        message_to_share_mode_entry(&msg, (char *)data->data);
    715717
    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));
    719721
    720722        /* Here's the hack from open.c, store the mid in the 'port' field */
     
    743745        message_to_share_mode_entry(&msg, (char *)data->data);
    744746
    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),
    747749                   (unsigned int)msg.op_mid));
    748750
  • branches/samba-3.3.x/source/smbd/posix_acls.c

    r221 r224  
    44   Copyright (C) Jeremy Allison 1994-2000.
    55   Copyright (C) Andreas Gruenbacher 2002.
     6   Copyright (C) Simo Sorce <idra@samba.org> 2009.
    67
    78   This program is free software; you can redistribute it and/or modify
     
    28152816}
    28162817
     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
     2829static 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
    28172854/****************************************************************************
    28182855 Reply to query a security descriptor from an fsp. If it succeeds it allocates
     
    28422879        SEC_ACE *nt_ace_list = NULL;
    28432880        size_t num_profile_acls = 0;
     2881        DOM_SID orig_owner_sid;
    28442882        SEC_DESC *psd = NULL;
     2883        int i;
    28452884
    28462885        /*
     
    28482887         */
    28492888
     2889        create_file_sids(sbuf, &owner_sid, &group_sid);
     2890
    28502891        if (lp_profile_acls(SNUM(conn))) {
    28512892                /* For WXP SP1 the owner must be administrators. */
     2893                sid_copy(&orig_owner_sid, &owner_sid);
    28522894                sid_copy(&owner_sid, &global_sid_Builtin_Administrators);
    28532895                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;
    28572897        }
    28582898
     
    29763016                         * if we can't map the SID. */
    29773017                        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);
    29823022                        }
    29833023
     
    30013041                         * if we can't map the SID. */
    30023042                        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);
    30063050                        }
    30073051
     
    30143058                        num_aces = merge_default_aces(nt_ace_list, num_aces);
    30153059
     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                        }
    30163072                }
    30173073
  • branches/samba-3.3.x/source/smbd/uid.c

    r222 r224  
    167167                if (ent->vuid == vuid) {
    168168                        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                        }
    169173                        TALLOC_FREE(ent->server_info);
    170174                        ent->read_only = False;
     
    218222
    219223        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        }
    220231
    221232        if (!check_user_ok(conn, vuid, server_info, snum)) {
Note: See TracChangeset for help on using the changeset viewer.