We will need this new nterr.c for the DOMAIN_CLIENT code.
authorJeremy Allison <jra@samba.org>
Thu, 23 Apr 1998 22:08:39 +0000 (22:08 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 23 Apr 1998 22:08:39 +0000 (22:08 +0000)
Jeremy.

source/libsmb/nterr.c

index bda0f882a6400f7f626b56e52c552bc30bb810b7..dca97ab923814209064ba28508d0cf85de9fe067 100644 (file)
@@ -1,18 +1,23 @@
+/* NT error codes.  please read nterr.h */
 
+#include "includes.h"
 #include "nterr.h"
 
-static struct
+typedef struct
 {
        char *nt_errstr;
-       uint16 nt_errcode;
+       uint32 nt_errcode;
 
-} nt_errs[] =
+} nt_err_code_struct;
+
+nt_err_code_struct nt_errs[] =
 {
        { "NT_STATUS_UNSUCCESSFUL", NT_STATUS_UNSUCCESSFUL },
        { "NT_STATUS_NOT_IMPLEMENTED", NT_STATUS_NOT_IMPLEMENTED },
        { "NT_STATUS_INVALID_INFO_CLASS", NT_STATUS_INVALID_INFO_CLASS },
        { "NT_STATUS_INFO_LENGTH_MISMATCH", NT_STATUS_INFO_LENGTH_MISMATCH },
        { "NT_STATUS_ACCESS_VIOLATION", NT_STATUS_ACCESS_VIOLATION },
+       { "STATUS_BUFFER_OVERFLOW", STATUS_BUFFER_OVERFLOW },
        { "NT_STATUS_IN_PAGE_ERROR", NT_STATUS_IN_PAGE_ERROR },
        { "NT_STATUS_PAGEFILE_QUOTA", NT_STATUS_PAGEFILE_QUOTA },
        { "NT_STATUS_INVALID_HANDLE", NT_STATUS_INVALID_HANDLE },
@@ -512,3 +517,25 @@ static struct
        { NULL, 0 }
 };
 
+/*****************************************************************************
+ returns an NT error message.  not amazingly helpful, but better than a number.
+ *****************************************************************************/
+char *get_nt_error_msg(uint32 nt_code)
+{
+       static pstring msg;
+       int idx = 0;
+
+       strcpy(msg, "Unknown NT error");
+
+       while (nt_errs[idx].nt_errstr != NULL)
+       {
+               if (nt_errs[idx].nt_errcode == nt_code)
+               {
+                       strcpy(msg, nt_errs[idx].nt_errstr);
+                       return msg;
+               }
+               idx++;
+       }
+       return NULL;
+}
+