summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/libsmb/nmblib.c17
2 files changed, 14 insertions, 4 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index cca2a6be79..361eda72b5 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -722,6 +722,7 @@ BOOL find_master_ip(char *group, struct in_addr *master_ip);
void debug_nmb_packet(struct packet_struct *p);
char *nmb_namestr(struct nmb_name *n);
+void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
struct packet_struct *copy_packet(struct packet_struct *packet);
void free_packet(struct packet_struct *packet);
struct packet_struct *read_packet(int fd,enum packet_type packet_type);
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,