diff options
author | Tim Potter <tpot@samba.org> | 2002-03-17 06:04:15 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-03-17 06:04:15 +0000 |
commit | a4cce223d6873400b053872a6e3b2eb8621eea45 (patch) | |
tree | 5b1b751221512035ab3588b72d9ef5cbdd35c55b /source3/libsmb | |
parent | ab13654dc9ac23872e4d1384e1c54e336f113009 (diff) | |
download | samba-a4cce223d6873400b053872a6e3b2eb8621eea45.tar.gz samba-a4cce223d6873400b053872a6e3b2eb8621eea45.tar.bz2 samba-a4cce223d6873400b053872a6e3b2eb8621eea45.zip |
Added dos_errstr() function. Not all errors in list yet.
(This used to be commit ddb5753e36b8c5efb48ce5c82c16d970fb8e76b6)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/doserr.c | 88 | ||||
-rw-r--r-- | source3/libsmb/smberr.c | 12 |
2 files changed, 88 insertions, 12 deletions
diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c new file mode 100644 index 0000000000..5e9da2fc49 --- /dev/null +++ b/source3/libsmb/doserr.c @@ -0,0 +1,88 @@ +/* + * Unix SMB/CIFS implementation. + * DOS error routines + * Copyright (C) Tim Potter 2002. + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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. + */ + +/* DOS error codes. please read doserr.h */ + +#include "includes.h" + +typedef const struct +{ + char *dos_errstr; + WERROR werror; +} werror_code_struct; + +werror_code_struct dos_errs[] = +{ + { "WERR_OK", WERR_OK }, + { "WERR_BADFILE", WERR_BADFILE }, + { "WERR_ACCESS_DENIED", WERR_ACCESS_DENIED }, + { "WERR_BADFID", WERR_BADFID }, + { "WERR_BADFUNC", WERR_BADFUNC }, + { "WERR_INSUFFICIENT_BUFFER", WERR_INSUFFICIENT_BUFFER }, + { "WERR_NO_SUCH_SHARE", WERR_NO_SUCH_SHARE }, + { "WERR_ALREADY_EXISTS", WERR_ALREADY_EXISTS }, + { "WERR_INVALID_PARAM", WERR_INVALID_PARAM }, + { "WERR_NOT_SUPPORTED", WERR_NOT_SUPPORTED }, + { "WERR_BAD_PASSWORD", WERR_BAD_PASSWORD }, + { "WERR_NOMEM", WERR_NOMEM }, + { "WERR_INVALID_NAME", WERR_INVALID_NAME }, + { "WERR_UNKNOWN_LEVEL", WERR_UNKNOWN_LEVEL }, + { "WERR_OBJECT_PATH_INVALID", WERR_OBJECT_PATH_INVALID }, + { "WERR_NO_MORE_ITEMS", WERR_NO_MORE_ITEMS }, + { "WERR_MORE_DATA", WERR_MORE_DATA }, + { "WERR_UNKNOWN_PRINTER_DRIVER", WERR_UNKNOWN_PRINTER_DRIVER }, + { "WERR_INVALID_PRINTER_NAME", WERR_INVALID_PRINTER_NAME }, + { "WERR_PRINTER_ALREADY_EXISTS", WERR_PRINTER_ALREADY_EXISTS }, + { "WERR_INVALID_DATATYPE", WERR_INVALID_DATATYPE }, + { "WERR_INVALID_ENVIRONMENT", WERR_INVALID_ENVIRONMENT }, + { "WERR_INVALID_FORM_SIZE", WERR_INVALID_FORM_SIZE }, + { "WERR_BUF_TOO_SMALL", WERR_BUF_TOO_SMALL }, + { "WERR_JOB_NOT_FOUND", WERR_JOB_NOT_FOUND }, + { "WERR_DEST_NOT_FOUND", WERR_DEST_NOT_FOUND }, + { "WERR_NOT_LOCAL_DOMAIN", WERR_NOT_LOCAL_DOMAIN }, + { "WERR_PRINTER_DRIVER_IN_USE", WERR_PRINTER_DRIVER_IN_USE }, + { "WERR_STATUS_MORE_ENTRIES ", WERR_STATUS_MORE_ENTRIES }, + { "WERR_DFS_NO_SUCH_VOL", WERR_DFS_NO_SUCH_VOL }, + { "WERR_DFS_NO_SUCH_SHARE", WERR_DFS_NO_SUCH_SHARE }, + { "WERR_DFS_NO_SUCH_SERVER", WERR_DFS_NO_SUCH_SERVER }, + { "WERR_DFS_INTERNAL_ERROR", WERR_DFS_INTERNAL_ERROR }, + { "WERR_DFS_CANT_CREATE_JUNCT", WERR_DFS_CANT_CREATE_JUNCT }, + { NULL, W_ERROR(0) } +}; + +/***************************************************************************** + returns a DOS error message. not amazingly helpful, but better than a number. + *****************************************************************************/ +char *dos_errstr(WERROR werror) +{ + static pstring msg; + int idx = 0; + + slprintf(msg, sizeof(msg), "DOS code 0x%08x", W_ERROR_V(werror)); + + while (dos_errs[idx].dos_errstr != NULL) { + if (W_ERROR_V(dos_errs[idx].werror) == + W_ERROR_V(werror)) + return dos_errs[idx].dos_errstr; + idx++; + } + + return msg; +} diff --git a/source3/libsmb/smberr.c b/source3/libsmb/smberr.c index 757629a2d5..84b3f507e6 100644 --- a/source3/libsmb/smberr.c +++ b/source3/libsmb/smberr.c @@ -245,18 +245,6 @@ char *smb_dos_errstr(char *inbuf) return(ret); } - -/***************************************************************************** - returns an WERROR error message. - *****************************************************************************/ -char *werror_str(WERROR status) -{ - static fstring msg; - slprintf(msg, sizeof(msg), "WIN32 code 0x%08x", W_ERROR_V(status)); - return msg; -} - - /***************************************************************************** map a unix errno to a win32 error *****************************************************************************/ |