Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/ntvfs/smb2/vfs_smb2.c

    r740 r988  
    4242#include "libcli/smb2/smb2_calls.h"
    4343
     44NTSTATUS ntvfs_smb2_init(void);
     45
    4446struct cvfs_file {
    4547        struct cvfs_file *prev, *next;
     
    99101  along to the client
    100102 */
     103#if 0
    101104static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
    102105{
     
    122125        return true;
    123126}
     127#endif
    124128
    125129/*
     
    161165        struct cvfs_private *p;
    162166        const char *host, *user, *pass, *domain, *remote_share, *sharename;
    163         struct composite_context *creq;
    164167        struct share_config *scfg = ntvfs->ctx->config;
    165168        struct smb2_tree *tree;
     
    167170        bool machine_account;
    168171        struct smbcli_options options;
     172        TALLOC_CTX *tmp_ctx;
     173
     174        tmp_ctx = talloc_new(req);
     175        if (tmp_ctx == NULL) {
     176                return NT_STATUS_NO_MEMORY;
     177        }
    169178
    170179        switch (tcon->generic.level) {
     
    179188                break;
    180189        default:
    181                 return NT_STATUS_INVALID_LEVEL;
     190                status = NT_STATUS_INVALID_LEVEL;
     191                goto out;
    182192        }
    183193
     
    191201        /* Here we need to determine which server to connect to.
    192202         * For now we use parametric options, type cifs.
    193          * Later we will use security=server and auth_server.c.
    194203         */
    195         host = share_string_option(scfg, SMB2_SERVER, NULL);
    196         user = share_string_option(scfg, SMB2_USER, NULL);
    197         pass = share_string_option(scfg, SMB2_PASSWORD, NULL);
    198         domain = share_string_option(scfg, SMB2_DOMAIN, NULL);
    199         remote_share = share_string_option(scfg, SMB2_SHARE, NULL);
     204        host = share_string_option(tmp_ctx, scfg, SMB2_SERVER, NULL);
     205        user = share_string_option(tmp_ctx, scfg, SMB2_USER, NULL);
     206        pass = share_string_option(tmp_ctx, scfg, SMB2_PASSWORD, NULL);
     207        domain = share_string_option(tmp_ctx, scfg, SMB2_DOMAIN, NULL);
     208        remote_share = share_string_option(tmp_ctx, scfg, SMB2_SHARE, NULL);
    200209        if (!remote_share) {
    201210                remote_share = sharename;
     
    206215        p = talloc_zero(ntvfs, struct cvfs_private);
    207216        if (!p) {
    208                 return NT_STATUS_NO_MEMORY;
     217                status = NT_STATUS_NO_MEMORY;
     218                goto out;
    209219        }
    210220
     
    213223        if (!host) {
    214224                DEBUG(1,("CIFS backend: You must supply server\n"));
    215                 return NT_STATUS_INVALID_PARAMETER;
     225                status = NT_STATUS_INVALID_PARAMETER;
     226                goto out;
    216227        }
    217228       
     
    220231                credentials = cli_credentials_init(p);
    221232                if (!credentials) {
    222                         return NT_STATUS_NO_MEMORY;
     233                        status = NT_STATUS_NO_MEMORY;
     234                        goto out;
    223235                }
    224236                cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
     
    237249                status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
    238250                if (!NT_STATUS_IS_OK(status)) {
    239                         return status;
     251                        goto out;
    240252                }
    241253        } else if (req->session_info->credentials) {
     
    244256        } else {
    245257                DEBUG(1,("CIFS backend: NO delegated credentials found: You must supply server, user and password or the client must supply delegated credentials\n"));
    246                 return NT_STATUS_INVALID_PARAMETER;
     258                status = NT_STATUS_INVALID_PARAMETER;
     259                goto out;
    247260        }
    248261
    249262        lpcfg_smbcli_options(ntvfs->ctx->lp_ctx, &options);
    250263
    251         creq = smb2_connect_send(p, host,
     264        status = smb2_connect(p, host,
    252265                        lpcfg_parm_string_list(p, ntvfs->ctx->lp_ctx, NULL, "smb2", "ports", NULL),
    253                                 remote_share,
    254                                  lpcfg_resolve_context(ntvfs->ctx->lp_ctx),
    255                                  credentials,
    256                                  ntvfs->ctx->event_ctx, &options,
    257                                  lpcfg_socket_options(ntvfs->ctx->lp_ctx),
    258                                  lpcfg_gensec_settings(p, ntvfs->ctx->lp_ctx)
    259                                  );
    260 
    261         status = smb2_connect_recv(creq, p, &tree);
    262         NT_STATUS_NOT_OK_RETURN(status);
     266                        remote_share,
     267                        lpcfg_resolve_context(ntvfs->ctx->lp_ctx),
     268                        credentials,
     269                        &tree,
     270                        ntvfs->ctx->event_ctx, &options,
     271                        lpcfg_socket_options(ntvfs->ctx->lp_ctx),
     272                        lpcfg_gensec_settings(p, ntvfs->ctx->lp_ctx));
     273        if (!NT_STATUS_IS_OK(status)) {
     274                goto out;
     275        }
    263276
    264277        status = smb2_get_roothandle(tree, &p->roothandle);
    265         NT_STATUS_NOT_OK_RETURN(status);
     278        if (!NT_STATUS_IS_OK(status)) {
     279                goto out;
     280        }
    266281
    267282        p->tree = tree;
     
    270285
    271286        ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
    272         NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->fs_type);
     287        if (ntvfs->ctx->fs_type == NULL) {
     288                status = NT_STATUS_NO_MEMORY;
     289                goto out;
     290        }
    273291        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
    274         NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
     292        if (ntvfs->ctx->dev_type == NULL) {
     293                status = NT_STATUS_NO_MEMORY;
     294                goto out;
     295        }
    275296
    276297        if (tcon->generic.level == RAW_TCON_TCONX) {
     
    283304        smbcli_oplock_handler(p->transport, oplock_handler, p);
    284305        */
    285         return NT_STATUS_OK;
     306
     307        status = NT_STATUS_OK;
     308
     309out:
     310        TALLOC_FREE(tmp_ctx);
     311        return status;
    286312}
    287313
     
    835861       
    836862        /* fill in all the operations */
    837         ops.connect = cvfs_connect;
    838         ops.disconnect = cvfs_disconnect;
    839         ops.unlink = cvfs_unlink;
    840         ops.chkpath = cvfs_chkpath;
    841         ops.qpathinfo = cvfs_qpathinfo;
    842         ops.setpathinfo = cvfs_setpathinfo;
    843         ops.open = cvfs_open;
    844         ops.mkdir = cvfs_mkdir;
    845         ops.rmdir = cvfs_rmdir;
    846         ops.rename = cvfs_rename;
    847         ops.copy = cvfs_copy;
    848         ops.ioctl = cvfs_ioctl;
    849         ops.read = cvfs_read;
    850         ops.write = cvfs_write;
    851         ops.seek = cvfs_seek;
    852         ops.flush = cvfs_flush;
    853         ops.close = cvfs_close;
    854         ops.exit = cvfs_exit;
    855         ops.lock = cvfs_lock;
    856         ops.setfileinfo = cvfs_setfileinfo;
    857         ops.qfileinfo = cvfs_qfileinfo;
    858         ops.fsinfo = cvfs_fsinfo;
    859         ops.lpq = cvfs_lpq;
    860         ops.search_first = cvfs_search_first;
    861         ops.search_next = cvfs_search_next;
    862         ops.search_close = cvfs_search_close;
    863         ops.trans = cvfs_trans;
    864         ops.logoff = cvfs_logoff;
    865         ops.async_setup = cvfs_async_setup;
    866         ops.cancel = cvfs_cancel;
    867         ops.notify = cvfs_notify;
     863        ops.connect_fn = cvfs_connect;
     864        ops.disconnect_fn = cvfs_disconnect;
     865        ops.unlink_fn = cvfs_unlink;
     866        ops.chkpath_fn = cvfs_chkpath;
     867        ops.qpathinfo_fn = cvfs_qpathinfo;
     868        ops.setpathinfo_fn = cvfs_setpathinfo;
     869        ops.open_fn = cvfs_open;
     870        ops.mkdir_fn = cvfs_mkdir;
     871        ops.rmdir_fn = cvfs_rmdir;
     872        ops.rename_fn = cvfs_rename;
     873        ops.copy_fn = cvfs_copy;
     874        ops.ioctl_fn = cvfs_ioctl;
     875        ops.read_fn = cvfs_read;
     876        ops.write_fn = cvfs_write;
     877        ops.seek_fn = cvfs_seek;
     878        ops.flush_fn = cvfs_flush;
     879        ops.close_fn = cvfs_close;
     880        ops.exit_fn = cvfs_exit;
     881        ops.lock_fn = cvfs_lock;
     882        ops.setfileinfo_fn = cvfs_setfileinfo;
     883        ops.qfileinfo_fn = cvfs_qfileinfo;
     884        ops.fsinfo_fn = cvfs_fsinfo;
     885        ops.lpq_fn = cvfs_lpq;
     886        ops.search_first_fn = cvfs_search_first;
     887        ops.search_next_fn = cvfs_search_next;
     888        ops.search_close_fn = cvfs_search_close;
     889        ops.trans_fn = cvfs_trans;
     890        ops.logoff_fn = cvfs_logoff;
     891        ops.async_setup_fn = cvfs_async_setup;
     892        ops.cancel_fn = cvfs_cancel;
     893        ops.notify_fn = cvfs_notify;
    868894
    869895        /* register ourselves with the NTVFS subsystem. We register
Note: See TracChangeset for help on using the changeset viewer.