svn commit: samba r13669 - in branches/SAMBA_3_0/source/libsmb: .

jra at samba.org jra at samba.org
Fri Feb 24 05:47:22 GMT 2006


Author: jra
Date: 2006-02-24 05:47:19 +0000 (Fri, 24 Feb 2006)
New Revision: 13669

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13669

Log:
Get rid of poor errno mapping table. Bounce through NTSTATUS instead.
DO NOT MERGE FOR 3.0.21c PLEASE.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/clierror.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/clierror.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clierror.c	2006-02-24 05:47:15 UTC (rev 13668)
+++ branches/SAMBA_3_0/source/libsmb/clierror.c	2006-02-24 05:47:19 UTC (rev 13669)
@@ -230,42 +230,6 @@
 	if (ecode) *ecode    = code;
 }
 
-/****************************************************************************
- The following mappings need tidying up and moving into libsmb/errormap.c...
-****************************************************************************/
-
-/* Return a UNIX errno from a dos error class, error number tuple */
-
-static int cli_errno_from_dos(uint8 eclass, uint32 num)
-{
-	if (eclass == ERRDOS) {
-		switch (num) {
-		case ERRbadfile: return ENOENT;
-		case ERRbadpath: return ENOTDIR;
-		case ERRnoaccess: return EACCES;
-		case ERRfilexists: return EEXIST;
-		case ERRrename: return EEXIST;
-		case ERRbadshare: return EBUSY;
-		case ERRlock: return EBUSY;
-		case ERRinvalidname: return ENOENT;
-		case ERRnosuchshare: return ENODEV;
-		}
-	}
-
-	if (eclass == ERRSRV) {
-		switch (num) {
-		case ERRbadpw: return EPERM;
-		case ERRaccess: return EACCES;
-		case ERRnoresource: return ENOMEM;
-		case ERRinvdevice: return ENODEV;
-		case ERRinvnetname: return ENODEV;
-		}
-	}
-
-	/* for other cases */
-	return EINVAL;
-}
-
 /* Return a UNIX errno from a NT status code */
 static struct {
 	NTSTATUS status;
@@ -405,9 +369,11 @@
 
 int cli_errno(struct cli_state *cli)
 {
+	NTSTATUS status;
+
 	if (cli_is_nt_error(cli)) {
-        	NTSTATUS status = cli_nt_error(cli);
-	        return cli_errno_from_nt(status);
+		status = cli_nt_error(cli);
+		return cli_errno_from_nt(status);
 	}
 
         if (cli_is_dos_error(cli)) {
@@ -415,7 +381,8 @@
                 uint32 ecode;
 
                 cli_dos_error(cli, &eclass, &ecode);
-                return cli_errno_from_dos(eclass, ecode);
+		status = dos_to_ntstatus(eclass, ecode);
+		return cli_errno_from_nt(status);
         }
 
 	/* for other cases */



More information about the samba-cvs mailing list