Move the callers that need to use the new cli_open() back to calling
authorJeremy Allison <jra@samba.org>
Sun, 4 Dec 2011 05:36:47 +0000 (21:36 -0800)
committerJeremy Allison <jra@samba.org>
Sun, 4 Dec 2011 05:36:47 +0000 (21:36 -0800)
it from cli_openx().

source3/client/client.c
source3/client/client_proto.h
source3/client/clitar.c
source3/client/smbspool.c
source3/libsmb/libsmb_file.c
source3/utils/net_rpc_printer.c

index 074fbc93bc496dfd132a63050f8a8cfe1c812918..47d44705d2d80d9758703168e68fad53af9e2727 100644 (file)
@@ -300,121 +300,6 @@ static void send_message(const char *username)
        }
 }
 
-/****************************************************************************
- Wrapper function around cli_open() that does an NtCreateX open by preference.
-****************************************************************************/
-
-NTSTATUS smbclient_cli_open(struct cli_state *cli, const char *fname, int flags,
-                       int share_mode_in, uint16_t *pfnum)
-{
-       NTSTATUS status;
-       unsigned int openfn = 0;
-       unsigned int dos_deny = 0;
-       uint32_t access_mask, share_mode, create_disposition, create_options;
-
-       /* Do the initial mapping into OpenX parameters. */
-       if (flags & O_CREAT) {
-               openfn |= (1<<4);
-       }
-       if (!(flags & O_EXCL)) {
-               if (flags & O_TRUNC)
-                       openfn |= (1<<1);
-               else
-                       openfn |= (1<<0);
-       }
-
-       dos_deny = (share_mode_in<<4);
-
-       if ((flags & O_ACCMODE) == O_RDWR) {
-               dos_deny |= 2;
-       } else if ((flags & O_ACCMODE) == O_WRONLY) {
-               dos_deny |= 1;
-       }
-
-#if defined(O_SYNC)
-       if ((flags & O_SYNC) == O_SYNC) {
-               dos_deny |= (1<<14);
-       }
-#endif /* O_SYNC */
-
-       if (share_mode_in == DENY_FCB) {
-               dos_deny = 0xFF;
-       }
-
-#if 0
-       /* Hmmm. This is what I think the above code
-          should look like if it's using the constants
-          we #define. JRA. */
-
-       if (flags & O_CREAT) {
-               openfn |= OPENX_FILE_CREATE_IF_NOT_EXIST;
-       }
-       if (!(flags & O_EXCL)) {
-               if (flags & O_TRUNC)
-                       openfn |= OPENX_FILE_EXISTS_TRUNCATE;
-               else
-                       openfn |= OPENX_FILE_EXISTS_OPEN;
-       }
-
-       dos_deny = SET_DENY_MODE(share_mode_in);
-
-       if ((flags & O_ACCMODE) == O_RDWR) {
-               dos_deny |= DOS_OPEN_RDWR;
-       } else if ((flags & O_ACCMODE) == O_WRONLY) {
-               dos_deny |= DOS_OPEN_WRONLY;
-       }
-
-#if defined(O_SYNC)
-       if ((flags & O_SYNC) == O_SYNC) {
-               dos_deny |= FILE_SYNC_OPENMODE;
-       }
-#endif /* O_SYNC */
-
-       if (share_mode_in == DENY_FCB) {
-               dos_deny = 0xFF;
-       }
-#endif
-
-       if (!map_open_params_to_ntcreate(fname, dos_deny,
-                                       openfn, &access_mask,
-                                       &share_mode, &create_disposition,
-                                       &create_options, NULL)) {
-               goto try_openx;
-       }
-
-       status = cli_ntcreate(cli,
-                               fname,
-                               0,
-                               access_mask,
-                               0,
-                               share_mode,
-                               create_disposition,
-                               create_options,
-                               0,
-                               pfnum);
-
-       /* Try and cope will all varients of "we don't do this call"
-          and fall back to openX. */
-
-       if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_IMPLEMENTED) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_INVALID_INFO_CLASS) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_PROCEDURE_NOT_FOUND) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_INVALID_LEVEL) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_INVALID_PARAMETER) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_INVALID_DEVICE_REQUEST) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_INVALID_DEVICE_STATE) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_CTL_FILE_NOT_SUPPORTED) ||
-                       NT_STATUS_EQUAL(status,NT_STATUS_UNSUCCESSFUL)) {
-               goto try_openx;
-       }
-
-       return status;
-
-  try_openx:
-
-       return cli_openx(cli, fname, flags, share_mode_in, pfnum);
-}
-
 /****************************************************************************
  Check the space on a device.
 ****************************************************************************/
@@ -1212,7 +1097,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
 
        clock_gettime_mono(&tp_start);
 
-       status = smbclient_cli_open(targetcli, targetname, O_RDONLY, DENY_NONE, &fnum);
+       status = cli_open(targetcli, targetname, O_RDONLY, DENY_NONE, &fnum);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("%s opening remote file %s\n", nt_errstr(status),
                         rname);
