GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
+#include "nmbd/nmbd.h"
uint16 samba_nb_type = 0; /* samba's NetBIOS name type */
struct name_record *find_name_on_subnet(struct subnet_record *subrec,
const struct nmb_name *nmbname,
- BOOL self_only)
+ bool self_only)
{
struct nmb_name uc_name;
struct name_record *name_ret;
************************************************************************/
struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
- BOOL self_only)
+ bool self_only)
{
struct subnet_record *subrec;
struct name_record *namerec;
Add an entry to a subnet name list.
***********************************************************************/
-BOOL add_name_to_subnet( struct subnet_record *subrec,
+bool add_name_to_subnet( struct subnet_record *subrec,
const char *name,
int type,
uint16 nb_flags,
int num_ips,
struct in_addr *iplist)
{
- BOOL ret = False;
+ bool ret = False;
struct name_record *namerec;
time_t time_now = time(NULL);
+ if (num_ips == 0) {
+ return false;
+ }
+
namerec = SMB_MALLOC_P(struct name_record);
if( NULL == namerec ) {
DEBUG( 0, ( "add_name_to_subnet: malloc fail.\n" ) );
******************************************************************/
void standard_fail_register( struct subnet_record *subrec,
- struct response_record *rrec,
struct nmb_name *nmbname )
{
struct name_record *namerec;
Utility function to check if an IP address exists in a name record.
******************************************************************/
-BOOL find_ip_in_name_record( struct name_record *namerec, struct in_addr ip )
+bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip )
{
int i;
for(i = 0; i < namerec->data.num_ips; i++) {
- if(ip_equal( namerec->data.ip[i], ip)) {
+ if(ip_equal_v4( namerec->data.ip[i], ip)) {
return True;
}
}
int orig_num = namerec->data.num_ips;
for(i = 0; i < orig_num; i++) {
- if( ip_equal( remove_ip, namerec->data.ip[i]) ) {
+ if( ip_equal_v4( remove_ip, namerec->data.ip[i]) ) {
remove_nth_ip_in_record( namerec, i);
break;
}
return;
}
- for( bcast_subrecs = FIRST_SUBNET, i = 0; bcast_subrecs; bcast_subrecs = NEXT_SUBNET_EXCLUDING_UNICAST(bcast_subrecs), i++ )
+ for( bcast_subrecs = FIRST_SUBNET, i = 0; bcast_subrecs &&
+ i < num_ips;
+ bcast_subrecs = NEXT_SUBNET_EXCLUDING_UNICAST(bcast_subrecs), i++ ) {
iplist[i] = bcast_subrecs->myip;
+ }
+ num_ips = i;
}
add_name_to_subnet(subrec,"*",0x0,samba_nb_type, PERMANENT_TTL,