s3-param Remove special case for global_myname(), rename to lp_netbios_name()
[kai/samba.git] / source3 / nmbd / nmbd_incomingrequests.c
index ebe194814109096d963cfbc74acf16592f83e986..b2545f102fc9463cad4ca64932cbe32ce556b092 100644 (file)
@@ -25,6 +25,7 @@
 */
 
 #include "includes.h"
+#include "nmbd/nmbd.h"
 
 /****************************************************************************
 Send a name release response.
@@ -289,14 +290,14 @@ static int status_compare(char *n1,char *n2)
                ;
        for (l2=0;l2<15 && n2[l2] && n2[l2] != ' ';l2++)
                ;
-       l3 = strlen(global_myname());
+       l3 = strlen(lp_netbios_name());
 
-       if ((l1==l3) && strncmp(n1,global_myname(),l3) == 0 && 
-                       (l2!=l3 || strncmp(n2,global_myname(),l3) != 0))
+       if ((l1==l3) && strncmp(n1,lp_netbios_name(),l3) == 0 &&
+                       (l2!=l3 || strncmp(n2,lp_netbios_name(),l3) != 0))
                return -1;
 
-       if ((l2==l3) && strncmp(n2,global_myname(),l3) == 0 && 
-                       (l1!=l3 || strncmp(n1,global_myname(),l3) != 0))
+       if ((l2==l3) && strncmp(n2,lp_netbios_name(),l3) == 0 &&
+                       (l1!=l3 || strncmp(n1,lp_netbios_name(),l3) != 0))
                return 1;
 
        return memcmp(n1,n2,sizeof(name1));
@@ -314,14 +315,14 @@ void process_node_status_request(struct subnet_record *subrec, struct packet_str
        char rdata[MAX_DGRAM_SIZE];
        char *countptr, *buf, *bufend, *buf0;
        int names_added,i;
-       struct name_record *namerec;
+       struct name_record *namerec = NULL;
 
        pull_ascii_nstring(qname, sizeof(qname), nmb->question.question_name.name);
 
        DEBUG(3,("process_node_status_request: status request for name %s from IP %s on \
 subnet %s.\n", nmb_namestr(&nmb->question.question_name), inet_ntoa(p->ip), subrec->subnet_name));
 
-       if((namerec = find_name_on_subnet(subrec, &nmb->question.question_name, FIND_SELF_NAME)) == 0) {
+       if(find_name_on_subnet(subrec, &nmb->question.question_name, FIND_SELF_NAME) == 0) {
                DEBUG(1,("process_node_status_request: status request for name %s from IP %s on \
 subnet %s - name not found.\n", nmb_namestr(&nmb->question.question_name),
                        inet_ntoa(p->ip), subrec->subnet_name));
@@ -373,6 +374,8 @@ subnet %s - name not found.\n", nmb_namestr(&nmb->question.question_name),
 
                /* Remove duplicate names. */
                if (names_added > 1) {
+                       /* TODO: should use a real type and
+                          TYPESAFE_QSORT() */
                        qsort( buf0, names_added, 18, QSORT_CAST status_compare );
                }