summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-02-24 05:47:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:22 -0500
commitf690a968e789da8a77338afbe5490b865c25cc99 (patch)
tree7d495a9585b832ebe2d45272e6c2b83323b89b2b /source3
parentffba826a17f0631d25d479c238d9a1bf5e9cf3e9 (diff)
downloadsamba-f690a968e789da8a77338afbe5490b865c25cc99.tar.gz
samba-f690a968e789da8a77338afbe5490b865c25cc99.tar.bz2
samba-f690a968e789da8a77338afbe5490b865c25cc99.zip
r13669: Get rid of poor errno mapping table. Bounce through NTSTATUS instead.
DO NOT MERGE FOR 3.0.21c PLEASE. Jeremy. (This used to be commit 3de0d9af6925e3dc0328c02c2a30127ea5c82a83)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clierror.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 9d7555a720..b84a8ee70f 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -230,42 +230,6 @@ void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode)
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 @@ static int cli_errno_from_nt(NTSTATUS status)
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 @@ int cli_errno(struct cli_state *cli)
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 */