[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
[sfrench/samba-autobuild/.git] / source3 / libsmb / clierror.c
index fcedc3bdab163aeb808b824f5c47e304a7745948..be018074eb5d521b7ae969cee596e5a2891ccc06 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -331,7 +330,9 @@ static const struct {
 #ifdef ECOMM
        {NT_STATUS_NET_WRITE_FAULT, ECOMM},
 #endif
-
+#ifdef EXDEV
+       {NT_STATUS_NOT_SAME_DEVICE, EXDEV},
+#endif
        {NT_STATUS(0), 0}
 };
 
@@ -380,6 +381,15 @@ int cli_errno(struct cli_state *cli)
                return cli_errno_from_nt(status);
         }
 
+        /*
+         * Yuck!  A special case for this Vista error.  Since its high-order
+         * byte isn't 0xc0, it doesn't match cli_is_nt_error() above.
+         */
+        status = cli_nt_error(cli);
+        if (NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT)) {
+            return EACCES;
+        }
+
        /* for other cases */
        return EINVAL;
 }
@@ -451,3 +461,12 @@ NTSTATUS cli_get_nt_error(struct cli_state *cli)
                return NT_STATUS_UNSUCCESSFUL;
        }
 }
+
+/* Push an error code into the inbuf to be returned on the next
+ * query. */
+
+void cli_set_nt_error(struct cli_state *cli, NTSTATUS status)
+{
+       SSVAL(cli->inbuf,smb_flg2, SVAL(cli->inbuf,smb_flg2)|FLAGS2_32_BIT_ERROR_CODES);
+       SIVAL(cli->inbuf, smb_rcls, NT_STATUS_V(status));
+}