@@ -1971,7 +1856,7 @@ static int do_put(const char *rname, const char *lname, bool reput)
        clock_gettime_mono(&tp_start);
 
        if (reput) {
-               status = smbclient_cli_open(targetcli, targetname, O_RDWR|O_CREAT, DENY_NONE, &fnum);
+               status = cli_open(targetcli, targetname, O_RDWR|O_CREAT, DENY_NONE, &fnum);
                if (NT_STATUS_IS_OK(status)) {
                        if (!NT_STATUS_IS_OK(status = cli_qfileinfo_basic(
                                                     targetcli, fnum, NULL,
@@ -1986,7 +1871,7 @@ static int do_put(const char *rname, const char *lname, bool reput)
                        }
                }
        } else {
-               status = smbclient_cli_open(targetcli, targetname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE, &fnum);
+               status = cli_open(targetcli, targetname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE, &fnum);
        }
 
        if (!NT_STATUS_IS_OK(status)) {
index 3032e5b7aef699e1add41bb3a3ac0a1fd01d3e2c..d119014abdc79372232fa6ff47fa2269513b5a0b 100644 (file)
@@ -30,8 +30,6 @@ struct file_info;
 
 const char *client_get_cur_dir(void);
 const char *client_set_cur_dir(const char *newdir);
-NTSTATUS smbclient_cli_open(struct cli_state *cli, const char *fname, int flags,
-                       int share_mode_in, uint16_t *pfnum);
 NTSTATUS do_list(const char *mask,
                        uint16 attribute,
                        NTSTATUS (*fn)(struct cli_state *cli_state, struct file_info *,
index d8890eae3bbedc3c477be523ac228b2ef9cbb742..594392672a6f876b417ec0390c622684725e2c01 100644 (file)
@@ -655,7 +655,7 @@ static NTSTATUS do_atar(const char *rname_in, char *lname,
                goto cleanup;
        }
 
-       status = smbclient_cli_open(cli, rname, O_RDONLY, DENY_NONE, &fnum);
+       status = cli_open(cli, rname, O_RDONLY, DENY_NONE, &fnum);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("%s opening remote file %s (%s)\n",
                                nt_errstr(status),rname, client_get_cur_dir()));
@@ -1016,7 +1016,7 @@ static int get_file(file_info2 finfo)
                return False;
        }
 
-       status = smbclient_cli_open(cli, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE, &fnum);
+       status = cli_open(cli, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE, &fnum);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("abandoning restore\n"));
                return False;
index 71bdab171954e41512be9a42cc7642b681f695a9..ddae1a678521885846c1b90c243dde3e5b933cae 100644 (file)
@@ -576,7 +576,7 @@ smb_print(struct cli_state * cli,   /* I - SMB connection */
          * Open the printer device...
          */
 
-       nt_status = cli_openx(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE,
+       nt_status = cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE,
                          &fnum);
        if (!NT_STATUS_IS_OK(nt_status)) {
                fprintf(stderr, "ERROR: %s opening remote spool %s\n",
index a89c95cdab95f84202f12e3f952a9ef009d1a771..b5932c8164a9db13ad31823e17796e936dcbd787 100644 (file)
@@ -123,7 +123,7 @@ SMBC_open_ctx(SMBCCTX *context,
                }
                /*d_printf(">>>open: resolved %s as %s\n", path, targetpath);*/
 
-               status = cli_openx(targetcli, targetpath, flags,
+               status = cli_open(targetcli, targetpath, flags,
                                    context->internal->share_mode, &fd);
                if (!NT_STATUS_IS_OK(status)) {
 
@@ -633,7 +633,7 @@ SMBC_setatr(SMBCCTX * context, SMBCSRV *srv, char *path,
                 srv->no_pathinfo = True;
 
                 /* Open the file */
-                if (!NT_STATUS_IS_OK(cli_openx(srv->cli, path, O_RDWR, DENY_NONE, &fd))) {
+                if (!NT_STATUS_IS_OK(cli_open(srv->cli, path, O_RDWR, DENY_NONE, &fd))) {
                         errno = SMBC_errno(context, srv->cli);
                        TALLOC_FREE(frame);
                         return -1;
index 65a2edc8aae909ff7de327e757a9815ab5e304d1..eec5a6cacc425426bba9a00347ab7f15cea4ddee 100644 (file)
@@ -327,7 +327,7 @@ NTSTATUS net_copy_file(struct net_context *c,
        DEBUGADD(3,("opening %s %s on originating server\n",
                is_file ? "file":"dir", src_name));
        if (is_file)
-               nt_status = cli_openx(cli_share_src, src_name, O_RDONLY, DENY_NONE, &fnum_src);
+               nt_status = cli_open(cli_share_src, src_name, O_RDONLY, DENY_NONE, &fnum_src);
        else
                nt_status = cli_ntcreate(cli_share_src, src_name, 0, READ_CONTROL_ACCESS, 0,
                                FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum_src);
@@ -344,7 +344,7 @@ NTSTATUS net_copy_file(struct net_context *c,
 
                /* open file on the destination server */
                DEBUGADD(3,("opening file %s on destination server\n", dst_name));
-               nt_status = cli_openx(cli_share_dst, dst_name,
+               nt_status = cli_open(cli_share_dst, dst_name,
                                O_RDWR|O_CREAT|O_TRUNC, DENY_NONE, &fnum_dst);
 
                if (!NT_STATUS_IS_OK(nt_status)) {