s3-nmbd: note TODO item for qsort
[ira/wip.git] / source3 / nmbd / nmbd_incomingrequests.c
index 90773c13951fbe036f440e3a0366c2f09d24fb55..6d8436d9e38251fd88b1faadd18d11b74c10998e 100644 (file)
@@ -314,14 +314,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));
@@ -331,7 +331,7 @@ subnet %s - name not found.\n", nmb_namestr(&nmb->question.question_name),
  
        /* this is not an exact calculation. the 46 is for the stats buffer
                and the 60 is to leave room for the header etc */
-       bufend = &rdata[MAX_DGRAM_SIZE] - (18 + 46 + 60);
+       bufend = &rdata[MAX_DGRAM_SIZE-1] - (18 + 46 + 60);
        countptr = buf = rdata;
        buf += 1;
        buf0 = buf;
@@ -373,6 +373,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 );
                }