1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s4/scripting/bin: Add NT_STATUS_OK to list of definitions

Add NT_STATUS_OK to our pre-generated list of status codes. Ensure it
goes first in the list to ensure that code that previously found this
error code in ‘special_errs’ maintains the same behaviour by falling
back to ‘nt_errs’.

This makes NT_STATUS_OK available to Python code using the ‘ntstatus’
module.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-05-26 15:14:22 +12:00 committed by Andrew Bartlett
parent 7c66cd4dfd
commit efb85e3d6d
3 changed files with 10 additions and 4 deletions

View File

@ -45,7 +45,6 @@ typedef struct
* same table as the other ones. */
static const nt_err_code_struct special_errs[] =
{
{ "NT_STATUS_OK", NT_STATUS_OK },
{ "STATUS_NO_MORE_FILES", STATUS_NO_MORE_FILES },
{ "STATUS_INVALID_EA_NAME", STATUS_INVALID_EA_NAME },
{ "STATUS_BUFFER_OVERFLOW", STATUS_BUFFER_OVERFLOW },

View File

@ -51,8 +51,6 @@ typedef uint32_t NTSTATUS;
#define NT_STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP NT_STATUS(0xC05D0000)
/* Other error codes that aren't in the list we use */
#define NT_STATUS_OK NT_STATUS_SUCCESS
#define STATUS_MORE_ENTRIES NT_STATUS_MORE_ENTRIES
#define STATUS_BUFFER_OVERFLOW NT_STATUS_BUFFER_OVERFLOW
#define STATUS_NO_MORE_FILES NT_STATUS_NO_MORE_FILES

View File

@ -22,7 +22,7 @@
#
import sys, io
from gen_error_common import parseErrorDescriptions
from gen_error_common import ErrorDef, parseErrorDescriptions
def generateHeaderFile(out_file, errors):
out_file.write("/*\n")
@ -129,6 +129,15 @@ def main ():
with io.open(input_file, "rt", encoding='utf8') as file_contents:
errors = parseErrorDescriptions(file_contents, False, transformErrorName)
# NT_STATUS_OK is a synonym of NT_STATUS_SUCCESS, and is very widely used
# throughout Samba. It must go first in the list to ensure that to ensure
# that code that previously found this error code in special_errs
# maintains the same behaviour by falling back to nt_errs.
ok_status = ErrorDef()
ok_status.err_code = 0
ok_status.err_define = 'NT_STATUS_OK'
errors.insert(0, ok_status)
print("writing new header file: %s" % gen_headerfile_name)
out_file = io.open(gen_headerfile_name, "wt", encoding='utf8')
generateHeaderFile(out_file, errors)