]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4/scripting/bin: Add NT_STATUS_OK to list of definitions
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 26 May 2023 03:14:22 +0000 (15:14 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 14 Jun 2023 22:57:35 +0000 (22:57 +0000)
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>
libcli/util/nterr.c
libcli/util/ntstatus.h
source4/scripting/bin/gen_ntstatus.py

index 3bca6da1b5551be5a52179016b470e265beaa8e7..0a57a8fd28e8038b99b17cf6b4e4f97f64dea253 100644 (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 },
index 2aaee5dcc4dcc4a2c2c71f6dcf0bfab483b49930..9a1d1fd855ac568f54da21844c5db16898c60236 100644 (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
index 09aa4f3662038fd3c42deb957112facdbd842bb7..bf0f01640b07ba5fb2272ac01711d0914ff92cb1 100755 (executable)
@@ -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)