Ignore:
Timestamp:
Jul 1, 2011, 4:02:23 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update vendor to version 3.5.8

Location:
vendor/current/source3/smbd
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/smbd/conn.c

    r414 r594  
    198198        pipes_struct *plist = NULL;
    199199        connection_struct *conn;
     200        bool ret = true;
    200201
    201202        if (deadtime <= 0)
     
    210211                        conn->lastused = t;
    211212                        conn->lastused_count = t;
     213                        age = 0;
    212214                }
    213215
     
    218220
    219221                if (conn->num_files_open > 0 || age < deadtime) {
    220                         return False;
     222                        ret = false;
    221223                }
    222224        }
     
    230232             plist = get_next_internal_pipe(plist)) {
    231233                if (num_pipe_handles(plist->pipe_handles) != 0) {
    232                         return False;
     234                        ret = false;
     235                        break;
    233236                }
    234237        }
    235238       
    236         return True;
     239        return ret;
    237240}
    238241
  • vendor/current/source3/smbd/dosmode.c

    r414 r594  
    412412                 */
    413413
    414                 if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, smb_fname,
     414                if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname,
    415415                                                      &fsp)))
    416416                        return ret;
     
    422422                }
    423423                unbecome_root();
    424                 close_file_fchmod(NULL, fsp);
     424                close_file(NULL, fsp, NORMAL_CLOSE);
    425425                return ret;
    426426        }
     
    821821                 * still in our current user context. This ensures we
    822822                 * are not violating security in doing the fchmod.
    823                  * This file open does *not* break any oplocks we are
    824                  * holding. We need to review this.... may need to
    825                  * break batch oplocks open by others. JRA.
    826823                 */
    827824                files_struct *fsp;
    828                 if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, smb_fname,
     825                if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname,
    829826                                     &fsp)))
    830827                        return -1;
     
    832829                ret = SMB_VFS_FCHMOD(fsp, unixmode);
    833830                unbecome_root();
    834                 close_file_fchmod(NULL, fsp);
     831                close_file(NULL, fsp, NORMAL_CLOSE);
    835832                if (!newfile) {
    836833                        notify_fname(conn, NOTIFY_ACTION_MODIFIED,
  • vendor/current/source3/smbd/msdfs.c

    r478 r594  
    796796
    797797NTSTATUS get_referred_path(TALLOC_CTX *ctx,
     798                        struct auth_serversupplied_info *server_info,
    798799                        const char *dfs_path,
    799800                        struct junction_map *jucn,
     
    917918
    918919        status = create_conn_struct(ctx, &conn, snum, lp_pathname(snum),
    919                                     NULL, &oldpath);
     920                                    server_info, &oldpath);
    920921        if (!NT_STATUS_IS_OK(status)) {
    921922                TALLOC_FREE(pdp);
     
    12221223
    12231224        /* The following call can change cwd. */
    1224         *pstatus = get_referred_path(ctx, pathnamep, junction,
    1225                         &consumedcnt, &self_referral);
     1225        *pstatus = get_referred_path(ctx, orig_conn->server_info,
     1226                                     pathnamep, junction,
     1227                                     &consumedcnt, &self_referral);
    12261228        if (!NT_STATUS_IS_OK(*pstatus)) {
    12271229                vfs_ChDir(orig_conn,orig_conn->connectpath);
  • vendor/current/source3/smbd/nttrans.c

    r581 r594  
    834834        NTSTATUS status;
    835835
    836         if (sd_len == 0 || !lp_nt_acl_support(SNUM(fsp->conn))) {
     836        if (sd_len == 0) {
     837                return NT_STATUS_INVALID_PARAMETER;
     838        }
     839
     840        if (!CAN_WRITE(fsp->conn)) {
     841                return NT_STATUS_ACCESS_DENIED;
     842        }
     843
     844        if (!lp_nt_acl_support(SNUM(fsp->conn))) {
    837845                return NT_STATUS_OK;
    838846        }
     
    851859        }
    852860
    853         /* Convert all the generic bits. */
    854         security_acl_map_generic(psd->dacl, &file_generic_mapping);
    855         security_acl_map_generic(psd->sacl, &file_generic_mapping);
     861        /* Ensure we have at least one thing set. */
     862        if ((security_info_sent & (SECINFO_OWNER|SECINFO_GROUP|SECINFO_DACL|SECINFO_SACL)) == 0) {
     863                return NT_STATUS_INVALID_PARAMETER;
     864        }
     865
     866        /* Ensure we have the rights to do this. */
     867        if (security_info_sent & SECINFO_OWNER) {
     868                if (!(fsp->access_mask & SEC_STD_WRITE_OWNER)) {
     869                        return NT_STATUS_ACCESS_DENIED;
     870                }
     871        }
     872
     873        if (security_info_sent & SECINFO_GROUP) {
     874                if (!(fsp->access_mask & SEC_STD_WRITE_OWNER)) {
     875                        return NT_STATUS_ACCESS_DENIED;
     876                }
     877        }
     878
     879        if (security_info_sent & SECINFO_DACL) {
     880                if (!(fsp->access_mask & SEC_STD_WRITE_DAC)) {
     881                        return NT_STATUS_ACCESS_DENIED;
     882                }
     883                /* Convert all the generic bits. */
     884                if (psd->dacl) {
     885                        security_acl_map_generic(psd->dacl, &file_generic_mapping);
     886                }
     887        }
     888
     889        if (security_info_sent & SECINFO_SACL) {
     890                if (!(fsp->access_mask & SEC_FLAG_SYSTEM_SECURITY)) {
     891                        return NT_STATUS_ACCESS_DENIED;
     892                }
     893                /* Convert all the generic bits. */
     894                if (psd->sacl) {
     895                        security_acl_map_generic(psd->sacl, &file_generic_mapping);
     896                }
     897        }
    856898
    857899        if (DEBUGLEVEL >= 10) {
     
    17961838         */
    17971839
     1840        if ((security_info_wanted & SECINFO_SACL) &&
     1841                        !(fsp->access_mask & SEC_FLAG_SYSTEM_SECURITY)) {
     1842                reply_nterror(req,  NT_STATUS_ACCESS_DENIED);
     1843                return;
     1844        }
     1845
     1846        if ((security_info_wanted & (SECINFO_DACL|SECINFO_OWNER|SECINFO_GROUP)) &&
     1847                        !(fsp->access_mask & SEC_STD_READ_CONTROL)) {
     1848                reply_nterror(req, NT_STATUS_ACCESS_DENIED);
     1849                return;
     1850        }
     1851
    17981852        if (!lp_nt_acl_support(SNUM(conn))) {
    17991853                status = get_null_nt_acl(talloc_tos(), &psd);
     
    18051859                reply_nterror(req, status);
    18061860                return;
     1861        }
     1862
     1863        if (!(security_info_wanted & SECINFO_OWNER)) {
     1864                psd->owner_sid = NULL;
     1865        }
     1866        if (!(security_info_wanted & SECINFO_GROUP)) {
     1867                psd->group_sid = NULL;
     1868        }
     1869        if (!(security_info_wanted & SECINFO_DACL)) {
     1870                psd->dacl = NULL;
     1871        }
     1872        if (!(security_info_wanted & SECINFO_SACL)) {
     1873                psd->sacl = NULL;
    18071874        }
    18081875
  • vendor/current/source3/smbd/open.c

    r587 r594  
    2323#include "smbd/globals.h"
    2424
     25extern struct current_user current_user;
    2526extern const struct generic_mapping file_generic_mapping;
    2627
     
    14791480        ZERO_STRUCT(id);
    14801481
     1482        /* Windows allows a new file to be created and
     1483           silently removes a FILE_ATTRIBUTE_DIRECTORY
     1484           sent by the client. Do the same. */
     1485
     1486        new_dos_attributes &= ~FILE_ATTRIBUTE_DIRECTORY;
     1487
    14811488        if (conn->printer) {
    14821489                /*
     
    19611968        if ((flags2 & O_CREAT) && lp_inherit_acls(SNUM(conn)) &&
    19621969            (def_acl = directory_has_default_acl(conn, parent_dir))) {
    1963                 unx_mode = 0777;
     1970                unx_mode = (0777 & lp_create_mask(SNUM(conn)));
    19641971        }
    19651972
     
    22652272****************************************************************************/
    22662273
    2267 NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
     2274NTSTATUS open_file_fchmod(connection_struct *conn,
    22682275                          struct smb_filename *smb_fname,
    22692276                          files_struct **result)
    22702277{
    2271         files_struct *fsp = NULL;
    2272         NTSTATUS status;
    2273 
    22742278        if (!VALID_STAT(smb_fname->st)) {
    22752279                return NT_STATUS_INVALID_PARAMETER;
    22762280        }
    22772281
    2278         status = file_new(req, conn, &fsp);
    2279         if(!NT_STATUS_IS_OK(status)) {
    2280                 return status;
    2281         }
    2282 
    2283         status = SMB_VFS_CREATE_FILE(
     2282        return SMB_VFS_CREATE_FILE(
    22842283                conn,                                   /* conn */
    22852284                NULL,                                   /* req */
     
    22922291                0,                                      /* create_options */
    22932292                0,                                      /* file_attributes */
    2294                 0,                                      /* oplock_request */
     2293                INTERNAL_OPEN_ONLY,                     /* oplock_request */
    22952294                0,                                      /* allocation_size */
    22962295                NULL,                                   /* sd */
    22972296                NULL,                                   /* ea_list */
    2298                 &fsp,                                   /* result */
     2297                result,                                 /* result */
    22992298                NULL);                                  /* pinfo */
    2300 
    2301         /*
    2302          * This is not a user visible file open.
    2303          * Don't set a share mode.
    2304          */
    2305 
    2306         if (!NT_STATUS_IS_OK(status)) {
    2307                 file_free(req, fsp);
    2308                 return status;
    2309         }
    2310 
    2311         *result = fsp;
    2312         return NT_STATUS_OK;
    2313 }
    2314 
    2315 /****************************************************************************
    2316  Close the fchmod file fd - ensure no locks are lost.
    2317 ****************************************************************************/
    2318 
    2319 NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp)
    2320 {
    2321         NTSTATUS status = fd_close(fsp);
    2322         file_free(req, fsp);
    2323         return status;
    23242299}
    23252300
     
    24402415        SMB_ASSERT(!is_ntfs_stream_smb_fname(smb_dname));
    24412416
     2417        /* Ensure we have a directory attribute. */
     2418        file_attributes |= FILE_ATTRIBUTE_DIRECTORY;
     2419
    24422420        DEBUG(5,("open_directory: opening directory %s, access_mask = 0x%x, "
    24432421                 "share_access = 0x%x create_options = 0x%x, "
     
    24682446        }
    24692447
    2470         /* We need to support SeSecurityPrivilege for this. */
    2471         if (access_mask & SEC_FLAG_SYSTEM_SECURITY) {
     2448        if ((access_mask & SEC_FLAG_SYSTEM_SECURITY) &&
     2449                        !user_has_privileges(current_user.nt_user_token, &se_security)) {
    24722450                DEBUG(10, ("open_directory: open on %s "
    24732451                        "failed - SEC_FLAG_SYSTEM_SECURITY denied.\n",
     
    29782956        }
    29792957
    2980 #if 0
    2981         /* We need to support SeSecurityPrivilege for this. */
    29822958        if ((access_mask & SEC_FLAG_SYSTEM_SECURITY) &&
    2983             !user_has_privileges(current_user.nt_user_token,
    2984                                  &se_security)) {
     2959                        !user_has_privileges(current_user.nt_user_token, &se_security)) {
     2960                DEBUG(10, ("create_file_unixpath:: open on %s "
     2961                        "failed - SEC_FLAG_SYSTEM_SECURITY denied.\n",
     2962                        smb_fname_str_dbg(smb_fname)));
    29852963                status = NT_STATUS_PRIVILEGE_NOT_HELD;
    29862964                goto fail;
    29872965        }
    2988 #else
    2989         /* We need to support SeSecurityPrivilege for this. */
    2990         if (access_mask & SEC_FLAG_SYSTEM_SECURITY) {
    2991                 status = NT_STATUS_PRIVILEGE_NOT_HELD;
    2992                 goto fail;
    2993         }
    2994         /* Don't allow a SACL set from an NTtrans create until we
    2995          * support SeSecurityPrivilege. */
    2996         if (!VALID_STAT(smb_fname->st) &&
    2997                         lp_nt_acl_support(SNUM(conn)) &&
    2998                         sd && (sd->sacl != NULL)) {
    2999                 status = NT_STATUS_PRIVILEGE_NOT_HELD;
    3000                 goto fail;
    3001         }
    3002 #endif
    30032966
    30042967        if ((conn->fs_capabilities & FILE_NAMED_STREAMS)
     
    32713234                                   struct smb_request *req,
    32723235                                   uint16_t root_dir_fid,
    3273                                    struct smb_filename *smb_fname)
     3236                                   const struct smb_filename *smb_fname,
     3237                                   struct smb_filename **smb_fname_out)
    32743238{
    32753239        files_struct *dir_fsp;
     
    33593323        }
    33603324
    3361         new_base_name = talloc_asprintf(smb_fname, "%s%s", parent_fname,
     3325        new_base_name = talloc_asprintf(talloc_tos(), "%s%s", parent_fname,
    33623326                                        smb_fname->base_name);
    33633327        if (new_base_name == NULL) {
     
    33663330        }
    33673331
    3368         TALLOC_FREE(smb_fname->base_name);
    3369         smb_fname->base_name = new_base_name;
    3370         status = NT_STATUS_OK;
     3332        status = filename_convert(req,
     3333                                conn,
     3334                                req->flags2 & FLAGS2_DFS_PATHNAMES,
     3335                                new_base_name,
     3336                                0,
     3337                                NULL,
     3338                                smb_fname_out);
     3339        if (!NT_STATUS_IS_OK(status)) {
     3340                goto out;
     3341        }
    33713342
    33723343 out:
     
    34153386
    34163387        if (root_dir_fid != 0) {
     3388                struct smb_filename *smb_fname_out = NULL;
    34173389                status = get_relative_fid_filename(conn, req, root_dir_fid,
    3418                                                    smb_fname);
     3390                                                   smb_fname, &smb_fname_out);
    34193391                if (!NT_STATUS_IS_OK(status)) {
    34203392                        goto fail;
    34213393                }
     3394                smb_fname = smb_fname_out;
    34223395        }
    34233396
  • vendor/current/source3/smbd/password.c

    r414 r594  
    211211        }
    212212
    213         pwd = getpwnam_alloc(talloc_tos(), username);
     213        pwd = Get_Pwnam_alloc(talloc_tos(), username);
    214214
    215215        if ((pwd == NULL) || (pwd->pw_dir[0] == '\0')) {
  • vendor/current/source3/smbd/posix_acls.c

    r427 r594  
    17461746                                           sid_string_dbg(&psa->trustee)));
    17471747                                SAFE_FREE(current_ace);
     1748                                continue;
     1749                        }
     1750
     1751                        if (lp_force_unknown_acl_user(SNUM(fsp->conn))) {
     1752                                DEBUG(10, ("create_canon_ace_lists: ignoring "
     1753                                        "unknown or foreign SID %s\n",
     1754                                        sid_string_dbg(&psa->trustee)));
     1755                                        SAFE_FREE(current_ace);
    17481756                                continue;
    17491757                        }
     
    35923600        }
    35933601
    3594         if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, smb_fname, &fsp))) {
     3602        if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname, &fsp))) {
    35953603                return -1;
    35963604        }
     
    36113619        unbecome_root();
    36123620
    3613         close_file_fchmod(NULL, fsp);
     3621        close_file(NULL, fsp, NORMAL_CLOSE);
    36143622
    36153623        return ret;
     
    38233831****************************************************************************/
    38243832
    3825 NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
     3833NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd_orig)
    38263834{
    38273835        connection_struct *conn = fsp->conn;
     
    38383846        bool acl_set_support = false;
    38393847        bool ret = false;
     3848        SEC_DESC *psd = NULL;
    38403849
    38413850        DEBUG(10,("set_nt_acl: called for file %s\n",
     
    38473856        }
    38483857
     3858        if (!psd_orig) {
     3859                return NT_STATUS_INVALID_PARAMETER;
     3860        }
     3861
     3862        psd = dup_sec_desc(talloc_tos(), psd_orig);
     3863        if (!psd) {
     3864                return NT_STATUS_NO_MEMORY;
     3865        }
     3866
    38493867        /*
    38503868         * Get the current state of the file.
     
    38623880         * Unpack the user/group/world id's.
    38633881         */
     3882
     3883        /* POSIX can't cope with missing owner/group. */
     3884        if ((security_info_sent & SECINFO_OWNER) && (psd->owner_sid == NULL)) {
     3885                security_info_sent &= ~SECINFO_OWNER;
     3886        }
     3887        if ((security_info_sent & SECINFO_GROUP) && (psd->group_sid == NULL)) {
     3888                security_info_sent &= ~SECINFO_GROUP;
     3889        }
    38643890
    38653891        status = unpack_nt_owners( SNUM(conn), &user, &grp, security_info_sent, psd);
     
    39123938
    39133939        create_file_sids(&fsp->fsp_name->st, &file_owner_sid, &file_grp_sid);
     3940
     3941        if((security_info_sent & SECINFO_DACL) &&
     3942                        (psd->type & SEC_DESC_DACL_PRESENT) &&
     3943                        (psd->dacl == NULL)) {
     3944                SEC_ACE ace[3];
     3945
     3946                /* We can't have NULL DACL in POSIX.
     3947                   Use owner/group/Everyone -> full access. */
     3948
     3949                init_sec_ace(&ace[0],
     3950                                &file_owner_sid,
     3951                                SEC_ACE_TYPE_ACCESS_ALLOWED,
     3952                                GENERIC_ALL_ACCESS,
     3953                                0);
     3954                init_sec_ace(&ace[1],
     3955                                &file_grp_sid,
     3956                                SEC_ACE_TYPE_ACCESS_ALLOWED,
     3957                                GENERIC_ALL_ACCESS,
     3958                                0);
     3959                init_sec_ace(&ace[2],
     3960                                &global_sid_World,
     3961                                SEC_ACE_TYPE_ACCESS_ALLOWED,
     3962                                GENERIC_ALL_ACCESS,
     3963                                0);
     3964                psd->dacl = make_sec_acl(talloc_tos(),
     3965                                        NT4_ACL_REVISION,
     3966                                        3,
     3967                                        ace);
     3968                if (psd->dacl == NULL) {
     3969                        return NT_STATUS_NO_MEMORY;
     3970                }
     3971                security_acl_map_generic(psd->dacl, &file_generic_mapping);
     3972        }
    39143973
    39153974        acl_perms = unpack_canon_ace(fsp, &fsp->fsp_name->st, &file_owner_sid,
     
    47574816        return ret_sd;
    47584817}
     4818
     4819/* Stolen shamelessly from pvfs_default_acl() in source4 :-). */
     4820
     4821NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
     4822                                        const char *name,
     4823                                        SMB_STRUCT_STAT *psbuf,
     4824                                        SEC_DESC **ppdesc)
     4825{
     4826        struct dom_sid owner_sid, group_sid;
     4827        size_t size = 0;
     4828        SEC_ACE aces[4];
     4829        uint32_t access_mask = 0;
     4830        mode_t mode = psbuf->st_ex_mode;
     4831        SEC_ACL *new_dacl = NULL;
     4832        int idx = 0;
     4833
     4834        DEBUG(10,("make_default_filesystem_acl: file %s mode = 0%o\n",
     4835                name, (int)mode ));
     4836
     4837        uid_to_sid(&owner_sid, psbuf->st_ex_uid);
     4838        gid_to_sid(&group_sid, psbuf->st_ex_gid);
     4839
     4840        /*
     4841         We provide up to 4 ACEs
     4842                - Owner
     4843                - Group
     4844                - Everyone
     4845                - NT System
     4846        */
     4847
     4848        if (mode & S_IRUSR) {
     4849                if (mode & S_IWUSR) {
     4850                        access_mask |= SEC_RIGHTS_FILE_ALL;
     4851                } else {
     4852                        access_mask |= SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE;
     4853                }
     4854        }
     4855        if (mode & S_IWUSR) {
     4856                access_mask |= SEC_RIGHTS_FILE_WRITE | SEC_STD_DELETE;
     4857        }
     4858
     4859        init_sec_ace(&aces[idx],
     4860                        &owner_sid,
     4861                        SEC_ACE_TYPE_ACCESS_ALLOWED,
     4862                        access_mask,
     4863                        0);
     4864        idx++;
     4865
     4866        access_mask = 0;
     4867        if (mode & S_IRGRP) {
     4868                access_mask |= SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE;
     4869        }
     4870        if (mode & S_IWGRP) {
     4871                /* note that delete is not granted - this matches posix behaviour */
     4872                access_mask |= SEC_RIGHTS_FILE_WRITE;
     4873        }
     4874        if (access_mask) {
     4875                init_sec_ace(&aces[idx],
     4876                        &group_sid,
     4877                        SEC_ACE_TYPE_ACCESS_ALLOWED,
     4878                        access_mask,
     4879                        0);
     4880                idx++;
     4881        }
     4882
     4883        access_mask = 0;
     4884        if (mode & S_IROTH) {
     4885                access_mask |= SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE;
     4886        }
     4887        if (mode & S_IWOTH) {
     4888                access_mask |= SEC_RIGHTS_FILE_WRITE;
     4889        }
     4890        if (access_mask) {
     4891                init_sec_ace(&aces[idx],
     4892                        &global_sid_World,
     4893                        SEC_ACE_TYPE_ACCESS_ALLOWED,
     4894                        access_mask,
     4895                        0);
     4896                idx++;
     4897        }
     4898
     4899        init_sec_ace(&aces[idx],
     4900                        &global_sid_System,
     4901                        SEC_ACE_TYPE_ACCESS_ALLOWED,
     4902                        SEC_RIGHTS_FILE_ALL,
     4903                        0);
     4904        idx++;
     4905
     4906        new_dacl = make_sec_acl(ctx,
     4907                        NT4_ACL_REVISION,
     4908                        idx,
     4909                        aces);
     4910
     4911        if (!new_dacl) {
     4912                return NT_STATUS_NO_MEMORY;
     4913        }
     4914
     4915        *ppdesc = make_sec_desc(ctx,
     4916                        SECURITY_DESCRIPTOR_REVISION_1,
     4917                        SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT,
     4918                        &owner_sid,
     4919                        &group_sid,
     4920                        NULL,
     4921                        new_dacl,
     4922                        &size);
     4923        if (!*ppdesc) {
     4924                return NT_STATUS_NO_MEMORY;
     4925        }
     4926        return NT_STATUS_OK;
     4927}
  • vendor/current/source3/smbd/process.c

    r587 r594  
    836836                END_PROFILE(smbd_idle);
    837837                errno = sav;
     838        }
     839
     840        if (selrtn == -1 && errno != EINTR) {
     841                return map_nt_error_from_unix(errno);
    838842        }
    839843
     
    18571861                 * may have updated them.
    18581862                 */
    1859                 SCVAL(req->chain_outbuf, smb_tid, CVAL(req->outbuf, smb_tid));
    1860                 SCVAL(req->chain_outbuf, smb_uid, CVAL(req->outbuf, smb_uid));
     1863                SSVAL(req->chain_outbuf, smb_tid, SVAL(req->outbuf, smb_tid));
     1864                SSVAL(req->chain_outbuf, smb_uid, SVAL(req->outbuf, smb_uid));
    18611865
    18621866                if (!smb_splice_chain(&req->chain_outbuf,
  • vendor/current/source3/smbd/uid.c

    r414 r594  
    3232        struct passwd *pass;
    3333
    34         pass = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount());
     34        pass = Get_Pwnam_alloc(talloc_autofree_context(), lp_guestaccount());
    3535        if (!pass) {
    3636                return false;
  • vendor/current/source3/smbd/vfs.c

    r414 r594  
    583583        }
    584584
     585#ifdef S_ISFIFO
     586        if (S_ISFIFO(st.st_ex_mode)) {
     587                return 0;
     588        }
     589#endif
     590
    585591        DEBUG(10,("vfs_fill_sparse: write zeros in file %s from len %.0f to "
    586592                  "len %.0f (%.0f bytes)\n", fsp_str_dbg(fsp),
     
    591597
    592598        flush_write_cache(fsp, SIZECHANGE_FLUSH);
     599
     600
     601        offset = st.st_ex_size;
     602        num_to_write = len - st.st_ex_size;
     603
     604        /* Only do this on non-stream file handles. */
     605        if (fsp->base_fsp == NULL) {
     606                /* for allocation try posix_fallocate first. This can fail on some
     607                 * platforms e.g. when the filesystem doesn't support it and no
     608                 * emulation is being done by the libc (like on AIX with JFS1). In that
     609                 * case we do our own emulation. posix_fallocate implementations can
     610                 * return ENOTSUP or EINVAL in cases like that. */
     611                ret = sys_posix_fallocate(fsp->fh->fd, offset, num_to_write);
     612                if (ret == ENOSPC) {
     613                        errno = ENOSPC;
     614                        ret = -1;
     615                        goto out;
     616                }
     617                if (ret == 0) {
     618                        set_filelen_write_cache(fsp, len);
     619                        goto out;
     620                }
     621
     622                DEBUG(10,("vfs_fill_sparse: sys_posix_fallocate failed with "
     623                        "error %d. Falling back to slow manual allocation\n", ret));
     624        }
    593625
    594626        if (!sparse_buf) {
     
    601633        }
    602634
    603         offset = st.st_ex_size;
    604         num_to_write = len - st.st_ex_size;
    605635        total = 0;
    606636
     
    929959                        }
    930960                        default:
    931                                 DEBUG(1,("check_reduced_name: couldn't get "
     961                                DEBUG(3,("check_reduced_name: couldn't get "
    932962                                         "realpath for %s\n", fname));
    933963                                return map_nt_error_from_unix(errno);
Note: See TracChangeset for help on using the changeset viewer.