summaryrefslogtreecommitdiff
path: root/source3/libsmb/smberr.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb/smberr.c')
-rw-r--r--source3/libsmb/smberr.c85
1 files changed, 27 insertions, 58 deletions
diff --git a/source3/libsmb/smberr.c b/source3/libsmb/smberr.c
index 228eee5892..c2d8884d73 100644
--- a/source3/libsmb/smberr.c
+++ b/source3/libsmb/smberr.c
@@ -143,70 +143,39 @@ struct
{0xFF,"ERRCMD",NULL},
{-1,NULL,NULL}};
-char *smb_err_msg(uint8 class, uint32 num)
-{
- static pstring ret;
- smb_safe_err_msg(class, num, ret, sizeof(ret));
- return ret;
-}
-
/****************************************************************************
return a SMB error string from a SMB buffer
****************************************************************************/
-BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len)
+char *smb_errstr(char *inbuf)
{
- int i,j;
-
- for (i=0;err_classes[i].class;i++)
- {
- if (err_classes[i].code == class)
+ static pstring ret;
+ int class = CVAL(inbuf,smb_rcls);
+ int num = SVAL(inbuf,smb_err);
+ int i,j;
+
+ for (i=0;err_classes[i].class;i++)
+ if (err_classes[i].code == class)
+ {
+ if (err_classes[i].err_msgs)
+ {
+ err_code_struct *err = err_classes[i].err_msgs;
+ for (j=0;err[j].name;j++)
+ if (num == err[j].code)
{
- err_code_struct *err = err_classes[i].err_msgs;
- if (err != NULL)
- {
- for (j=0;err[j].name;j++)
- {
- if (num == err[j].code)
- {
- if (DEBUGLEVEL > 0)
- {
- slprintf(ret, len - 1, "%s - %s (%s)",err_classes[i].class,
- err[j].name,err[j].message);
- }
- else
- {
- slprintf(ret, len - 1, "%s - %s",err_classes[i].class,err[j].name);
- }
- return True;
- }
- }
- }
- slprintf(ret, len - 1, "%s - %d",err_classes[i].class, num);
- return True;
+ if (DEBUGLEVEL > 0)
+ slprintf(ret, sizeof(ret) - 1, "%s - %s (%s)",err_classes[i].class,
+ err[j].name,err[j].message);
+ else
+ slprintf(ret, sizeof(ret) - 1, "%s - %s",err_classes[i].class,err[j].name);
+ return ret;
}
+ }
- }
-
- slprintf(ret, len - 1, "Error: Unknown error (%d,%d)",class,num);
- return False;
-}
-
-/****************************************************************************
-return a SMB error string from a SMB buffer
-****************************************************************************/
-BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len)
-{
- return smb_safe_err_msg(CVAL(inbuf,smb_rcls), SVAL(inbuf,smb_err),
- msg, len);
-}
-
-/****************************************************************************
-return a SMB error string from a SMB buffer
-****************************************************************************/
-char *smb_errstr(char *inbuf)
-{
- static fstring errmsg;
- (void)smb_safe_errstr(inbuf, errmsg, sizeof(errmsg));
- return errmsg;
+ slprintf(ret, sizeof(ret) - 1, "%s - %d",err_classes[i].class,num);
+ return ret;
+ }
+
+ slprintf(ret, sizeof(ret) - 1, "Error: Unknown error (%d,%d)",class,num);
+ return(ret);
}