mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
the next step in our error code handling change
- added WERROR for win32 error codes
- added a configure test for immediate structures
still lots to do, so its not enabled by default, but the main
structure is there
(This used to be commit 24f9ab683d
)
This commit is contained in:
@ -157,3 +157,5 @@
|
|||||||
#undef HAVE_NATIVE_ICONV
|
#undef HAVE_NATIVE_ICONV
|
||||||
#undef HAVE_UNIXSOCKET
|
#undef HAVE_UNIXSOCKET
|
||||||
#undef MMAP_BLACKLIST
|
#undef MMAP_BLACKLIST
|
||||||
|
#undef HAVE_IMMEDIATE_STRUCTURES
|
||||||
|
#undef HAVE_CUPS
|
||||||
|
1521
source3/configure
vendored
1521
source3/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -52,23 +52,6 @@ if test x"$samba_cv_volatile" = x"yes"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
|
||||||
# set codepage directory location
|
|
||||||
AC_ARG_WITH(codepagedir,
|
|
||||||
[ --with-codepagedir=DIR Where to put codepage files (\$libdir/codepages)],
|
|
||||||
[ case "$withval" in
|
|
||||||
yes|no)
|
|
||||||
#
|
|
||||||
# Just in case anybody does it
|
|
||||||
#
|
|
||||||
AC_MSG_WARN([--with-codepagedir called without argument - will use default])
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
codepagedir="$withval"
|
|
||||||
;;
|
|
||||||
esac])
|
|
||||||
|
|
||||||
|
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
|
|
||||||
dnl Add #include for broken IRIX header files
|
dnl Add #include for broken IRIX header files
|
||||||
@ -327,6 +310,22 @@ fi
|
|||||||
AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
|
AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
|
||||||
AC_DEFINE(HAVE_LIBDL)])
|
AC_DEFINE(HAVE_LIBDL)])
|
||||||
|
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# check if the compiler can do immediate structures
|
||||||
|
AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <stdio.h>],
|
||||||
|
[
|
||||||
|
#define X_FOOBAR(x) ((FOOBAR) { x })
|
||||||
|
typedef struct {unsigned x;} FOOBAR;
|
||||||
|
FOOBAR f = X_FOOBAR(1);
|
||||||
|
],
|
||||||
|
samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
|
||||||
|
if test x"$samba_cv_immediate_structures" = x"yes"; then
|
||||||
|
AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
|
||||||
|
fi
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# check for unix domain sockets
|
# check for unix domain sockets
|
||||||
AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
|
AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
|
||||||
|
@ -220,6 +220,8 @@
|
|||||||
#undef HAVE_NATIVE_ICONV
|
#undef HAVE_NATIVE_ICONV
|
||||||
#undef HAVE_UNIXSOCKET
|
#undef HAVE_UNIXSOCKET
|
||||||
#undef MMAP_BLACKLIST
|
#undef MMAP_BLACKLIST
|
||||||
|
#undef HAVE_IMMEDIATE_STRUCTURES
|
||||||
|
#undef HAVE_CUPS
|
||||||
|
|
||||||
/* The number of bytes in a int. */
|
/* The number of bytes in a int. */
|
||||||
#undef SIZEOF_INT
|
#undef SIZEOF_INT
|
||||||
@ -761,6 +763,12 @@
|
|||||||
/* Define if you have the <ctype.h> header file. */
|
/* Define if you have the <ctype.h> header file. */
|
||||||
#undef HAVE_CTYPE_H
|
#undef HAVE_CTYPE_H
|
||||||
|
|
||||||
|
/* Define if you have the <cups/cups.h> header file. */
|
||||||
|
#undef HAVE_CUPS_CUPS_H
|
||||||
|
|
||||||
|
/* Define if you have the <cups/language.h> header file. */
|
||||||
|
#undef HAVE_CUPS_LANGUAGE_H
|
||||||
|
|
||||||
/* Define if you have the <dirent.h> header file. */
|
/* Define if you have the <dirent.h> header file. */
|
||||||
#undef HAVE_DIRENT_H
|
#undef HAVE_DIRENT_H
|
||||||
|
|
||||||
@ -983,8 +991,8 @@
|
|||||||
/* Define if you have the acl library (-lacl). */
|
/* Define if you have the acl library (-lacl). */
|
||||||
#undef HAVE_LIBACL
|
#undef HAVE_LIBACL
|
||||||
|
|
||||||
/* Define if you have cups installed. */
|
/* Define if you have the cups library (-lcups). */
|
||||||
#undef HAVE_CUPS
|
#undef HAVE_LIBCUPS
|
||||||
|
|
||||||
/* Define if you have the gen library (-lgen). */
|
/* Define if you have the gen library (-lgen). */
|
||||||
#undef HAVE_LIBGEN
|
#undef HAVE_LIBGEN
|
||||||
|
@ -78,14 +78,6 @@
|
|||||||
/* here's a special one from observing NT */
|
/* here's a special one from observing NT */
|
||||||
#define ERRnoipc 66 /* don't support ipc */
|
#define ERRnoipc 66 /* don't support ipc */
|
||||||
|
|
||||||
/* These errors seem to be only returned by the NT printer driver system */
|
|
||||||
|
|
||||||
#define ERRunknownprinterdriver 1797 /* ERROR_UNKNOWN_PRINTER_DRIVER */
|
|
||||||
#define ERRinvalidprintername 1801 /* ERROR_INVALID_PRINTER_NAME */
|
|
||||||
#define ERRinvaliddatatype 1804 /* ERROR_INVALID_DATATYPE */
|
|
||||||
#define ERRinvalidenvironment 1805 /* ERROR_INVALID_ENVIRONMENT */
|
|
||||||
#define ERRprinterdriverinuse 3001 /* ERROR_PRINTER_DRIVER_IN_USE */
|
|
||||||
|
|
||||||
/* Error codes for the ERRSRV class */
|
/* Error codes for the ERRSRV class */
|
||||||
|
|
||||||
#define ERRerror 1 /* Non specific error code */
|
#define ERRerror 1 /* Non specific error code */
|
||||||
@ -140,4 +132,19 @@
|
|||||||
#define ERRsharebufexc 36 /* share buffer exceeded */
|
#define ERRsharebufexc 36 /* share buffer exceeded */
|
||||||
#define ERRdiskfull 39
|
#define ERRdiskfull 39
|
||||||
|
|
||||||
|
|
||||||
|
/* these are win32 error codes. There are only a few places where
|
||||||
|
these matter for Samba, primarily in the NT printing code */
|
||||||
|
#define WERR_OK W_ERROR(0)
|
||||||
|
#define WERR_BADFID W_ERROR(6)
|
||||||
|
#define WERR_INSUFFICIENT_BUFFER W_ERROR(122)
|
||||||
|
#define WERR_NOMEM W_ERROR(8)
|
||||||
|
#define WERR_INVALID_NAME W_ERROR(123)
|
||||||
|
#define WERR_UNKNOWN_LEVEL W_ERROR(124)
|
||||||
|
#define WERR_UNKNOWN_PRINTER_DRIVER W_ERROR(1797)
|
||||||
|
#define WERR_INVALID_PRINTER_NAME W_ERROR(1801)
|
||||||
|
#define WERR_INVALID_DATATYPE W_ERROR(1804)
|
||||||
|
#define WERR_INVALID_ENVIRONMENT W_ERROR(1805)
|
||||||
|
#define WERR_PRINTER_DRIVER_IN_USE W_ERROR(3001)
|
||||||
|
|
||||||
#endif /* _DOSERR_H */
|
#endif /* _DOSERR_H */
|
||||||
|
@ -789,7 +789,7 @@ typedef struct printer_info_0
|
|||||||
uint32 unknown16;
|
uint32 unknown16;
|
||||||
uint32 change_id;
|
uint32 change_id;
|
||||||
uint32 unknown18;
|
uint32 unknown18;
|
||||||
NTSTATUS status;
|
uint32 status;
|
||||||
uint32 unknown20;
|
uint32 unknown20;
|
||||||
uint32 c_setprinter;
|
uint32 c_setprinter;
|
||||||
|
|
||||||
@ -832,7 +832,7 @@ typedef struct printer_info_2
|
|||||||
uint32 defaultpriority;
|
uint32 defaultpriority;
|
||||||
uint32 starttime;
|
uint32 starttime;
|
||||||
uint32 untiltime;
|
uint32 untiltime;
|
||||||
NTSTATUS status;
|
uint32 status;
|
||||||
uint32 cjobs;
|
uint32 cjobs;
|
||||||
uint32 averageppm;
|
uint32 averageppm;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,13 @@ typedef struct nttime_info
|
|||||||
uint32 high;
|
uint32 high;
|
||||||
} NTTIME;
|
} NTTIME;
|
||||||
|
|
||||||
#ifdef __GNUC__XX_NOT_YET
|
|
||||||
|
/* the following rather strange looking definitions of NTSTATUS and WERROR
|
||||||
|
and there in order to catch common coding errors where different error types
|
||||||
|
are mixed up. This is especially important as we slowly convert Samba
|
||||||
|
from using BOOL for internal functions
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_IMMEDIATE_STRUCTURES) && defined(TRIDGE_TEST)
|
||||||
typedef struct {uint32 v;} NTSTATUS;
|
typedef struct {uint32 v;} NTSTATUS;
|
||||||
#define NT_STATUS(x) ((NTSTATUS) { x })
|
#define NT_STATUS(x) ((NTSTATUS) { x })
|
||||||
#define NT_STATUS_V(x) ((x).v)
|
#define NT_STATUS_V(x) ((x).v)
|
||||||
@ -217,8 +223,20 @@ typedef uint32 NTSTATUS;
|
|||||||
#define NT_STATUS_V(x) (x)
|
#define NT_STATUS_V(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_IMMEDIATE_STRUCTURES) && defined(TRIDGE_TEST)
|
||||||
|
typedef struct {uint32 v;} WERROR;
|
||||||
|
#define W_ERROR(x) ((WERROR) { x })
|
||||||
|
#define W_ERROR_V(x) ((x).v)
|
||||||
|
#else
|
||||||
|
typedef uint32 WERROR;
|
||||||
|
#define W_ERROR(x) (x)
|
||||||
|
#define W_ERROR_V(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0)
|
#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0)
|
||||||
#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000)
|
#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000)
|
||||||
|
#define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0)
|
||||||
|
|
||||||
|
|
||||||
/* Allowable account control bits */
|
/* Allowable account control bits */
|
||||||
#define ACB_DISABLED 0x0001 /* 1 = User account disabled */
|
#define ACB_DISABLED 0x0001 /* 1 = User account disabled */
|
||||||
|
@ -182,3 +182,14 @@ char *smb_errstr(char *inbuf)
|
|||||||
slprintf(ret, sizeof(ret) - 1, "Error: Unknown error (%d,%d)",class,num);
|
slprintf(ret, sizeof(ret) - 1, "Error: Unknown error (%d,%d)",class,num);
|
||||||
return(ret);
|
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;
|
||||||
|
}
|
||||||
|
@ -1610,7 +1610,7 @@ static uint32 get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **in
|
|||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static uint32 get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, fstring in_prt, fstring in_arch, uint32 version)
|
static WERROR get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, fstring in_prt, fstring in_arch, uint32 version)
|
||||||
{
|
{
|
||||||
NT_PRINTER_DRIVER_INFO_LEVEL_3 driver;
|
NT_PRINTER_DRIVER_INFO_LEVEL_3 driver;
|
||||||
TDB_DATA kbuf, dbuf;
|
TDB_DATA kbuf, dbuf;
|
||||||
@ -1677,7 +1677,7 @@ static uint32 get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr,
|
|||||||
|
|
||||||
*info_ptr = (NT_PRINTER_DRIVER_INFO_LEVEL_3 *)memdup(&driver, sizeof(driver));
|
*info_ptr = (NT_PRINTER_DRIVER_INFO_LEVEL_3 *)memdup(&driver, sizeof(driver));
|
||||||
|
|
||||||
return 0;
|
return WERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -2490,7 +2490,7 @@ static uint32 get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstrin
|
|||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharename)
|
static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharename)
|
||||||
{
|
{
|
||||||
pstring key;
|
pstring key;
|
||||||
NT_PRINTER_INFO_LEVEL_2 info;
|
NT_PRINTER_INFO_LEVEL_2 info;
|
||||||
@ -2561,8 +2561,7 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen
|
|||||||
DEBUG(9,("Unpacked printer [%s] name [%s] running driver [%s]\n",
|
DEBUG(9,("Unpacked printer [%s] name [%s] running driver [%s]\n",
|
||||||
sharename, info.printername, info.drivername));
|
sharename, info.printername, info.drivername));
|
||||||
|
|
||||||
|
return WERR_OK;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -3024,9 +3023,9 @@ uint32 save_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level, NT_PRINTER
|
|||||||
Get a NT_PRINTER_INFO_LEVEL struct. It returns malloced memory.
|
Get a NT_PRINTER_INFO_LEVEL struct. It returns malloced memory.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32 get_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level, fstring sharename)
|
WERROR get_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level, fstring sharename)
|
||||||
{
|
{
|
||||||
uint32 result;
|
WERROR result;
|
||||||
NT_PRINTER_INFO_LEVEL *printer = NULL;
|
NT_PRINTER_INFO_LEVEL *printer = NULL;
|
||||||
|
|
||||||
*pp_printer = NULL;
|
*pp_printer = NULL;
|
||||||
@ -3052,11 +3051,11 @@ uint32 get_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level, fstring s
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
result=1;
|
result=W_ERROR(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(10,("get_a_printer: [%s] level %u returning %u\n", sharename, (unsigned int)level, (unsigned int)result));
|
DEBUG(10,("get_a_printer: [%s] level %u returning %s\n", sharename, (unsigned int)level, werror_str(result)));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -3130,10 +3129,10 @@ uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level)
|
|||||||
}
|
}
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
uint32 get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level,
|
WERROR get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level,
|
||||||
fstring printername, fstring architecture, uint32 version)
|
fstring printername, fstring architecture, uint32 version)
|
||||||
{
|
{
|
||||||
uint32 result;
|
WERROR result;
|
||||||
|
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
@ -3143,7 +3142,7 @@ uint32 get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
result=1;
|
result=W_ERROR(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -766,7 +766,7 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
|
|||||||
case NT_STATUS_OK:
|
case NT_STATUS_OK:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ERRunknownprinterdriver:
|
case WERR_UNKNOWN_PRINTER_DRIVER:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -804,7 +804,7 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
|
|||||||
cli_nt_session_close (cli);
|
cli_nt_session_close (cli);
|
||||||
talloc_destroy(mem_ctx);
|
talloc_destroy(mem_ctx);
|
||||||
|
|
||||||
if (result==ERRunknownprinterdriver)
|
if (result==WERR_UNKNOWN_PRINTER_DRIVER)
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
else
|
else
|
||||||
return result;
|
return result;
|
||||||
@ -899,7 +899,7 @@ static uint32 cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **a
|
|||||||
cli_nt_session_close (cli);
|
cli_nt_session_close (cli);
|
||||||
talloc_destroy(mem_ctx);
|
talloc_destroy(mem_ctx);
|
||||||
|
|
||||||
if (result==ERRunknownprinterdriver)
|
if (result==WERR_UNKNOWN_PRINTER_DRIVER)
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
else
|
else
|
||||||
return result;
|
return result;
|
||||||
|
@ -126,7 +126,7 @@ END {
|
|||||||
gotstart = 1;
|
gotstart = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $0 ~ /^smb_iconv_t|^long|^char|^uint|^NTSTATUS|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) {
|
if( $0 ~ /^smb_iconv_t|^long|^char|^uint|^NTSTATUS|^WERROR|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) {
|
||||||
gotstart = 1;
|
gotstart = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user