diff -Nurp nbtscan-1.5.1a.orig/list.c nbtscan-1.5.1a/list.c --- list.c 2002-01-13 14:37:05.000000000 +0000 +++ list.c 2006-03-18 04:52:27.740965000 +0000 @@ -12,7 +12,7 @@ struct list* new_list() { err_die("Malloc failed", quiet); lst->head = NULL; return lst; -}; +} struct list_item* new_list_item(unsigned long content) { struct list_item* lst_item; @@ -24,7 +24,7 @@ struct list_item* new_list_item(unsigned lst_item->prev = NULL; lst_item->content = content; return lst_item; -}; +} void delete_list(struct list* list) { struct list_item* pointer; @@ -42,7 +42,7 @@ void delete_list(struct list* list) { free(pointer); } free(list); -}; +} int compare(struct list_item* item1, struct list_item* item2) { if(item2==NULL) return ERROR; @@ -50,7 +50,7 @@ int compare(struct list_item* item1, str if(item1->content == item2->content) return 0; if(item1->content > item2->content) return 1; if(item1->content < item2->content) return -1; -}; +} int insert(struct list* lst, unsigned long content) { @@ -95,7 +95,7 @@ int insert(struct list* lst, unsigned lo free(item); return ERROR; }; -}; +} int in_list(struct list* lst, unsigned long content) { struct list_item *temp_item, *item; @@ -108,4 +108,4 @@ int in_list(struct list* lst, unsigned l while(compare(temp_item, item) < 0) temp_item = temp_item->next; if (compare(temp_item, item)==0) return 1; return 0; -}; +} diff -Nurp nbtscan-1.5.1a.orig/nbtscan.c nbtscan-1.5.1a/nbtscan.c --- nbtscan.c 2006-03-18 04:45:58.000000000 +0000 +++ nbtscan.c 2006-03-18 04:56:07.480965000 +0000 @@ -68,20 +68,20 @@ void usage(void) { printf("\tnbtscan -f iplist\n"); printf("\t\tScans IP addresses specified in file iplist.\n"); exit(2); -}; +} int set_range(char* range_str, struct ip_range* range_struct) { if(is_ip(range_str, range_struct)) return 1; if(is_range1(range_str, range_struct)) return 1; if(is_range2(range_str, range_struct)) return 1; return 0; -}; +} int print_header() { printf("%-17s%-17s%-10s%-17s%-17s\n", "IP address", "NetBIOS Name", "Server", "User", "MAC address"); printf("------------------------------------------------------------------------------\n"); -}; +} int d_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo) { int i; @@ -143,7 +143,7 @@ int d_print_hostinfo(struct in_addr addr printf("Max sessions: 0x%04 (%1$d)\n", hostinfo->footer->max_sessions); printf("Packet sessions: 0x%04 (%1$d)\n", hostinfo->footer->packet_sessions); }; -}; +} int v_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo, char* sf, int hr) { @@ -165,7 +165,7 @@ int v_print_hostinfo(struct in_addr addr service = hostinfo->names[i].ascii_name[15]; strncpy(comp_name, hostinfo->names[i].ascii_name, 15); - // Eliminate trailing spaces + /* Eliminate trailing spaces */ for(j=0; j < 15; j++) { if (comp_name[j] == ' ') break; @@ -223,7 +223,7 @@ int print_hostinfo(struct in_addr addr, /* Unique name, workstation service - this is computer name */ strncpy(comp_name, hostinfo->names[i].ascii_name, 15); - // Eliminate trailing spaces + /* Eliminate trailing spaces */ for(j=0; j < 15; j++) { if (comp_name[j] == ' ') break; @@ -259,7 +259,7 @@ int print_hostinfo(struct in_addr addr, printf("\n"); }; return 1; -}; +} /* Print hostinfo in /etc/hosts or lmhosts format */ /* If l is true adds #PRE to each line of output (for lmhosts) */ @@ -282,7 +282,7 @@ int l_print_hostinfo(struct in_addr addr /* Unique name, workstation service - this is computer name */ strncpy(comp_name, hostinfo->names[i].ascii_name, 15); - // Eliminate trailing spaces + /* Eliminate trailing spaces */ for(j=0; j < 15; j++) { if (comp_name[j] == ' ') break; @@ -309,7 +309,8 @@ int main(int argc, char *argv[]) { char* filename =NULL; struct ip_range range; void *buff; - int sock, addr_size; + int sock; + unsigned int addr_size; struct sockaddr_in src_sockaddr, dest_sockaddr; struct in_addr *prev_in_addr=NULL; struct in_addr *next_in_addr; @@ -646,5 +647,5 @@ int main(int argc, char *argv[]) { delete_list(scanned); exit(0); -}; +} diff -Nurp nbtscan-1.5.1a.orig/range.c nbtscan-1.5.1a/range.c --- range.c 2002-05-23 09:31:45.000000000 +0000 +++ range.c 2006-03-18 04:50:35.730965000 +0000 @@ -27,7 +27,7 @@ int is_ip(char* string, struct ip_range* range->end_ip = ntohl(addr); return 1; } else return 0; -}; +} /* is_range1 checks if supplied string is an IP address range in form xxx.xxx.xxx.xxx/xx (as in 192.168.1.2/24) and fills @@ -55,7 +55,7 @@ int is_range1(char* string, struct ip_ra else mask=((1<start_ip=ntohl(range->start_ip); // We store ips in host byte order + range->start_ip=ntohl(range->start_ip); /* We store ips in host byte order */ range->start_ip &= mask; range->end_ip = range->start_ip | ( ~ mask); free(ip); @@ -63,14 +63,14 @@ int is_range1(char* string, struct ip_ra } free(ip); return 0; -}; +} /* next_address function writes next ip address in range after prev_addr to structure pointed by next_addr. Returns 1 if next ip found and 0 otherwise */ int next_address(const struct ip_range* range, const struct in_addr* prev_addr, struct in_addr* next_addr) { - unsigned long pa; // previous address, host byte order + unsigned long pa; /* previous address, host byte order */ if(prev_addr) { pa = ntohl(prev_addr->s_addr); @@ -82,7 +82,7 @@ int next_address(const struct ip_range* next_addr->s_addr=htonl(range->start_ip); return 1; }; -}; +} /* is_range2 checks if supplied string is an IP address range in form xxx.xxx.xxx.xxx-xxx (as in 192.168.1.2-15) and fills @@ -122,7 +122,7 @@ int is_range2(char* string, struct ip_ra } free(ip); return 0; -}; +} int print_range(const struct ip_range* range) { struct in_addr *addr; @@ -137,4 +137,4 @@ int print_range(const struct ip_range* r printf("%s\n",inet_ntoa(*addr)); }; free(addr); -}; +} diff -Nurp nbtscan-1.5.1a.orig/range.h nbtscan-1.5.1a/range.h --- range.h 2002-01-13 14:37:05.000000000 +0000 +++ range.h 2006-03-18 04:49:34.120965000 +0000 @@ -9,7 +9,7 @@ #define RANGE_H struct ip_range { - unsigned long start_ip; // IP addresses in _host_ order, not network + unsigned long start_ip; /* IP addresses in _host_ order, not network */ unsigned long end_ip; }; diff -Nurp nbtscan-1.5.1a.orig/statusq.c nbtscan-1.5.1a/statusq.c --- statusq.c 2002-02-08 13:05:55.000000000 +0000 +++ statusq.c 2006-03-18 04:48:40.780965000 +0000 @@ -1,6 +1,6 @@ /* This file contains a portion of code from Samba package, * /* which contains the following license: * -/ +/* Unix SMB/Netbios implementation Version 1.9 Main SMB server routine @@ -85,7 +85,7 @@ int name_mangle( char *In, char *Out, ch } } return( strlen(Out) ); -}; /* name_mangle */ +} /* name_mangle */ /* end of code from Samba */ @@ -121,7 +121,7 @@ int send_query(int sock, struct in_addr snprintf(errmsg, 80, "%s\tSendto failed", inet_ntoa(dest_addr)); err_print(errmsg, quiet); return(-1); }; -}; +} my_uint32_t get32(void* data) { union { @@ -131,7 +131,7 @@ my_uint32_t get32(void* data) { memcpy(x.bytes, data, 4); return(ntohl(x.all)); -}; +} my_uint16_t get16(void* data) { union { @@ -141,7 +141,7 @@ my_uint16_t get16(void* data) { memcpy(x.bytes, data, 2); return(ntohs(x.all)); -}; +} struct nb_host_info* parse_response(char* buff, int buffsize) { struct nb_host_info* hostinfo = NULL; @@ -164,11 +164,11 @@ struct nb_host_info* parse_response(char /* Start with header */ if( offset+sizeof(response_header->transaction_id) >= buffsize) goto broken_packet; response_header->transaction_id = get16(buff+offset); - //Move pointer to the next structure field + /* Move pointer to the next structure field */ offset+=sizeof(response_header->transaction_id); hostinfo->header = response_header; - // Check if there is room for next field in buffer + /* Check if there is room for next field in buffer */ if( offset+sizeof(response_header->flags) >= buffsize) goto broken_packet; response_header->flags = get16(buff+offset); offset+=sizeof(response_header->flags); @@ -326,7 +326,7 @@ struct nb_host_info* parse_response(char broken_packet: hostinfo->is_broken = offset; return hostinfo; -}; +} nb_service_t services[] = { "__MSBROWSE__", 0x01, 0, "Master Browser", @@ -383,4 +383,4 @@ char* getnbservicename(my_uint8_t servic snprintf(unknown, 100, "Unknown service (code %x)", service); return(unknown); -}; +}