summaryrefslogtreecommitdiff
path: root/source3/libsmb/nmblib.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb/nmblib.c')
-rw-r--r--source3/libsmb/nmblib.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index 14dc5ecee2..54b1779f44 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -287,6 +287,7 @@ static int put_nmb_name(char *buf,int offset,struct nmb_name *name)
return(ret);
}
+
/*******************************************************************
useful for debugging messages
******************************************************************/
@@ -296,16 +297,24 @@ char *nmb_namestr(struct nmb_name *n)
static fstring ret[4];
char *p = ret[i];
- if (!n->scope[0])
- slprintf(p,sizeof(fstring)-1, "%s<%02x>",n->name,n->name_type);
- else
- slprintf(p,sizeof(fstring)-1, "%s<%02x>.%s",n->name,n->name_type,n->scope);
+ nmb_safe_namestr(n, p, sizeof(fstring));
i = (i+1)%4;
return(p);
}
/*******************************************************************
+ useful for debugging messages
+ ******************************************************************/
+void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len)
+{
+ if (!n->scope[0])
+ slprintf(str, len-1, "%s<%02x>",n->name,n->name_type);
+ else
+ slprintf(str, len-1, "%s<%02x>.%s",n->name,n->name_type,n->scope);
+}
+
+/*******************************************************************
allocate and parse some resource records
******************************************************************/
static BOOL parse_alloc_res_rec(char *inbuf,int *offset,int length,